summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2024-01-21 17:18:14 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2024-01-21 17:18:14 +0000
commitfc6966896318d4dfca7406570383588d7e569ea4 (patch)
treee534bd015bb52650c70dd9493b2451089cdef942 /lib/libc
parent4c8991124d26e38eddfb4a2befdd66ce905c8015 (diff)
Static non-PIE binaries always have a base address of 0 (even if the ELF
headers start at a higher address). Using the wrong base address meant that we were protecting the wrong address range for the malloc internals which made the code error out now that mimmutable(2) no longer allows an RW->R transition. Issue found by gkoehler@ who got most of the way towards a proper fix. ok deraadt@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/dlfcn/init.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/libc/dlfcn/init.c b/lib/libc/dlfcn/init.c
index dd38ba9ddfb..9fc63c97f98 100644
--- a/lib/libc/dlfcn/init.c
+++ b/lib/libc/dlfcn/init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init.c,v 1.21 2024/01/19 14:15:51 deraadt Exp $ */
+/* $OpenBSD: init.c,v 1.22 2024/01/21 17:18:13 kettenis Exp $ */
/*
* Copyright (c) 2014,2015 Philip Guenther <guenther@openbsd.org>
*
@@ -129,7 +129,6 @@ _libc_preinit(int argc, char **argv, char **envp, dl_cb_cb *cb)
* Static non-PIE processes don't get an AUX vector,
* so find the phdrs through the ELF header
*/
- _static_phdr_info.dlpi_addr = (Elf_Addr)__executable_start;
phdr = (void *)((char *)__executable_start +
__executable_start->e_phoff);
phnum = __executable_start->e_phnum;