Subject: BUG: Unable to handle kernel data access at 0x6020094ad020303c when CONFIG_DEBUG_KMEMLEAK=y is set (kernel 6.5-rc6)

From: Erhard Furtner <[email-masked]>
Date: Sun, 20 Aug 2023 12:36:17 +0200

On checking on kernel bugzilla #216156 (https://bugzilla.kernel.org/show_bug.cgi?id=216156) I found out that in addition to bug #216156 kernel 6.5-rc6 always crashes at boot when CONFIG_DEBUG_KMEMLEAK=y is enabled.

When DEBUG_KMEMLEAK is not enabled I don't get this crash on the machine.

[...]
BUG: Unable to handle kernel data access at 0x6020094ad020303c
Faulting instruction address: 0xc00000000048dfa0
Oops: Kernel access of bad area, sig: 11 [#1]
BE PAGE_SIZE=4K MMU=Hash SMP NR_CPUS=2 PowerMac
Modules linked in: joydev mac_hid windfarm_cpufreq_clamp windfarm_smu_sensors windfarm_smu_controls windfarm_pm112 snd_aoa_codec_onyx snd_aoa_fabric_layout snd_aoa windfarm_pid nouveau i2c_algo_bit firewire_ohci drm_ttm_helper windfarm_smu_sat windfarm_lm75_sensor windfarm_max6690_sensor windfarm_core snd_aoa_i2sbus firewire_core ttm snd_aoa_soundbus crc_itu_t snd_pcm snd_timer drm_display_helper backlight tg3 snd ohci_pci soundcore hwmon drm_kms_helper rack_meter cfg80211 rfkill zram zsmalloc loop dm_mod configfs
CPU: 1 PID: 68 Comm: kmemleak Tainted: G                T  6.5.0-rc6-PMacG5-dirty #1
Hardware name: PowerMac11,2 PPC970MP 0x440101 PowerMac
NIP:  c00000000048dfa0 LR: c00000000048dfc4 CTR: c00000000001f740
REGS: c00000000777bba0 TRAP: 0380   Tainted: G                T   (6.5.0-rc6-PMacG5-dirty)
MSR:  9000000000009032 <SF,HV,EE,ME,IR,DR,RI>  CR: 44000884  XER: 20000000
IRQMASK: 0 
GPR00: 0000000000000000 c00000000777be40 c00000000140e600 c0000004500000c0 
GPR04: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 
GPR08: 0000000000000001 6020094ad0203008 6020094ad0203009 0000000000000000 
GPR12: 0000000000000000 c00000000ffff700 c00000000011f6b8 c000000008dccb80 
GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 
GPR20: 0000000000000000 c000000002432ac8 c0000000020bf000 c0000000020d36e0 
GPR24: c000000002f24670 c0000000023dd000 c000000003326dc0 c000000002353508 
GPR28: c000000002325e10 c0000000023535c0 00000000003ffffd 0000000000080003 
NIP [c00000000048dfa0] kmemleak_scan+0x3a0/0xcd0
LR [c00000000048dfc4] kmemleak_scan+0x3c4/0xcd0
Call Trace:
[c00000000777be40] [c00000000048dfc4] kmemleak_scan+0x3c4/0xcd0 (unreliable)
[c00000000777bf10] [c00000000048f214] kmemleak_scan_thread+0xec/0x148
[c00000000777bf90] [c00000000011f7f8] kthread+0x148/0x150
[c00000000777bfe0] [c00000000000bfb0] start_kernel_thread+0x14/0x18
Code: 7d2a482a 3d4200fd 394aea00 79290fe0 1d290600 7d295214 7c394800 4082ffb4 e9430008 7c691b78 71480001 40820460 <81290034> 2c090000 4182ff98 38a00000 
---[ end trace 0000000000000000 ]---

Kernel panic - not syncing: Fatal exception
Rebooting in 40 seconds..

Some data on the machine:
 # inxi -bz
System:
  Kernel: 6.5.0-rc6-PMacG5-dirty arch: ppc64 bits: 64 Console: pty pts/0
    Distro: Gentoo Base System release 2.13
Machine:
  Type: PPC System: PowerMac11 2 details: N/A mobo: PowerMac11,2 MacRISC4
    Power Macintosh serial: <filter>
CPU:
  Info: dual core PPC970MP altivec supported [MCP] speed (MHz): avg: 1150
    min/max: 1150/2300
Graphics:
  Device-1: NVIDIA NV43 [GeForce 6600 LE] driver: nouveau v: kernel
  Device-2: AMD RV516 [Radeon X1300/X1550 Series] driver: N/A
  Display: x11 server: X.org v: 1.21.1.8 driver: X: loaded: nouveau
    unloaded: fbdev,modesetting dri: nouveau gpu: nouveau
    resolution: <missing: xdpyinfo/xrandr> resolution: 3840x2160
  API: OpenGL v: 4.5 Mesa 23.1.5 renderer: llvmpipe (LLVM 16.0.6 128 bits)
Network:
  Device-1: Broadcom NetXtreme BCM5780 Gigabit Ethernet driver: tg3
  Device-2: Broadcom NetXtreme BCM5780 Gigabit Ethernet driver: tg3
  Device-3: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    driver: r8169

Kernel dmesg + .config attached.

Regards,
Erhard