diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2017-03-22 10:47:30 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2017-03-22 10:47:30 +0000 |
commit | db17f14929936c41e6265bc755b6a476de76388d (patch) | |
tree | 407d255f72ab5f9d81ae1c23bfcee61e02a2af28 /sys/arch/arm64/conf/kern.ldscript | |
parent | 8ee73ce0f99999cbe894966fe11127d4526ba77d (diff) |
Implement kernel W^X for arm64. For this purpose align the different segments
containing .text, .rodata and .data/.bss at 2MB boundaries and set the
appropriate access permissions on the block translations.
ok patrick@
Diffstat (limited to 'sys/arch/arm64/conf/kern.ldscript')
-rw-r--r-- | sys/arch/arm64/conf/kern.ldscript | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/arch/arm64/conf/kern.ldscript b/sys/arch/arm64/conf/kern.ldscript index d422242bc43..9a4dd31ba86 100644 --- a/sys/arch/arm64/conf/kern.ldscript +++ b/sys/arch/arm64/conf/kern.ldscript @@ -1,4 +1,4 @@ -/* $OpenBSD: kern.ldscript,v 1.4 2017/01/23 14:11:21 kettenis Exp $ */ +/* $OpenBSD: kern.ldscript,v 1.5 2017/03/22 10:47:29 kettenis Exp $ */ /* $NetBSD: ldscript.evbarm,v 1.2 2003/03/05 23:54:22 thorpej Exp $ */ OUTPUT_ARCH(aarch64) @@ -12,34 +12,35 @@ PHDRS openbsd_randomize PT_OPENBSD_RANDOMIZE; } -__ALIGN_SIZE = 0x1000; +__ALIGN_SIZE = 0x200000; __kernel_base = @KERNEL_BASE_VIRT@; ENTRY(_start) SECTIONS { . = __kernel_base; + PROVIDE (__text_start = .); .text : { *(.text .text.*) *(.stub) *(.glue_7t) *(.glue_7) } :text =0 - PROVIDE (__etext = .); PROVIDE (_etext = .); PROVIDE (etext = .); /* Move rodata to the next page, so we can nuke X and W bit on it */ . = ALIGN(__ALIGN_SIZE); + PROVIDE (__rodata_start = .); .rodata : { *(.rodata .rodata.*) } :rodata - PROVIDE (erodata = .); - _erodata = .; + PROVIDE (_erodata = .); /* Move .random to the next page, so we can add W bit on it and .data */ . = ALIGN(__ALIGN_SIZE); + PROVIDE (__data_start = .); .openbsd.randomdata : { *(.openbsd.randomdata) @@ -52,8 +53,7 @@ SECTIONS { *(.sdata .sdata.*) } :data - PROVIDE (edata = .); - _edata = .; + PROVIDE (_edata = .); PROVIDE (__bss_start = .); .sbss : @@ -74,6 +74,6 @@ SECTIONS .bss section disappears because there are no input sections. */ . = ALIGN(64 / 8); } :data + PROVIDE (_end = .); PROVIDE (end = .); - _end = .; } |