summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2022-11-14 13:13:20 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2022-11-14 13:13:20 +0000
commitd2469c05663acc3f59be586c9baf18f251d60e34 (patch)
tree82b12c71dd1b8d8a88821501e7230d91c5001699
parenta17877dd62726256561350699387a9420e313ae8 (diff)
Since the introduction of automatic immutable from the kernel, the munmap()
of ld.so boot.text region is now (silently) failing because the region is contained within the text LOAD, which is immutable. So create a new btext LOAD with flags PF_X|PF_R|PF_OPENBSD_MUTABLE, and place all boot.text objects in there. This LOAD must also be page-aligned so it doesn't skip unmapping some of the object region, previously it was hilariously unaligned. ok kettenis and guenther seemed to like it also This one is for powerpc64 and a modified version of the diff deraadt@ mailed out to make sure the LOADs are in increasing address order. this is the version for sparc64, tested by pascal also
-rw-r--r--libexec/ld.so/sparc64/ld.script7
1 files changed, 5 insertions, 2 deletions
diff --git a/libexec/ld.so/sparc64/ld.script b/libexec/ld.so/sparc64/ld.script
index ca16652722b..34f7875a031 100644
--- a/libexec/ld.so/sparc64/ld.script
+++ b/libexec/ld.so/sparc64/ld.script
@@ -2,6 +2,7 @@ PHDRS
{
rodata PT_LOAD FILEHDR PHDRS FLAGS (4);
text PT_LOAD;
+ btext PT_LOAD FLAGS (0x08000005);
data PT_LOAD;
random PT_OPENBSD_RANDOMIZE;
relro PT_GNU_RELRO;
@@ -20,13 +21,15 @@ SECTIONS
/* .eh_frame : { *(.eh_frame) } :rodata */
/* TEXT */
- . = ALIGN(0x100000) + (. & (0x100000 - 1)) + 0;
+ . = ALIGN(0x100000);
.boot.text :
{
+ . = ALIGN(0x2000);
boot_text_start = .;
*(.boot.text)
+ . = ALIGN(0x2000);
boot_text_end = .;
- } :text =0xcccccccc
+ } :btext =0xcccccccc
. = ALIGN(0x100000);
.text : { *(.text .text.*) } :text =0xcccccccc