Skip to content

Commit 47d029e

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 1d2d398 + 6014717 commit 47d029e

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

std/src/sys/unix/stack_overflow.rs

Lines changed: 1 addition & 17 deletions
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)