summaryrefslogtreecommitdiff
path: root/libexec/ld.so
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-11-30 23:06:03 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-11-30 23:06:03 +0000
commit62614ee6dbb3fe02cab1473704dde6ed3a3627d2 (patch)
treef3fc12a171de8685452f8cc7c1ad0f53112411a6 /libexec/ld.so
parent398ac4d3802cf620a8f8ff7c18960d03988670ce (diff)
Sigh, fix i386 msyscall() case to permission the correct address range.
Diffstat (limited to 'libexec/ld.so')
-rw-r--r--libexec/ld.so/library_mquery.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/libexec/ld.so/library_mquery.c b/libexec/ld.so/library_mquery.c
index f7e2baaa747..9db2900dae1 100644
--- a/libexec/ld.so/library_mquery.c
+++ b/libexec/ld.so/library_mquery.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: library_mquery.c,v 1.61 2019/11/29 06:34:44 deraadt Exp $ */
+/* $OpenBSD: library_mquery.c,v 1.62 2019/11/30 23:06:02 deraadt Exp $ */
/*
* Copyright (c) 2002 Dale Rahn
@@ -265,6 +265,11 @@ retry:
res = _dl_mmap((void *)(LOFF + ld->moff), ROUND_PG(ld->size),
ld->prot, flags | MAP_FIXED | __MAP_NOREPLACE, fd, foff);
+ if ((ld->prot & PROT_EXEC) && exec_start == 0) {
+ exec_start = (void *)(LOFF + ld->moff);
+ exec_size = ROUND_PG(ld->size);
+ }
+
if (_dl_mmap_error(res)) {
struct load_list *ll;
@@ -289,11 +294,6 @@ retry:
load_end = (Elf_Addr)ld->start + ROUND_PG(ld->size);
}
- if ((flags & PROT_EXEC) && exec_start == 0) {
- exec_start = ld->start;
- exec_size = ROUND_PG(ld->size);
- }
-
phdp = (Elf_Phdr *)(hbuf + ehdr->e_phoff);
for (i = 0; i < ehdr->e_phnum; i++, phdp++) {
if (phdp->p_type == PT_OPENBSD_RANDOMIZE)
@@ -312,6 +312,8 @@ retry:
(Elf_Phdr *)((char *)lowld->start + ehdr->e_phoff), ehdr->e_phnum,
type, (Elf_Addr)lowld->start, LOFF);
if (object) {
+ char *soname = (char *)object->Dyn.info[DT_SONAME];
+
object->load_size = (Elf_Addr)load_end - (Elf_Addr)lowld->start;
object->load_list = lowld;
/* set inode, dev from stat info */