Hacker News new | ask | show | jobs
by gpm 1090 days ago
Rust will protect against all overflows on the stack (up to compiler bugs, tier 2 and lower platforms do not necessarily get this guarantee).

If you use too much stack space, it terminates the program. It does now however allow for arbitrary code execution like most C compilers do.

1 comments

Are you aware of what an exploitable scenario of using too much stack space looks like?

The buffer needs to be so large that it not only exceeds the offset to the guard page, but it reaches a non-faulting address. Lastly it needs to be accessed from the front first rather than the back.

I don't know if compilers commonly generate benign memory accesses from the back of the buffer for large stack allocations to get the page fault handler going. I thought that they did after some prominent Linux exploits in this area. If they do do that, this is safe. Also, this issue would also affect the rust compiler, so they must employ that strategy if this works.