8/18/2026 at 6:51:06 AM
Related to the above, two important concepts to know w.r.t a stack are "Red Zone" and "Guard Pages".Raymond Chen again;
Why do we even need to define a red zone? Can’t I just use my stack for anything? - https://devblogs.microsoft.com/oldnewthing/20190111-00/?p=10...
A closer look at the stack guard page - https://devblogs.microsoft.com/oldnewthing/20220203-00/?p=10...
by rramadass
8/18/2026 at 7:38:08 AM
I wonder how Linux manages without explicit _chkstk? In my experience, it feels like MAP_GROWSDOWN regions have way more than 1 guard page below its start — I can poke like a megabyte lower than its start, and the kernel will grow the memory region into there just fine.by Joker_vD
8/18/2026 at 8:40:49 AM
Preventing stack guard-page hopping - https://lwn.net/Articles/725832/According to this article, allocation in page sizes with implicit probing is used;
Stack clash mitigation in GCC, Part 3 (-fstack-clash-protection option) - https://developers.redhat.com/blog/2020/05/22/stack-clash-mi...
by rramadass
8/18/2026 at 10:20:27 AM
Thank you for the context. But still.You have a desirable performance optimization feature —used in every Linux program— that happens to interfere with a lousy exploit mitigation.
No one should ever need more than 64kBs for a stack anyways.
by avadodin
8/18/2026 at 10:49:49 AM
> No one should ever need more than 64kBs for a stack anyways.Well, if people would stop storing anything except than return addresses on the stack, yeah, probably even 32 KiB of stack would be enough for anyone. It'd also single-handedly stop all kinds of stack-smashing attacks, too: can't overwrite a return address on the stack if nothing stores data on the stack except the CALL/RET instructions.
Unfortunately, the current zeitgeist is still to have "writeable stacks" which are only moderately less horrible for the security than "executable stacks".
by Joker_vD
8/18/2026 at 12:50:34 PM
You can probably do this by maintaining two parallel stacks, changes to prologue/epilogue code and runtime startup files.by rramadass
8/18/2026 at 7:40:11 AM
It doesn't. This causes the StackClash vulnerability.by inigyou
8/18/2026 at 8:45:08 AM
https://news.ycombinator.com/item?id=49343032by rramadass