Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions src/backend/linux_raw/param/auxv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ use core::sync::atomic::Ordering::Relaxed;
use core::sync::atomic::{AtomicPtr, AtomicUsize};
use linux_raw_sys::elf::*;
use linux_raw_sys::general::{
AT_BASE, AT_CLKTCK, AT_EXECFN, AT_HWCAP, AT_HWCAP2, AT_MINSIGSTKSZ, AT_NULL, AT_PAGESZ,
AT_SYSINFO_EHDR,
AT_CLKTCK, AT_EXECFN, AT_HWCAP, AT_HWCAP2, AT_MINSIGSTKSZ, AT_NULL, AT_PAGESZ, AT_SYSINFO_EHDR,
};
#[cfg(feature = "runtime")]
use linux_raw_sys::general::{
Expand Down Expand Up @@ -401,13 +400,12 @@ unsafe fn init_from_aux_iter(aux_iter: impl Iterator<Item = Elf_auxv_t>) -> Opti
AT_HWCAP2 => hwcap2 = a_val as usize,
AT_MINSIGSTKSZ => minsigstksz = a_val as usize,
AT_EXECFN => execfn = check_raw_pointer::<c::c_char>(a_val as *mut _)?.as_ptr(),
AT_SYSINFO_EHDR => sysinfo_ehdr = check_elf_base(a_val as *mut _)?.as_ptr(),

AT_BASE => {
// The `AT_BASE` value can be null in a static executable that
// doesn't use a dynamic linker. If so, ignore it.
if !a_val.is_null() {
let _ = check_elf_base(a_val.cast())?;
// Use the `AT_SYSINFO_EHDR` if it matches the platform rustix is
// compiled for.
AT_SYSINFO_EHDR => {
if let Some(value) = check_elf_base(a_val as *mut _) {
sysinfo_ehdr = value.as_ptr();
}
}

Expand Down Expand Up @@ -448,8 +446,7 @@ unsafe fn init_from_aux_iter(aux_iter: impl Iterator<Item = Elf_auxv_t>) -> Opti
secure = 2;
}

// The base and sysinfo_ehdr (if present) matches our platform. Accept the
// aux values.
// Accept the aux values.
PAGE_SIZE.store(pagesz, Relaxed);
CLOCK_TICKS_PER_SECOND.store(clktck, Relaxed);
HWCAP.store(hwcap, Relaxed);
Expand Down
Loading