summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2017-02-11 06:07:04 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2017-02-11 06:07:04 +0000
commit8421c9856c44d7ff07711ffb88c51f30b56b9dfa (patch)
treed8c9499656aab2e4844a5bb0506ccf42d8a5d54e /sys/kern
parent45241c68a99d59738e5ff46fbeb1f2430642c6d4 (diff)
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@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/exec_elf.c6
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;