Bug 215169

Summary: UBSAN: shift-out-of-bounds in arch/powerpc/mm/kasan/book3s_32.c:22:23
Product: Platform Specific/Hardware Reporter: Erhard F. (erhard_f)
Component: PPC-32Assignee: platform_ppc-32
Status: RESOLVED CODE_FIX    
Severity: normal    
Priority: P1    
Hardware: PPC-32   
OS: Linux   
Kernel Version: 5.15.5 Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg (5.15.5, INLINE KASAN, PowerMac G4 DP)
kernel .config (5.15.5, PowerMac G4 DP)

Description Erhard F. 2021-11-29 20:06:48 UTC
Created attachment 299777 [details]
dmesg (5.15.5, INLINE KASAN, PowerMac G4 DP)

Noticed another small glitch during 5.15.x testing. Happens when inline KASAN is selected:

Total memory = 2048MB; using 4096kB for hash table
Activating Kernel Userspace Access Protection
Linux version 5.15.5-gentoo-PowerMacG4 (root@T1000) (gcc (Gentoo 11.2.0 p1) 11.2.0, GNU ld (Gentoo 2.37_p1 p0) 2.37) #9 SMP Mon Nov 29 20:46:44 CET 2021
================================================================================
UBSAN: shift-out-of-bounds in arch/powerpc/mm/kasan/book3s_32.c:22:23
shift exponent -1 is negative
CPU: 0 PID: 0 Comm: swapper Not tainted 5.15.5-gentoo-PowerMacG4 #9
Call Trace:
[c214be60] [c0ba0048] dump_stack_lvl+0x80/0xb0 (unreliable)
[c214be80] [c0b99288] ubsan_epilogue+0x10/0x5c
[c214be90] [c0b98fe0] __ubsan_handle_shift_out_of_bounds+0x94/0x138
[c214bf00] [c1c0f010] kasan_init_region+0xd8/0x26c
[c214bf30] [c1c0ed84] kasan_init+0xc0/0x198
[c214bf70] [c1c08024] setup_arch+0x18/0x54c
[c214bfc0] [c1c037f0] start_kernel+0x90/0x33c
[c214bff0] [00003610] 0x3610
================================================================================
setbat: no BAT available for mapping 0x1c000000
KASAN init done
[...]

The other UBSAN complaint in the netconsole.log is bug #214867.
Comment 1 Erhard F. 2021-11-29 20:09:39 UTC
Created attachment 299779 [details]
kernel .config (5.15.5, PowerMac G4 DP)
Comment 2 Erhard F. 2022-02-04 14:57:14 UTC
Fix landed in 5.16.3 and LTS-kernels. Thanks!