summary refs log tree commit diff
path: root/library/std/src/sys
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-04-07 02:41:28 +0000
committerbors <bors@rust-lang.org>2022-04-07 02:41:28 +0000
commit846993ec43c615c64a0496d3eb3c8615830842e4 (patch)
treed9ec4a554bc1e8076e37f541e5848cbbb9403343 /library/std/src/sys
parent2310da432ca1c3e87f1d17e069f2336f2d4939e5 (diff)
parent33fd73fedeb5cd61dbbb7562fd927c0b6994653a (diff)
downloadrust-846993ec43c615c64a0496d3eb3c8615830842e4.tar.gz
rust-846993ec43c615c64a0496d3eb3c8615830842e4.zip
Auto merge of #95688 - pfmooney:libc-update, r=Mark-Simulacrum
Update libc to 0.2.121

With the updated libc, UNIX stack overflow handling in libstd can now
use the common `si_addr` accessor function, rather than attempting to
use a field from that name in `siginfo_t`.  This simplifies the
collection of the fault address, particularly on platforms where that
data resides within a union in `siginfo_t`.
Diffstat (limited to 'library/std/src/sys')
-rw-r--r--library/std/src/sys/unix/stack_overflow.rs18
1 files changed, 1 insertions, 17 deletions
diff --git a/library/std/src/sys/unix/stack_overflow.rs b/library/std/src/sys/unix/stack_overflow.rs
index 1e8d1137ac8..75a5c0f9279 100644
--- a/library/std/src/sys/unix/stack_overflow.rs
+++ b/library/std/src/sys/unix/stack_overflow.rs
@@ -54,22 +54,6 @@ mod imp {
     use crate::sys::unix::os::page_size;
     use crate::sys_common::thread_info;
 
-    #[cfg(any(target_os = "linux", target_os = "android"))]
-    unsafe fn siginfo_si_addr(info: *mut libc::siginfo_t) -> usize {
-        #[repr(C)]
-        struct siginfo_t {
-            a: [libc::c_int; 3], // si_signo, si_errno, si_code
-            si_addr: *mut libc::c_void,
-        }
-
-        (*(info as *const siginfo_t)).si_addr as usize
-    }
-
-    #[cfg(not(any(target_os = "linux", target_os = "android")))]
-    unsafe fn siginfo_si_addr(info: *mut libc::siginfo_t) -> usize {
-        (*info).si_addr as usize
-    }
-
     // Signal handler for the SIGSEGV and SIGBUS handlers. We've got guard pages
     // (unmapped pages) at the end of every thread's stack, so if a thread ends
     // up running into the guard page it'll trigger this handler. We want to
@@ -97,7 +81,7 @@ mod imp {
         _data: *mut libc::c_void,
     ) {
         let guard = thread_info::stack_guard().unwrap_or(0..0);
-        let addr = siginfo_si_addr(info);
+        let addr = (*info).si_addr() as usize;
 
         // If the faulting address is within the guard page, then we print a
         // message saying so and abort.