4 ms·
I really don't understand why we still mix our control and data stacks together. Memory fragmentation made this necessary in the past but we shouldn't need thi
by slededit 9y ago
I really don't understand why we still mix our control and data stacks together. Memory fragmentation made this necessary in the past but we shouldn't need this anymore.
- AnimalMuppet 9y agoIt 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.
- beached_whale 9y agoNot all architectures do this, there are many systems with Hardvard Architecture in use
- slededit 9y agoHarvard architecture is separating the code address space from the data. But the stack itself intermingles return addresses "control" and data just the same.
- beached_whale 9y agoAh good point. But that would still mean the adversary has to put an address on the stack that already exists. Much harder target, no?
- slededit 9y agoYes but libc provides a juicy and consistent set of code you can jump to. Remember you don't have to jump to the start of a function. ASLR helps this a bit as well.
- beached_whale 9y agoI doubt libc(much of it like printf) or alsr exists on an 8051, maybe more so of libc on an AVR
- slededit 9y agoPowerPC is a harvard architecture. Its not just for small uCs.
- beached_whale 9y agoOoh, cool. I did not know of that one.