3 ms·
Deeper than that! Such fundamentals as 'the stack is accessible by code' goes back to Fortran. C doesn't need that. The call stack and the 'display' stack could
by JoeAltmaier 4y ago
Deeper than that! Such fundamentals as 'the stack is accessible by code' goes back to Fortran. C doesn't need that. The call stack and the 'display' stack could be different things and no C programmer need care.
This is the root of attacks that rewrite the return address of a kernel call. If the return address were managed/protected outside normal data operation this would not exist.
- pklausler 4y agoCould you explain this in more detail, please? Fortran standards didn't support recursion until Fortran '90 and it wasn't easy to get stack allocation in F'77 compilers from vendors until the mid-80's or so, both long after Algol-like languages had them.
- rtomanek 4y agoWondering if they meant Forth rather than Fortran.
- int_19h 4y agoIt's even less true for Forth, given that it has separate data and return address stacks, and neither is addressable. There is some dedicated Forth hardware that relies on this fact to separate the stacks physically in hardware and e.g. use SRAM for them.
- JoeAltmaier 4y agoFortran programmers abused the stack in astonishing ways. They used to calculate offsets on the stack to variables in the previous frame you already returned from. The details of stack layout were coded into important applications. Intel designers tried to do better, but the Fortran people pushed back, hard.