linux/arch/s390/boot
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: compile relocatable kernel without -fPIE 2024-02-20 14:37:33 +01:00
als.c s390/facilities: move stfl information from lowcore to global data 2021-06-07 17:06:58 +02:00
alternative.c s390/alternatives: Allow early alternative patching in decompressor 2024-07-23 16:02:31 +02:00
boot.h s390: Add infrastructure to patch lowcore accesses 2024-07-23 16:02:32 +02:00
clz_ctz.c s390/boot: get rid of startup archive 2022-05-06 20:45:14 +02:00
cmdline.c s390: move ipl block and cmd line handling to early boot phase 2018-10-09 11:21:14 +02:00
ctype.c s390: move ipl block and cmd line handling to early boot phase 2018-10-09 11:21:14 +02:00
decompressor.c s390/boot: Rework deployment of the kernel image 2024-04-17 13:38:02 +02:00
decompressor.h s390/boot: Rework deployment of the kernel image 2024-04-17 13:38:02 +02:00
ebcdic.c s390/decompressor: avoid reusing uncompressed image objects 2018-06-25 10:14:39 +02:00
head_kdump.S s390: consistently use .balign instead of .align 2023-06-28 13:57:09 +02:00
head.S s390: fix various typos 2023-07-03 11:19:42 +02:00
install.sh kbuild: Abort make on install failures 2024-07-20 13:34:54 +09:00
ipl_data.c s390/boot: convert parmarea to C 2022-05-06 20:45:15 +02:00
ipl_parm.c s390/boot: Add cmdline option to relocate lowcore 2024-07-23 16:02:32 +02:00
ipl_report.c s390/boot: Replace S390_lowcore by get_lowcore() 2024-06-18 17:01:33 +02:00
ipl_vmparm.c s390: move ipl block and cmd line handling to early boot phase 2018-10-09 11:21:14 +02:00
kaslr.c s390/mm: Uncouple physical vs virtual address spaces 2024-04-17 13:38:01 +02:00
kmsan.c s390/boot: add the KMSAN runtime stub 2024-07-03 19:30:24 -07:00
machine_kexec_reloc.c s390/kernel: build a relocatable kernel 2019-04-29 10:47:10 +02:00
Makefile s390: Remove protvirt and kvm config guards for uv code 2024-07-23 16:02:33 +02:00
mem.S s390/decompressor: reuse lib/mem.S for mem functions 2018-06-25 10:14:39 +02:00
pgm_check_info.c s390/boot: Replace S390_lowcore by get_lowcore() 2024-06-18 17:01:33 +02:00
physmem_info.c s390/boot: Replace S390_lowcore by get_lowcore() 2024-06-18 17:01:33 +02:00
sclp_early_core.c s390/boot: move sclp early buffer from fixed address in asm to C 2021-07-27 09:39:15 +02:00
startup.c s390/boot: Fix KASLR base offset off by __START_KERNEL bytes 2024-08-22 19:24:13 +02:00
string.c s390/string: add KMSAN support 2024-07-03 19:30:25 -07:00
uv.c s390: Remove protvirt and kvm config guards for uv code 2024-07-23 16:02:33 +02:00
uv.h s390: Remove protvirt and kvm config guards for uv code 2024-07-23 16:02:33 +02:00
version.c kbuild: build init/built-in.a just once 2022-09-29 04:40:15 +09:00
vmem.c s390/boot: Fix KASLR base offset off by __START_KERNEL bytes 2024-08-22 19:24:13 +02:00
vmlinux.lds.S s390/boot: Fix KASLR base offset off by __START_KERNEL bytes 2024-08-22 19:24:13 +02:00