From e966ccf836e8964edf984adc4b4af5f3a3e07de6 Mon Sep 17 00:00:00 2001 From: Vasily Gorbik Date: Mon, 23 Jan 2023 15:24:17 +0100 Subject: s390/boot: avoid mapping standby memory Commit bb1520d581a3 ("s390/mm: start kernel with DAT enabled") doesn't consider online memory holes due to potential memory offlining and erroneously creates pgtables for stand-by memory, which bear RW+X attribute and trigger a warning: RANGE SIZE STATE REMOVABLE BLOCK 0x0000000000000000-0x0000000c3fffffff 49G online yes 0-48 0x0000000c40000000-0x0000000c7fffffff 1G offline 49 0x0000000c80000000-0x0000000fffffffff 14G online yes 50-63 0x0000001000000000-0x00000013ffffffff 16G offline 64-79 s390/mm: Found insecure W+X mapping at address 0xc40000000 WARNING: CPU: 14 PID: 1 at arch/s390/mm/dump_pagetables.c:142 note_page+0x2cc/0x2d8 Map only online memory ranges which fit within identity mapping limit. Fixes: bb1520d581a3 ("s390/mm: start kernel with DAT enabled") Reviewed-by: Alexander Gordeev Signed-off-by: Vasily Gorbik Signed-off-by: Heiko Carstens --- arch/s390/boot/startup.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'arch/s390/boot/startup.c') diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c index cb4b743a5e17..c9dfd7e09233 100644 --- a/arch/s390/boot/startup.c +++ b/arch/s390/boot/startup.c @@ -278,7 +278,6 @@ void startup_kernel(void) unsigned long random_lma; unsigned long safe_addr; unsigned long asce_limit; - unsigned long online_end; void *img; psw_t psw; @@ -303,7 +302,6 @@ void startup_kernel(void) setup_ident_map_size(detect_memory()); setup_vmalloc_size(); asce_limit = setup_kernel_memory_layout(); - online_end = min(get_mem_detect_end(), ident_map_size); if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && kaslr_enabled) { random_lma = get_random_base(safe_addr); @@ -335,7 +333,7 @@ void startup_kernel(void) */ clear_bss_section(); handle_relocs(__kaslr_offset); - setup_vmem(online_end, asce_limit); + setup_vmem(ident_map_size, asce_limit); copy_bootdata(); if (__kaslr_offset) { -- cgit v1.2.3