Skip to content

Commit d2a91ce

Browse files
chleroympe
authored andcommitted
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: 2edb16e ("powerpc/32: Add KASAN support") Cc: [email protected] Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/c24163ee5d5f8cdf52fefa45055ceb35435b8f15.1589866984.git.christophe.leroy@csgroup.eu
1 parent 3a66a24 commit d2a91ce

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

arch/powerpc/include/asm/kasan.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@
2727

2828
#ifdef CONFIG_KASAN
2929
void kasan_early_init(void);
30-
void kasan_mmu_init(void);
3130
void kasan_init(void);
3231
void kasan_late_init(void);
3332
#else
3433
static inline void kasan_init(void) { }
35-
static inline void kasan_mmu_init(void) { }
3634
static inline void kasan_late_init(void) { }
3735
#endif
3836

arch/powerpc/mm/init_32.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ void __init MMU_init(void)
170170
btext_unmap();
171171
#endif
172172

173-
kasan_mmu_init();
174-
175173
setup_kup();
176174

177175
/* Shortly after that, the entire linear mapping will be available */

arch/powerpc/mm/kasan/kasan_init_32.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static void __init kasan_unmap_early_shadow_vmalloc(void)
131131
flush_tlb_kernel_range(k_start, k_end);
132132
}
133133

134-
void __init kasan_mmu_init(void)
134+
static void __init kasan_mmu_init(void)
135135
{
136136
int ret;
137137
struct memblock_region *reg;
@@ -159,6 +159,8 @@ void __init kasan_mmu_init(void)
159159

160160
void __init kasan_init(void)
161161
{
162+
kasan_mmu_init();
163+
162164
kasan_remap_early_shadow_ro();
163165

164166
clear_page(kasan_early_shadow_page);

0 commit comments

Comments
 (0)