Skip to content

Commit 639420e

Browse files
committed
LoongArch: Fix earlycon parameter if KASAN enabled
The earlycon parameter is based on fixmap, and fixmap addresses are not supposed to be shadowed by KASAN. So return the kasan_early_shadow_page in kasan_mem_to_shadow() if the input address is above FIXADDR_START. Otherwise earlycon cannot work after kasan_init(). Cc: [email protected] Fixes: 5aa4ac6 ("LoongArch: Add KASAN (Kernel Address Sanitizer) support") Signed-off-by: Huacai Chen <[email protected]>
1 parent 4551b30 commit 639420e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/loongarch/mm/kasan_init.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ void *kasan_mem_to_shadow(const void *addr)
4444
unsigned long xrange = (maddr >> XRANGE_SHIFT) & 0xffff;
4545
unsigned long offset = 0;
4646

47+
if (maddr >= FIXADDR_START)
48+
return (void *)(kasan_early_shadow_page);
49+
4750
maddr &= XRANGE_SHADOW_MASK;
4851
switch (xrange) {
4952
case XKPRANGE_CC_SEG:

0 commit comments

Comments
 (0)