The /var/run/ld.so.hints file is mapped into memory. It is never replaced,
authorderaadt <deraadt@openbsd.org>
Sat, 5 Nov 2022 18:48:31 +0000 (18:48 +0000)
committerderaadt <deraadt@openbsd.org>
Sat, 5 Nov 2022 18:48:31 +0000 (18:48 +0000)
so the mapping can be immutable.
ok kettenis

libexec/ld.so/sod.c

index 6774e9e..4987c4f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: sod.c,v 1.36 2022/01/08 06:49:41 guenther Exp $       */
+/*     $OpenBSD: sod.c,v 1.37 2022/11/05 18:48:31 deraadt Exp $        */
 
 /*
  * Copyright (c) 1993 Paul Kranenburg
@@ -186,6 +186,8 @@ _dl_maphints(void)
        if (hheader->hh_version >= LD_HINTS_VERSION_2)
                _dl_hint_search_path = _dl_split_path(hstrtab + hheader->hh_dirlist);
 
+       _dl_mimmutable(addr, hsize);
+
        /* close the file descriptor, leaving the hints mapped */
        _dl_close(hfd);