diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c index 638a6cf8a075b037d9897caa57c068717228749a..64bd7ac3e35d1beda4fa067b10e6f0828990bde1 100644 --- a/arch/s390/boot/startup.c +++ b/arch/s390/boot/startup.c @@ -278,7 +278,7 @@ void startup_kernel(void) { unsigned long max_physmem_end; unsigned long vmlinux_lma = 0; - unsigned long amode31_lma; + unsigned long amode31_lma = 0; unsigned long asce_limit; unsigned long safe_addr; void *img; @@ -338,7 +338,9 @@ void startup_kernel(void) /* vmlinux decompression is done, shrink reserved low memory */ physmem_reserve(RR_DECOMPRESSOR, 0, (unsigned long)_decompressor_end); - amode31_lma = vmlinux.default_lma - vmlinux.amode31_size; + if (kaslr_enabled()) + amode31_lma = randomize_within_range(vmlinux.amode31_size, PAGE_SIZE, 0, SZ_2G); + amode31_lma = amode31_lma ?: vmlinux.default_lma - vmlinux.amode31_size; physmem_reserve(RR_AMODE31, amode31_lma, vmlinux.amode31_size); /*