From 51689999131972de3737a6cebfc77b68f9a299e7 Mon Sep 17 00:00:00 2001 From: kettenis Date: Sun, 21 Jan 2024 17:18:13 +0000 Subject: [PATCH] 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@ --- lib/libc/dlfcn/init.c | 3 +-- 1 file changed, 1 insertion(+), 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 * @@ -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; -- 2.20.1