Skip to content

Commit 846993e

Browse files
committed
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`.
2 parents 2310da4 + 33fd73f commit 846993e

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -2019,9 +2019,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
20192019

20202020
[[package]]
20212021
name = "libc"
2022-
version = "0.2.116"
2022+
version = "0.2.121"
20232023
source = "registry+https://github.com/rust-lang/crates.io-index"
2024-
checksum = "565dbd88872dbe4cc8a46e527f26483c1d1f7afa6b884a3bd6cd893d4f98da74"
2024+
checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f"
20252025
dependencies = [
20262026
"rustc-std-workspace-core",
20272027
]

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

+1-17
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,6 @@ mod imp {
5454
use crate::sys::unix::os::page_size;
5555
use crate::sys_common::thread_info;
5656

57-
#[cfg(any(target_os = "linux", target_os = "android"))]
58-
unsafe fn siginfo_si_addr(info: *mut libc::siginfo_t) -> usize {
59-
#[repr(C)]
60-
struct siginfo_t {
61-
a: [libc::c_int; 3], // si_signo, si_errno, si_code
62-
si_addr: *mut libc::c_void,
63-
}
64-
65-
(*(info as *const siginfo_t)).si_addr as usize
66-
}
67-
68-
#[cfg(not(any(target_os = "linux", target_os = "android")))]
69-
unsafe fn siginfo_si_addr(info: *mut libc::siginfo_t) -> usize {
70-
(*info).si_addr as usize
71-
}
72-
7357
// Signal handler for the SIGSEGV and SIGBUS handlers. We've got guard pages
7458
// (unmapped pages) at the end of every thread's stack, so if a thread ends
7559
// up running into the guard page it'll trigger this handler. We want to
@@ -97,7 +81,7 @@ mod imp {
9781
_data: *mut libc::c_void,
9882
) {
9983
let guard = thread_info::stack_guard().unwrap_or(0..0);
100-
let addr = siginfo_si_addr(info);
84+
let addr = (*info).si_addr() as usize;
10185

10286
// If the faulting address is within the guard page, then we print a
10387
// message saying so and abort.

0 commit comments

Comments
 (0)