Subject: [Bug 216190] 5.19-rc4 kernel + KASAN fails to boot at very early stage when CONFIG_SMP=y is selected (PowerMac G4 3,6)

From: [email-masked]
Date: Thu, 30 Jun 2022 18:38:04 +0000

https://bugzilla.kernel.org/show_bug.cgi?id=216190

--- Comment #2 from Christophe Leroy ([email-masked]) ---
Problem is likely due to commit 4291d085b0b0 ("powerpc/32s: Make pte_update()
non atomic on 603 core")

kasan_early_init() calls __set_pte_at(), which calls pte_update() if
CONFIG_SMP, and pte_update() calls mmu_has_feature() since above commit, but
that's too early for calling mmu_has_feature() so mmu_has_feature() tries to
warn using printk(), but that cannot work because the KASAN shadow is not set.

Can you try with the change below ?

diff --git a/arch/powerpc/mm/kasan/init_32.c b/arch/powerpc/mm/kasan/init_32.c
index f3e4d069e0ba..a70828a6d935 100644
--- a/arch/powerpc/mm/kasan/init_32.c
+++ b/arch/powerpc/mm/kasan/init_32.c
@@ -25,7 +25,7 @@ static void __init kasan_populate_pte(pte_t *ptep, pgprot_t
prot)
        int i;

        for (i = 0; i < PTRS_PER_PTE; i++, ptep++)
-               __set_pte_at(&init_mm, va, ptep, pfn_pte(PHYS_PFN(pa), prot),
0);
+               __set_pte_at(&init_mm, va, ptep, pfn_pte(PHYS_PFN(pa), prot),
1);
 }

 int __init kasan_init_shadow_page_tables(unsigned long k_start, unsigned long
k_end)

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.