Skip to content

Commit 61701af

Browse files
committed
Disable the __ehdr_start safety checking in the vdso parsing code.
Older Linux toolchains don't implement `__ehdr_start`, so disable this check for now.
1 parent 619184f commit 61701af

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/imp/linux_raw/vdso.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,22 @@ unsafe fn init_from_sysinfo_ehdr(base: usize) -> Option<Vdso> {
191191
/// which hopefully holds the value of the kernel-provided vDSO in memory. Do
192192
/// a series of checks to be as sure as we can that it's safe to use.
193193
unsafe fn check_vdso_base<'vdso>(base: usize) -> Option<&'vdso Elf_Ehdr> {
194-
extern "C" {
195-
static __ehdr_start: c::c_void;
196-
}
194+
// In theory, we could check that we're not attempting to parse our own ELF
195+
// image, as an additional check. However, older Linux toolchains don't
196+
// support this, and Rust's `#[linkage = "extern_weak"]` isn't stable yet,
197+
// so just disable this for now.
198+
/*
199+
{
200+
extern "C" {
201+
static __ehdr_start: c::c_void;
202+
}
197203
198-
// Check that we're not attempting to parse our own ELF image.
199-
let ehdr_start: *const c::c_void = &__ehdr_start;
200-
if base == (ehdr_start as usize) {
201-
return None;
204+
let ehdr_start: *const c::c_void = &__ehdr_start;
205+
if base == (ehdr_start as usize) {
206+
return None;
207+
}
202208
}
209+
*/
203210

204211
// Check that the vDSO is page-aligned and appropriately mapped.
205212
madvise(

0 commit comments

Comments
 (0)