Use more LFS functions.
On Linux, use mmap64, open64, openat64, and sendfile64 in place of their non-LFS counterparts. This is relevant to #94173. With these changes (together with rust-lang/backtrace-rs#501), the simple binaries I produce with rustc seem to have no non-LFS functions, so maybe #94173 is fixed. But I can't be sure if I've missed something and maybe some non-LFS functions could sneak in somehow.
This commit is contained in:
@@ -45,7 +45,10 @@ mod imp {
|
||||
use crate::thread;
|
||||
|
||||
use libc::MAP_FAILED;
|
||||
use libc::{mmap, munmap};
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
use libc::{mmap as mmap64, munmap};
|
||||
#[cfg(target_os = "linux")]
|
||||
use libc::{mmap64, munmap};
|
||||
use libc::{sigaction, sighandler_t, SA_ONSTACK, SA_SIGINFO, SIGBUS, SIG_DFL};
|
||||
use libc::{sigaltstack, SIGSTKSZ, SS_DISABLE};
|
||||
use libc::{MAP_ANON, MAP_PRIVATE, PROT_NONE, PROT_READ, PROT_WRITE, SIGSEGV};
|
||||
@@ -135,7 +138,7 @@ mod imp {
|
||||
#[cfg(not(any(target_os = "openbsd", target_os = "netbsd", target_os = "linux",)))]
|
||||
let flags = MAP_PRIVATE | MAP_ANON;
|
||||
let stackp =
|
||||
mmap(ptr::null_mut(), SIGSTKSZ + page_size(), PROT_READ | PROT_WRITE, flags, -1, 0);
|
||||
mmap64(ptr::null_mut(), SIGSTKSZ + page_size(), PROT_READ | PROT_WRITE, flags, -1, 0);
|
||||
if stackp == MAP_FAILED {
|
||||
panic!("failed to allocate an alternative stack: {}", io::Error::last_os_error());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user