3 ms·
It was convenient, when a function returned, to only have to pop one stack rather than two. And maybe more than just convenient. Mixing them allows stack smas
by AnimalMuppet 9y ago
It was convenient, when a function returned, to only have to pop one stack rather than two.
And maybe more than just convenient. Mixing them allows stack smashing bugs, but it completely eliminates bugs where the control and data stacks get out of sync.
Which is worse? We don't know, because we don't have decades of experience with "stack out of sync" attacks.
- slededit 9y agoAllowing a bug to hijack the control flow of the program is much worse. To a limited extent you can do this even with pure data manipulation (function pointers, if statement inputs etc) but it is much more constrained. FWIW Web Assembly doesn't mix the control and data stacks.
- titzer 9y agoCorrect. In fact, WebAssembly does not allow (indirectly) addressing the data stack at all. One must implement an addressable data stack in "userspace" with explicit management.