Skip to content
/ rust Public
forked from rust-lang/rust

Commit b3ac6fa

Browse files
authored
Rollup merge of rust-lang#122002 - devnexen:thread_stack_netbsd_fix, r=workingjubilee,riastradh
std::threads: revisit stack address calculation on netbsd. like older linux glibc versions, we need to get the guard size and increasing the stack's bottom address accordingly.
2 parents 1009859 + ffdd97f commit b3ac6fa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

library/std/src/sys/pal/unix/thread.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -806,9 +806,9 @@ pub mod guard {
806806
#[cfg(any(
807807
target_os = "android",
808808
target_os = "freebsd",
809+
target_os = "netbsd",
809810
target_os = "hurd",
810811
target_os = "linux",
811-
target_os = "netbsd",
812812
target_os = "l4re"
813813
))]
814814
unsafe fn get_stack_start() -> Option<*mut libc::c_void> {
@@ -911,9 +911,10 @@ pub mod guard {
911911
}
912912
}) * page_size;
913913
Some(guard)
914-
} else if cfg!(target_os = "openbsd") {
914+
} else if cfg!(any(target_os = "openbsd", target_os = "netbsd")) {
915915
// OpenBSD stack already includes a guard page, and stack is
916916
// immutable.
917+
// NetBSD stack includes the guard page.
917918
//
918919
// We'll just note where we expect rlimit to start
919920
// faulting, so our handler can report "stack overflow", and

0 commit comments

Comments
 (0)