FAILED: patch "[PATCH] powerpc/kasan: Fix shadow pages allocation failure" failed to apply to 5.4-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 41ea93cf7ba4e0f0cc46ebfdda8b6ff27c67bc91 Mon Sep 17 00:00:00 2001
From: Christophe Leroy <[email protected]>
Date: Thu, 2 Jul 2020 11:52:03 +0000
Subject: [PATCH] powerpc/kasan: Fix shadow pages allocation failure
Doing kasan pages allocation in MMU_init is too early, kernel doesn't have access yet to the entire memory space and memblock_alloc() fails when the kernel is a bit big.
Do it from kasan_init() instead.
Fixes 2edb16efc899 ("powerpc/32: Add KASAN support")
Fixes d2a91cef9bbd ("powerpc/kasan: Fix shadow pages allocation failure")
Reported-by Erhard F. <[email protected]>
Signed-off-by Christophe Leroy <[email protected]>
Signed-off-by Michael Ellerman <[email protected]>
arch/powerpc/mm/kasan/kasan_init_32.c +13 -12
@@ -120,11 +120,24 @@ static void __init kasan_unmap_early_shadow_vmalloc(void)void __init kasan_mmu_init (void ) {int ret; + +if (early_mmu_has_feature (MMU_FTR_HPTE_TABLE ) || +IS_ENABLED (CONFIG_KASAN_VMALLOC )) { + ret =kasan_init_shadow_page_tables (KASAN_SHADOW_START ,KASAN_SHADOW_END ); + +if (ret) +panic ("kasan: kasan_init_shadow_page_tables() failed" ); + } +} + +void __init kasan_init (void ) +{struct memblock_region *reg;for_each_memblock (memory, reg) {phys_addr_t base = reg->base;phys_addr_t top =min (base + reg->size, total_lowmem); +int ret;if (base >= top)continue ;
@@ -134,18 +147,6 @@ void __init kasan_mmu_init(void)panic ("kasan: kasan_init_region() failed" ); } -if (early_mmu_has_feature (MMU_FTR_HPTE_TABLE ) || -IS_ENABLED (CONFIG_KASAN_VMALLOC )) { - ret =kasan_init_shadow_page_tables (KASAN_SHADOW_START ,KASAN_SHADOW_END ); - -if (ret) -panic ("kasan: kasan_init_shadow_page_tables() failed" ); - } - -} - -void __init kasan_init (void ) -{kasan_remap_early_shadow_ro ();clear_page (kasan_early_shadow_page);