From b8b8175121824ed2538378ae3e676af14f7f2c2b Mon Sep 17 00:00:00 2001 From: deraadt Date: Tue, 8 Nov 2022 13:47:22 +0000 Subject: [PATCH] In the new scheme, the main executable object needs to be marked nodelete, so that _dl_relro() will immutable it's relro. --- libexec/ld.so/alpha/ld.script | 0 libexec/ld.so/hppa/ld.script | 0 libexec/ld.so/i386/ld.script | 0 libexec/ld.so/loader.c | 3 ++- 4 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 libexec/ld.so/alpha/ld.script create mode 100644 libexec/ld.so/hppa/ld.script create mode 100644 libexec/ld.so/i386/ld.script diff --git a/libexec/ld.so/alpha/ld.script b/libexec/ld.so/alpha/ld.script new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libexec/ld.so/hppa/ld.script b/libexec/ld.so/hppa/ld.script new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libexec/ld.so/i386/ld.script b/libexec/ld.so/i386/ld.script new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c index 96aadbfe79d..4d08adfd633 100644 --- a/libexec/ld.so/loader.c +++ b/libexec/ld.so/loader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loader.c,v 1.202 2022/11/08 06:47:31 deraadt Exp $ */ +/* $OpenBSD: loader.c,v 1.203 2022/11/08 13:47:22 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -567,6 +567,7 @@ _dl_boot(const char **argv, char **envp, const long dyn_loff, long *dl_data) } exe_obj->load_list = load_list; exe_obj->obj_flags |= DF_1_GLOBAL; + exe_obj->nodelete = 1; exe_obj->load_size = maxva - minva; exe_obj->relro_addr = relro_addr; exe_obj->relro_size = relro_size; -- 2.20.1