Uh oh!
There was an error while loading. Please reload this page.
Fix stack overflow detection on FreeBSD 11.1+ - #83771
Conversation
Beginning with FreeBSD 10.4 and 11.1, there is one guard page by default. And the stack autoresizes, so if Rust allocates its own guard page, then FreeBSD's will simply move up one page. The best solution is to just use the OS's guard page.
rust-highfive
commented
Apr 2, 2021
r? @dtolnay (rust-highfive has picked a reviewer for you, use r? to override) |
dtolnay
commented
Apr 2, 2021
@bors r+ |
bors
commented
Apr 2, 2021
📌 Commit ca14abb has been approved by |
…tolnay Fix stack overflow detection on FreeBSD 11.1+ Beginning with FreeBSD 10.4 and 11.1, there is one guard page by default. And the stack autoresizes, so if Rust allocates its own guard page, then FreeBSD's will simply move up one page. The best solution is to just use the OS's guard page.
…tolnay Fix stack overflow detection on FreeBSD 11.1+ Beginning with FreeBSD 10.4 and 11.1, there is one guard page by default. And the stack autoresizes, so if Rust allocates its own guard page, then FreeBSD's will simply move up one page. The best solution is to just use the OS's guard page.
asomers
commented
Apr 2, 2021
Yeah I did. But I didn't do a great job because:
|
Rollup of 7 pull requests Successful merges: - rust-lang#83065 (Rework `std::sys::windows::alloc`) - rust-lang#83478 (rustdoc: Add unstable option to only emit shared/crate-specific files) - rust-lang#83629 (Fix double-drop in `Vec::from_iter(vec.into_iter())` specialization when items drop during panic) - rust-lang#83673 (give full path of constraint in suggest_constraining_type_param) - rust-lang#83755 (Simplify coverage tests) - rust-lang#83757 (2229: Support migration via rustfix) - rust-lang#83771 (Fix stack overflow detection on FreeBSD 11.1+) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Huh, does FreeBSD really allocate a guard page for thread stacks as well? Surprising, but also very sensible. |
cuviper
commented
Apr 2, 2021
LGTM! My prior contribution was to maintain the existing effect on FreeBSD, adding that FIXME because it seemed weird. I'm happy to let an actual user verify what does or does not work. So congrats, @asomers, you get to be our local expert! 🙂 |
asomers
commented
Apr 2, 2021
Yes, each thread gets a guard page here: https://github.com/freebsd/freebsd-src/blob/4d221f59b851a9c844c84701bab7f4edb7026bd4/lib/libthr/thread/thr_stack.c#L276 |
Beginning with FreeBSD 10.4 and 11.1, there is one guard page by
default. And the stack autoresizes, so if Rust allocates its own guard
page, then FreeBSD's will simply move up one page. The best solution is
to just use the OS's guard page.