]> git.lizzy.rs Git - rust.git/blobdiff - library/std/src/sys/unix/thread.rs
Rollup merge of #102766 - thomcc:remove-resolv, r=Mark-Simulacrum
[rust.git] / library / std / src / sys / unix / thread.rs
index 7df4add8ce112e7aec9a7dd411ed0e2c103f5615..42ac6fcd8bf3677235fb1417b659cc7910495d7f 100644 (file)
@@ -766,6 +766,16 @@ pub unsafe fn init() -> Option<Guard> {
             const GUARD_PAGES: usize = 1;
             let guard = guardaddr..guardaddr + GUARD_PAGES * page_size;
             Some(guard)
+        } else if cfg!(target_os = "openbsd") {
+            // OpenBSD stack already includes a guard page, and stack is
+            // immutable.
+            //
+            // We'll just note where we expect rlimit to start
+            // faulting, so our handler can report "stack overflow", and
+            // trust that the kernel's own stack guard will work.
+            let stackptr = get_stack_start_aligned()?;
+            let stackaddr = stackptr.addr();
+            Some(stackaddr - page_size..stackaddr)
         } else {
             // Reallocate the last page of the stack.
             // This ensures SIGBUS will be raised on