Subject: [REGRESSION] Boot failure with DEBUG_PAGEALLOC on Wii, after PPC32 KASAN patches

From: Jonathan Neuschäfer <[email-masked]>
Date: Tue, 13 Aug 2019 17:51:52 +0200

Hi,

I noticed that my Nintendo Wii doesn't boot with wii_defconfig plus
CONFIG_DEBUG_PAGEALLOC=y and CONFIG_DEBUG_PAGEALLOC_ENABLE_DEFAULT=y
on recent kernels. I get a splash like this one:

[    0.022245] BUG: Unable to handle kernel data access at 0x00006601
[    0.025172] Faulting instruction address: 0xc01afa48
[    0.027522] Oops: Kernel access of bad area, sig: 11 [#1]
[    0.030076] BE PAGE_SIZE=4K MMU=Hash PREEMPT DEBUG_PAGEALLOC wii
[    0.032917] Modules linked in:
[    0.034368] CPU: 0 PID: 0 Comm: swapper Not tainted 5.1.0-rc3-wii-00151-g9a634f40158a #1337
[    0.038318] NIP:  c01afa48 LR: c0195fd0 CTR: 00000000
[    0.040707] REGS: c0c15e78 TRAP: 0300   Not tainted  (5.1.0-rc3-wii-00151-g9a634f40158a)
[    0.044531] MSR:  00009032 <EE,ME,IR,DR,RI>  CR: 84000844  XER: 00000000
[    0.047708] DAR: 00006601 DSISR: 40000000
[    0.047708] GPR00: c0919998 c0c15f30 c0bad460 c0bad434 00000000 00000000 00000000 01010101
[    0.047708] GPR08: 00000002 00000001 00000002 00000110 44000842 7b67efdb b3a9f2fa 7763f327
[    0.047708] GPR16: f5bff97f 797ebc55 3aafa378 e76bacd3 af931fb0 00000000 013de444 00d009b0
[    0.047708] GPR24: c0951504 c0c30000 d3efdcc0 c0951504 c0951500 00000000 c0878fe0 c0878fe0
[    0.065470] NIP [c01afa48] fs_context_for_mount+0x8/0x1c
[    0.067988] LR [c0195fd0] vfs_kern_mount.part.6+0x24/0xb0
[    0.070540] Call Trace:
[    0.071699] [c0c15f40] [c019404c] get_fs_type+0x98/0x14c
[    0.074214] [c0c15f60] [c0919998] mnt_init+0x16c/0x264
[    0.076645] [c0c15f90] [c0919594] vfs_caches_init+0x7c/0x94
[    0.079283] [c0c15fb0] [c0900c34] start_kernel+0x41c/0x480
[    0.081878] [c0c15ff0] [0000346c] 0x346c
[    0.083731] Instruction dump:
[    0.085135] 7d005028 31080001 7d00512d 40a2fff4 2f9a0000 419e000c 387a0054 48195e99
[    0.088805] 935f000c 4bfffef4 9421fff0 7c852378 <80066601> 00725100 38800000 38210010
[    0.092568] ---[ end trace 7373e1c0f977bdb3 ]---
[    0.094750]
[    1.083137] Kernel panic - not syncing: Attempted to kill the idle task!

(Without CONFIG_DEBUG_PAGEALLOC I haven't noticed any problems.)

'git bisect' says:

72f208c6a8f7bc78ef5248babd9e6ed6302bd2a0 is the first bad commit
commit 72f208c6a8f7bc78ef5248babd9e6ed6302bd2a0
Author: Christophe Leroy <[email-masked]>
Date:   Fri Apr 26 16:23:35 2019 +0000

    powerpc/32s: move hash code patching out of MMU_init_hw()

    For KASAN, hash table handling will be activated early for
    accessing to KASAN shadow areas.

    In order to avoid any modification of the hash functions while
    they are still used with the early hash table, the code patching
    is moved out of MMU_init_hw() and put close to the big-bang switch
    to the final hash table.

    Signed-off-by: Christophe Leroy <[email-masked]>
    Signed-off-by: Michael Ellerman <[email-masked]>

I can revert this commit, and then 5.3-rc2 (plus a patchset adding a
serial driver) boot again.

Christophe, is there anything I should test in order to figure out how
to fix this properly?

Thanks,
Jonathan Neuschäfer