Rollup merge of #126207 - devnexen:stack_overflow_libc_upd, r=joboet

std::unix::stack_overflow::drop_handler addressing todo through libc …

…update
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-10-18 14:52:25 +01:00 committed by GitHub
commit 39af44dae9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -265,9 +265,7 @@ pub unsafe fn drop_handler(data: *mut libc::c_void) {
/// Modern kernels on modern hardware can have dynamic signal stack sizes.
#[cfg(any(target_os = "linux", target_os = "android"))]
fn sigstack_size() -> usize {
// FIXME: reuse const from libc when available?
const AT_MINSIGSTKSZ: crate::ffi::c_ulong = 51;
let dynamic_sigstksz = unsafe { libc::getauxval(AT_MINSIGSTKSZ) };
let dynamic_sigstksz = unsafe { libc::getauxval(libc::AT_MINSIGSTKSZ) };
// If getauxval couldn't find the entry, it returns 0,
// so take the higher of the "constant" and auxval.
// This transparently supports older kernels which don't provide AT_MINSIGSTKSZ