Date: Mon, 29 Mar 2021 23:06:36 -0600 From: Alan Somers <asomers@freebsd.org> To: "freebsd-hackers@freebsd.org" <hackers@freebsd.org> Subject: How does the stack's guard page work on amd64? Message-ID: <CAOtMX2i5d0c9E=W=S6aKp1j5JczaaTqKDX8kW=2NqF=i35dWog@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Rust tries to detect stack overflow and handles it differently than other segfaults, but it's currently broken on FreeBSD/amd64. I've got a patch that fixes the problem, but I would like someone to confirm my reasoning. It seems like FreeBSD's main thread stacks include a guard page at the bottom. However, when Rust tries to create its own guard page (by re-mmap()ping and mprotect()ing it), it seems like FreeBSD's guard page automatically moves up into the un-remapped region. At least, that's how it behaves, based on the addresses that segfault. Is that correct? For other threads, Rust doesn't try to remap the guard page, it just relies on the guard page created by libthr in _thr_stack_alloc. Finally, what changed in between FreeBSD 10.3 and 11.4? Rust's stack overflow detection worked in 10.3. -Alan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2i5d0c9E=W=S6aKp1j5JczaaTqKDX8kW=2NqF=i35dWog>