diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2022-11-07 20:41:39 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2022-11-07 20:41:39 +0000 |
commit | 98810023cbb4eb63f1c66348276f41b28b6e8df8 (patch) | |
tree | fd464e49b1d3b036b1df3d0c9b433b5e255f44ce /libexec/ld.so/amd64/ld.script | |
parent | 94ca3e911a60ce75601252e83efc5164b16c0dfb (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.
Similar changes for other architectures coming after more testing.
ok kettenis and guenther seemed to like it also
Diffstat (limited to 'libexec/ld.so/amd64/ld.script')
-rw-r--r-- | libexec/ld.so/amd64/ld.script | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libexec/ld.so/amd64/ld.script b/libexec/ld.so/amd64/ld.script index 5629239dd52..29f4e14d844 100644 --- a/libexec/ld.so/amd64/ld.script +++ b/libexec/ld.so/amd64/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,14 +21,15 @@ SECTIONS .eh_frame : { *(.eh_frame) } :rodata /* TEXT */ - . = ALIGN(0x100000) + (. & (0x100000 - 1)) + 0; + . = ALIGN(0x1000); .boot.text : { + . = ALIGN(0x1000); boot_text_start = .; *(.boot.text) + . = ALIGN(0x1000); boot_text_end = .; - } :text =0xcccccccc - . = ALIGN(0x1000); + } :btext =0xcccccccc .text : { *(.text .text.*) } :text =0xcccccccc /* RELRO DATA */ |