linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [Bug 216190] New: 5.19-rc4 kernel + KASAN fails to boot at very early stage when CONFIG_SMP=y is selected (PowerMac G4 3,6)
@ 2022-06-29 20:04 bugzilla-daemon
  2022-06-29 20:05 ` [Bug 216190] " bugzilla-daemon
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: bugzilla-daemon @ 2022-06-29 20:04 UTC (permalink / raw)
  To: linuxppc-dev

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

            Bug ID: 216190
           Summary: 5.19-rc4 kernel + KASAN fails to boot at very early
                    stage when CONFIG_SMP=y is selected (PowerMac G4 3,6)
           Product: Platform Specific/Hardware
           Version: 2.5
    Kernel Version: 5.19-rc4
          Hardware: PPC-32
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: PPC-32
          Assignee: platform_ppc-32@kernel-bugs.osdl.org
          Reporter: erhard_f@mailbox.org
                CC: christophe.leroy@csgroup.eu
        Regression: No

Created attachment 301307
  --> https://bugzilla.kernel.org/attachment.cgi?id=301307&action=edit
kernel .config (5.19-rc4, outline KASAN, CONFIG_SMP=y, PowerMac G4 DP)

Revisiting bug #215389 and bug #216041 I fiddled around with KASAN builds again
and finally may have found a clue.

Kernel 5.19-rc4 runs fine with outline KASAN as long as '# CONFIG_SMP is not
set'. It runs perfetly well without any advanced options needed, also setting
THREAD_SHIFT manually to 14 is not needed.

As soon as I set CONFIG_SMP=y in the attached .config I get a non-working
kernel. It boots but gets stuck very early on a white screen reading
"done
found display: /pci@f0000000/ATY,AlteracParent@10/ATY,Alterac_B@1, opening..."

Interesting thing is that without SMP I also didn't get memory corruption as in
bug #215389 nor stack overflows as in bug #216041 after hours of building so
far.

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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug 216190] 5.19-rc4 kernel + KASAN fails to boot at very early stage when CONFIG_SMP=y is selected (PowerMac G4 3,6)
  2022-06-29 20:04 [Bug 216190] New: 5.19-rc4 kernel + KASAN fails to boot at very early stage when CONFIG_SMP=y is selected (PowerMac G4 3,6) bugzilla-daemon
@ 2022-06-29 20:05 ` bugzilla-daemon
  2022-06-30 18:38 ` bugzilla-daemon
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: bugzilla-daemon @ 2022-06-29 20:05 UTC (permalink / raw)
  To: linuxppc-dev

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

--- Comment #1 from Erhard F. (erhard_f@mailbox.org) ---
Created attachment 301308
  --> https://bugzilla.kernel.org/attachment.cgi?id=301308&action=edit
dmesg (5.19-rc4, outline KASAN, without SMP, PowerMac G4 DP)

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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug 216190] 5.19-rc4 kernel + KASAN fails to boot at very early stage when CONFIG_SMP=y is selected (PowerMac G4 3,6)
  2022-06-29 20:04 [Bug 216190] New: 5.19-rc4 kernel + KASAN fails to boot at very early stage when CONFIG_SMP=y is selected (PowerMac G4 3,6) bugzilla-daemon
  2022-06-29 20:05 ` [Bug 216190] " bugzilla-daemon
@ 2022-06-30 18:38 ` bugzilla-daemon
  2022-07-03 21:24 ` bugzilla-daemon
  2022-08-19 10:17 ` bugzilla-daemon
  3 siblings, 0 replies; 5+ messages in thread
From: bugzilla-daemon @ 2022-06-30 18:38 UTC (permalink / raw)
  To: linuxppc-dev

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

--- Comment #2 from Christophe Leroy (christophe.leroy@csgroup.eu) ---
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.

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Bug 216190] 5.19-rc4 kernel + KASAN fails to boot at very early stage when CONFIG_SMP=y is selected (PowerMac G4 3,6)
  2022-06-29 20:04 [Bug 216190] New: 5.19-rc4 kernel + KASAN fails to boot at very early stage when CONFIG_SMP=y is selected (PowerMac G4 3,6) bugzilla-daemon
  2022-06-29 20:05 ` [Bug 216190] " bugzilla-daemon
  2022-06-30 18:38 ` bugzilla-daemon
@ 2022-07-03 21:24 ` bugzilla-daemon
  2022-08-19 10:17 ` bugzilla-daemon
  3 siblings, 0 replies; 5+ messages in thread
From: bugzilla-daemon @ 2022-07-03 21:24 UTC (permalink / raw)
  To: linuxppc-dev

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

--- Comment #3 from Erhard F. (erhard_f@mailbox.org) ---
(In reply to Christophe Leroy from comment #2)
> 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 ?
Applied your patch on top of 5.19-rc4 and can confirm it works. Thanks!

I'll close here as soon it is in the -rcs.

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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug 216190] 5.19-rc4 kernel + KASAN fails to boot at very early stage when CONFIG_SMP=y is selected (PowerMac G4 3,6)
  2022-06-29 20:04 [Bug 216190] New: 5.19-rc4 kernel + KASAN fails to boot at very early stage when CONFIG_SMP=y is selected (PowerMac G4 3,6) bugzilla-daemon
                   ` (2 preceding siblings ...)
  2022-07-03 21:24 ` bugzilla-daemon
@ 2022-08-19 10:17 ` bugzilla-daemon
  3 siblings, 0 replies; 5+ messages in thread
From: bugzilla-daemon @ 2022-08-19 10:17 UTC (permalink / raw)
  To: linuxppc-dev

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

Erhard F. (erhard_f@mailbox.org) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |CODE_FIX

--- Comment #4 from Erhard F. (erhard_f@mailbox.org) ---
Patch landed in stable (v5.19.2) meanwhile.

Closing here.

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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-19 10:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29 20:04 [Bug 216190] New: 5.19-rc4 kernel + KASAN fails to boot at very early stage when CONFIG_SMP=y is selected (PowerMac G4 3,6) bugzilla-daemon
2022-06-29 20:05 ` [Bug 216190] " bugzilla-daemon
2022-06-30 18:38 ` bugzilla-daemon
2022-07-03 21:24 ` bugzilla-daemon
2022-08-19 10:17 ` bugzilla-daemon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).