From: deraadt Date: Sun, 6 Nov 2022 11:34:50 +0000 (+0000) Subject: When loading startup libraries, pass DF_1_NODELETE to indicate these are X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3349f56c14413839727e79e7cdae7863616596a4;p=openbsd When loading startup libraries, pass DF_1_NODELETE to indicate these are unloadable libraries. This allows us make consider making parts of those libraries immutable (in future commits) ok guenther kettenis --- diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c index 4ed2527618e..c9e8082cca0 100644 --- a/libexec/ld.so/loader.c +++ b/libexec/ld.so/loader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loader.c,v 1.196 2022/10/28 15:07:25 kettenis Exp $ */ +/* $OpenBSD: loader.c,v 1.197 2022/11/06 11:34:50 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -326,6 +326,10 @@ _dl_load_dep_libs(elf_object_t *object, int flags, int booting) /* propagate DF_1_NOW to deplibs (can be set by dynamic tags) */ depflags = flags | (dynobj->obj_flags & DF_1_NOW); + /* Startup libraries are never unmapped and can be immutable */ + if (booting) + depflags |= DF_1_NODELETE; + for (dynp = dynobj->load_dyn; dynp->d_tag; dynp++) { if (dynp->d_tag == DT_NEEDED) { libcount++;