Skip to content

Commit

Permalink
Ignore a null AT_BASE value. (#934)
Browse files Browse the repository at this point in the history
When processing AUX values, don't check whether `AT_BASE` is valid if it
is NULL, as NULL indicates a static executable that doesn't have a
dynamic linker.

Fixes #933.
  • Loading branch information
sunfishcode authored Nov 15, 2023
1 parent d482974 commit ca03130
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ jobs:
RUSTFLAGS: --cfg rustix_use_experimental_features
strategy:
matrix:
build: [ubuntu, ubuntu-20.04, i686-linux, aarch64-linux, powerpc64le-linux, riscv64-linux, s390x-linux, arm-linux, ubuntu-stable, i686-linux-stable, aarch64-linux-stable, riscv64-linux-stable, s390x-linux-stable, powerpc64le-linux-stable, arm-linux-stable, ubuntu-1.63, i686-linux-1.63, aarch64-linux-1.63, riscv64-linux-1.63, s390x-linux-1.63, powerpc64le-linux-1.63, arm-linux-1.63, macos-latest, macos-11, windows, windows-2019]
build: [ubuntu, ubuntu-20.04, i686-linux, aarch64-linux, powerpc64le-linux, riscv64-linux, s390x-linux, arm-linux, ubuntu-stable, i686-linux-stable, aarch64-linux-stable, riscv64-linux-stable, s390x-linux-stable, powerpc64le-linux-stable, arm-linux-stable, ubuntu-1.63, i686-linux-1.63, aarch64-linux-1.63, riscv64-linux-1.63, s390x-linux-1.63, powerpc64le-linux-1.63, arm-linux-1.63, macos-latest, macos-11, windows, windows-2019, musl]
include:
- build: ubuntu
os: ubuntu-latest
Expand Down Expand Up @@ -413,6 +413,10 @@ jobs:
- build: windows-2019
os: windows-2019
rust: nightly
- build: musl
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-musl
steps:
- uses: actions/checkout@v3
with:
Expand Down
6 changes: 5 additions & 1 deletion src/backend/linux_raw/param/auxv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,11 @@ unsafe fn init_from_aux_iter(aux_iter: impl Iterator<Item = Elf_auxv_t>) -> Opti
AT_SYSINFO_EHDR => sysinfo_ehdr = check_elf_base(a_val as *mut _)?.as_ptr(),

AT_BASE => {
let _ = check_elf_base(a_val.cast())?;
// 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())?;
}
}

#[cfg(feature = "runtime")]
Expand Down

0 comments on commit ca03130

Please sign in to comment.