diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2022-11-08 06:47:32 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2022-11-08 06:47:32 +0000 |
commit | 8e8b1462cb0bc36cd6c11ab5ca61e0b50ff079ff (patch) | |
tree | 7434130cedab160cb58f813481f0b7c78cb03aa9 /libexec | |
parent | 940887aebe8d5bb8988f4344f184f7d91f5b497a (diff) |
Instead of unmapping boot.text, and then a future allocation could land in
the gap, mmap a fresh MAP_FIXED MAP_ANON PROT_NONE and make it immutable
for good measure
ok guenther kettenis
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/ld.so/loader.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c index c0cf506cbd7..96aadbfe79d 100644 --- a/libexec/ld.so/loader.c +++ b/libexec/ld.so/loader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loader.c,v 1.201 2022/11/07 10:35:26 deraadt Exp $ */ +/* $OpenBSD: loader.c,v 1.202 2022/11/08 06:47:31 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -219,9 +219,13 @@ _dl_clean_boot(void) extern char boot_data_start[], boot_data_end[]; #endif - _dl_munmap(boot_text_start, boot_text_end - boot_text_start); + _dl_mmap(boot_text_start, boot_text_end - boot_text_start, + PROT_NONE, MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0); + _dl_mimmutable(boot_text_start, boot_text_end - boot_text_start); #if 0 /* XXX breaks boehm-gc?!? */ - _dl_munmap(boot_data_start, boot_data_end - boot_data_start); + _dl_mmap(boot_data_start, boot_data_end - boot_data_start, + PROT_NONE, MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0); + _dl_mimmutable(boot_data_start, boot_data_end - boot_data_start); #endif } #endif /* DO_CLEAN_BOOT */ |