summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAlexander Gordeev <agordeev@linux.ibm.com>2024-02-21 13:25:06 +0100
committerHeiko Carstens <hca@linux.ibm.com>2024-02-26 10:25:09 +0100
commit8495fd4dfee89b9b07353e8d01f0569c0330ff12 (patch)
tree5a4831f6444ad45a5a0b98b057ddde871c8692c8 /arch
parent3334fda639cfa7bb27a457f85f4ce06d622e0511 (diff)
downloadlinux-stable-8495fd4dfee89b9b07353e8d01f0569c0330ff12.tar.gz
linux-stable-8495fd4dfee89b9b07353e8d01f0569c0330ff12.tar.bz2
linux-stable-8495fd4dfee89b9b07353e8d01f0569c0330ff12.zip
s390/boot: sanitize kaslr_adjust_relocs() function prototype
Do not use vmlinux.image_size within kaslr_adjust_relocs() function to calculate the upper relocation table boundary. Instead, make both lower and upper boundaries the function input parameters. Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com> Acked-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/boot/startup.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c
index c1a758921b7a..09490ddd6973 100644
--- a/arch/s390/boot/startup.c
+++ b/arch/s390/boot/startup.c
@@ -142,7 +142,7 @@ static void copy_bootdata(void)
}
#ifdef CONFIG_PIE_BUILD
-static void kaslr_adjust_relocs(unsigned long min_addr, unsigned long offset)
+static void kaslr_adjust_relocs(unsigned long min_addr, unsigned long max_addr, unsigned long offset)
{
Elf64_Rela *rela_start, *rela_end, *rela;
int r_type, r_sym, rc;
@@ -196,10 +196,9 @@ static void free_relocs(void)
physmem_free(RR_RELOC);
}
-static void kaslr_adjust_relocs(unsigned long min_addr, unsigned long offset)
+static void kaslr_adjust_relocs(unsigned long min_addr, unsigned long max_addr, unsigned long offset)
{
int *reloc;
- unsigned long max_addr = min_addr + vmlinux.image_size;
long loc;
/* Adjust R_390_64 relocations */
@@ -464,7 +463,7 @@ void startup_kernel(void)
* to bootdata made by setup_vmem()
*/
clear_bss_section(vmlinux_lma);
- kaslr_adjust_relocs(vmlinux_lma, __kaslr_offset);
+ kaslr_adjust_relocs(vmlinux_lma, vmlinux_lma + vmlinux.image_size, __kaslr_offset);
kaslr_adjust_got(__kaslr_offset);
free_relocs();
setup_vmem(asce_limit);