]> git.lizzy.rs Git - rust.git/commitdiff
Update libc to 0.2.121
authorPatrick Mooney <pmooney@pfmooney.com>
Mon, 4 Apr 2022 17:55:30 +0000 (17:55 +0000)
committerPatrick Mooney <pmooney@oxide.computer>
Tue, 5 Apr 2022 16:22:32 +0000 (11:22 -0500)
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`.

Cargo.lock
library/std/src/sys/unix/stack_overflow.rs

index d8cb1133c73a367e1d8998d9690129da75eb8ae9..bdfb51761760f21fed8d2eb89175ead386267511 100644 (file)
@@ -2019,9 +2019,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
 
 [[package]]
 name = "libc"
-version = "0.2.116"
+version = "0.2.121"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "565dbd88872dbe4cc8a46e527f26483c1d1f7afa6b884a3bd6cd893d4f98da74"
+checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f"
 dependencies = [
  "rustc-std-workspace-core",
 ]
index 1e8d1137ac8b865f1a8bbb8a74d57baec9ded908..75a5c0f927982b3e8b542048839b7e9a0a8e7278 100644 (file)
@@ -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 @@ unsafe fn siginfo_si_addr(info: *mut libc::siginfo_t) -> usize {
         _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.