Skip to content

Commit

Permalink
Unrolled build for rust-lang#122002
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rust-timer authored Mar 11, 2024
2 parents 6639672 + ffdd97f commit 635d1ed
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions library/std/src/sys/pal/unix/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,9 +806,9 @@ pub mod guard {
#[cfg(any(
target_os = "android",
target_os = "freebsd",
target_os = "netbsd",
target_os = "hurd",
target_os = "linux",
target_os = "netbsd",
target_os = "l4re"
))]
unsafe fn get_stack_start() -> Option<*mut libc::c_void> {
Expand Down Expand Up @@ -911,9 +911,10 @@ pub mod guard {
}
}) * page_size;
Some(guard)
} else if cfg!(target_os = "openbsd") {
} else if cfg!(any(target_os = "openbsd", target_os = "netbsd")) {
// OpenBSD stack already includes a guard page, and stack is
// immutable.
// NetBSD stack includes the guard page.
//
// We'll just note where we expect rlimit to start
// faulting, so our handler can report "stack overflow", and
Expand Down

0 comments on commit 635d1ed

Please sign in to comment.