diff options
author | 2017-02-11 06:07:03 +0000 | |
---|---|---|
committer | 2017-02-11 06:07:03 +0000 | |
commit | a7c026e4daa07712dd536962a564ec81aad9eac6 (patch) | |
tree | b14e5a2b718ce8e3c3df0a6a9aa9a35d41e99fe5 | |
parent | sync (diff) | |
download | wireguard-openbsd-a7c026e4daa07712dd536962a564ec81aad9eac6.tar.xz wireguard-openbsd-a7c026e4daa07712dd536962a564ec81aad9eac6.zip |
Correct the entry point and base address calculations for an
interpreter whose entry point isn't in its first PT_LOAD segment.
problem report and testing by patrick@
-rw-r--r-- | sys/kern/exec_elf.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/exec_elf.c b/sys/kern/exec_elf.c index fc97a0aa541..209672e185d 100644 --- a/sys/kern/exec_elf.c +++ b/sys/kern/exec_elf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_elf.c,v 1.137 2017/02/08 21:04:44 guenther Exp $ */ +/* $OpenBSD: exec_elf.c,v 1.138 2017/02/11 06:07:03 guenther Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom @@ -460,7 +460,9 @@ elf_load_file(struct proc *p, char *path, struct exec_package *epp, eh.e_entry < (ph[i].p_vaddr + size)) { epp->ep_entry = addr + eh.e_entry - ELF_TRUNC(ph[i].p_vaddr,ph[i].p_align); - ap->arg_interp = addr; + if (flags == VMCMD_RELATIVE) + epp->ep_entry += pos; + ap->arg_interp = pos; } addr += size; break; |