riscv: kasan: use local_tlb_flush_all() to avoid uninitialized __sbi_rfence
authorVincent Chen <vincent.chen@sifive.com>
Fri, 10 Jul 2020 02:40:54 +0000 (10:40 +0800)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Tue, 21 Jul 2020 04:14:51 +0000 (21:14 -0700)
It fails to boot the v5.8-rc4 kernel with CONFIG_KASAN because kasan_init
and kasan_early_init use uninitialized __sbi_rfence as executing the
tlb_flush_all(). Actually, at this moment, only the CPU which is
responsible for the system initialization enables the MMU. Other CPUs are
parking at the .Lsecondary_start. Hence the tlb_flush_all() is able to be
replaced by local_tlb_flush_all() to avoid using uninitialized
__sbi_rfence.

Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/mm/kasan_init.c

index 4a8b618..87b4ab3 100644 (file)
@@ -44,7 +44,7 @@ asmlinkage void __init kasan_early_init(void)
                                (__pa(((uintptr_t) kasan_early_shadow_pmd))),
                                __pgprot(_PAGE_TABLE)));
 
-       flush_tlb_all();
+       local_flush_tlb_all();
 }
 
 static void __init populate(void *start, void *end)
@@ -79,7 +79,7 @@ static void __init populate(void *start, void *end)
                        pfn_pgd(PFN_DOWN(__pa(&pmd[offset])),
                                __pgprot(_PAGE_TABLE)));
 
-       flush_tlb_all();
+       local_flush_tlb_all();
        memset(start, 0, end - start);
 }