linux/arch/s390/tools
Alexander Gordeev 1642285e51 s390/boot: Fix KASLR base offset off by __START_KERNEL bytes
Symbol offsets to the KASLR base do not match symbol address in
the vmlinux image. That is the result of setting the KASLR base
to the beginning of .text section as result of an optimization.

Revert that optimization and allocate virtual memory for the
whole kernel image including __START_KERNEL bytes as per the
linker script. That allows keeping the semantics of the KASLR
base offset in sync with other architectures.

Rename __START_KERNEL to TEXT_OFFSET, since it represents the
offset of the .text section within the kernel image, rather than
a virtual address.

Still skip mapping TEXT_OFFSET bytes to save memory on pgtables
and provoke exceptions in case an attempt to access this area is
made, as no kernel symbol may reside there.

In case CONFIG_KASAN is enabled the location counter might exceed
the value of TEXT_OFFSET, while the decompressor linker script
forcefully resets it to TEXT_OFFSET, which leads to a sections
overlap link failure. Use MAX() expression to avoid that.

Reported-by: Omar Sandoval <osandov@osandov.com>
Closes: https://lore.kernel.org/linux-s390/ZnS8dycxhtXBZVky@telecaster.dhcp.thefacebook.com/
Fixes: 56b1069c40 ("s390/boot: Rework deployment of the kernel image")
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Acked-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2024-08-22 19:24:13 +02:00
..
.gitignore s390: add relocs tool 2024-02-20 14:37:33 +01:00
gcc-thunk-extern.sh s390/nospec: add an option to use thunk-extern 2022-03-10 15:58:17 +01:00
gen_facilities.c s390/als: add vector facility to z13 architecture level set 2023-12-11 14:33:07 +01:00
gen_opcode_table.c s390/tools: fix gcc 8 stringop-truncation warnings 2018-07-02 11:25:05 +02:00
Makefile s390: add relocs tool 2024-02-20 14:37:33 +01:00
opcodes.txt s390/disassembler: update opcode table 2021-12-16 19:58:07 +01:00
relocs.c s390/boot: Fix KASLR base offset off by __START_KERNEL bytes 2024-08-22 19:24:13 +02:00