From: Alexander Gordeev Date: Wed, 21 Feb 2024 12:25:06 +0000 (+0100) Subject: s390/boot: sanitize kaslr_adjust_relocs() function prototype X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=8495fd4dfee89b9b07353e8d01f0569c0330ff12;p=linux.git 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 Acked-by: Heiko Carstens Signed-off-by: Alexander Gordeev Signed-off-by: Heiko Carstens --- diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c index c1a758921b7a1..09490ddd6973d 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);