linux/arch/arm64
Fangrui Song 0fddb79bf2 arm64: lds: move .got section out of .text
Currently, the .got section is placed within the output section .text.
However, when .got is non-empty, the SHF_WRITE flag is set for .text
when linked by lld. GNU ld recognizes .text as a special section and
ignores the SHF_WRITE flag. By renaming .text, we can also get the
SHF_WRITE flag.

The kernel has performed R_AARCH64_RELATIVE resolving very early, and can
then assume that .got is read-only. Let's move .got to the vmlinux_rodata
pseudo-segment.

As Ard Biesheuvel notes:

"This matters to consumers of the vmlinux ELF representation of the
kernel image, such as syzkaller, which disregards writable PT_LOAD
segments when resolving code symbols. The kernel itself does not care
about this distinction, but given that the GOT contains data and not
code, it does not require executable permissions, and therefore does
not belong in .text to begin with."

Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Fangrui Song <maskray@google.com>
Link: https://lore.kernel.org/r/20230502074105.1541926-1-maskray@google.com
Signed-off-by: Will Deacon <will@kernel.org>
2023-05-02 13:12:45 +01:00
..
boot We have one small patch to the clk core this time around. It fixes a corner 2023-02-25 15:16:23 -08:00
configs ARM: SoC fixes for 6.3, part 1 2023-02-27 10:09:40 -08:00
crypto crypto: arm64/sm4-gcm - Fix possible crash in GCM cryption 2023-02-10 17:20:19 +08:00
hyperv hyperv: simplify and rename generate_guest_id 2022-09-28 13:36:56 +00:00
include Merge branch 'for-next/sysreg' into for-next/core 2023-04-20 18:03:07 +01:00
kernel arm64: lds: move .got section out of .text 2023-05-02 13:12:45 +01:00
kvm KVM: arm64: Ensure CPU PMU probes before pKVM host de-privilege 2023-04-20 16:57:53 +01:00
lib arm: uaccess: Remove memcpy_page_flushcache() 2023-03-27 16:26:19 +01:00
mm arm64: kernel: remove SHF_WRITE|SHF_EXECINSTR from .idmap.text 2023-05-02 12:42:22 +01:00
net bpf: Remove prog->active check for bpf_lsm and bpf_iter 2022-10-25 23:11:46 -07:00
tools arm64/sysreg: Convert HFGITR_EL2 to automatic generation 2023-04-17 13:01:10 +01:00
xen
Kbuild
Kconfig Merge branch 'for-next/stacktrace' into for-next/core 2023-04-20 18:03:02 +01:00
Kconfig.debug
Kconfig.platforms arm64 updates for 6.3: 2023-02-21 15:27:48 -08:00
Makefile arm64 updates for 6.3: 2023-02-21 15:27:48 -08:00