Page MenuHomePhabricator

Please use GitHub pull requests for new patches. Phabricator shutdown timeline

[stack-clash] Fix probing of dynamic alloca

Authored by serge-sans-paille on Oct 27 2020, 3:17 AM.



Perform the probing in the *cough* correct direction.

Related to

Diff Detail

Event Timeline

serge-sans-paille requested review of this revision.Oct 27 2020, 3:17 AM

I tried the C reproducer from that Rust bug, and it turns out that alloca(0) was already fixed by D88548. But if I change that to a larger size, then it was skipping right over the probe loop. I confirmed that your change here does make it go through the loop.

It would be nice to have tests that actually execute this stuff, rather than just relying on manual reviews of the expected assembly, but I don't know if that's feasible in the current infrastructure.


Shouldn't this sub before mov 0? I think right now, the first iteration is going to clobber the most recent thing on the stack, in this case the saved value from pushq %rbp.

Fix issue with clobbered stack memory

cuviper accepted this revision.Oct 28 2020, 1:49 PM

Works for me!

This revision is now accepted and ready to land.Oct 28 2020, 1:49 PM
This revision was automatically updated to reflect the committed changes.