Skip to content

Commit 5448289

Browse files
Bobby Binghamrichfelker
authored andcommitted
treat null vdso base same as missing
On s390x, the kernel provides AT_SYSINFO_EHDR, but sets it to zero, if the program being run does not have a program interpreter. This causes problems when running the dynamic linker directly.
1 parent b418ea1 commit 5448289

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

ldso/dynlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ _Noreturn void __dls3(size_t *sp)
15501550
}
15511551

15521552
/* Attach to vdso, if provided by the kernel */
1553-
if (search_vec(auxv, &vdso_base, AT_SYSINFO_EHDR)) {
1553+
if (search_vec(auxv, &vdso_base, AT_SYSINFO_EHDR) && vdso_base) {
15541554
Ehdr *ehdr = (void *)vdso_base;
15551555
Phdr *phdr = vdso.phdr = (void *)(vdso_base + ehdr->e_phoff);
15561556
vdso.phnum = ehdr->e_phnum;

src/internal/vdso.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ void *__vdsosym(const char *vername, const char *name)
4545
size_t i;
4646
for (i=0; libc.auxv[i] != AT_SYSINFO_EHDR; i+=2)
4747
if (!libc.auxv[i]) return 0;
48+
if (!libc.auxv[i+1]) return 0;
4849
Ehdr *eh = (void *)libc.auxv[i+1];
4950
Phdr *ph = (void *)((char *)eh + eh->e_phoff);
5051
size_t *dynv=0, base=-1;

0 commit comments

Comments
 (0)