UBSAN: shift-out-of-bounds in raid5_run

Status: upstream: reported C repro on 2026/08/06 10:21
Reported-by: syzbot+cca5421b805a2520c3f8@syzkaller.appspotmail.com
First crash: 11d, last: 10d

Sample crash report:
md/raid:md0: device ram0 operational as raid disk 0
md/raid:md0: raid level 5 active with 1 out of 1 devices, algorithm 0
================================================================================
UBSAN: shift-out-of-bounds in ./include/linux/log2.h:57:13
shift exponent 64 is too large for 64-bit type 'unsigned long'
CPU: 1 PID: 4542 Comm: syz.0.19 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/02/2026
Call trace:
 dump_backtrace+0x1c4/0x1f0 arch/arm64/kernel/stacktrace.c:158
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
 __dump_stack+0x30/0x40 lib/dump_stack.c:88
 dump_stack_lvl+0xf4/0x15c lib/dump_stack.c:106
 dump_stack+0x1c/0x5c lib/dump_stack.c:113
 ubsan_epilogue+0x14/0x48 lib/ubsan.c:151
 __ubsan_handle_shift_out_of_bounds+0x2b0/0x348 lib/ubsan.c:321
 __roundup_pow_of_two include/linux/log2.h:57 [inline]
 raid5_run+0x22dc/0x24c4 drivers/md/raid5.c:8068
 md_run+0xe14/0x1de0 drivers/md/md.c:6020
 do_md_run+0x4c/0x4a4 drivers/md/md.c:6152
 array_state_store+0x5e8/0x944 drivers/md/md.c:-1
 md_attr_store+0x168/0x234 drivers/md/md.c:5626
 sysfs_kf_write+0x1f8/0x274 fs/sysfs/file.c:140
 kernfs_fop_write_iter+0x390/0x4b4 fs/kernfs/file.c:352
 call_write_iter include/linux/fs.h:2265 [inline]
 new_sync_write fs/read_write.c:491 [inline]
 vfs_write+0x3c8/0x7c8 fs/read_write.c:584
 ksys_write+0x12c/0x228 fs/read_write.c:637
 __do_sys_write fs/read_write.c:649 [inline]
 __se_sys_write fs/read_write.c:646 [inline]
 __arm64_sys_write+0x7c/0x90 fs/read_write.c:646
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x290 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x13c/0x258 arch/arm64/kernel/syscall.c:140
 do_el0_svc+0x5c/0x134 arch/arm64/kernel/syscall.c:204
 el0_svc+0x58/0x128 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585
================================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/08/06 13:08 linux-6.1.y fb28aa725e05 cd5b1963 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 UBSAN: shift-out-of-bounds in raid5_run
2026/08/06 10:22 linux-6.1.y fb28aa725e05 cd5b1963 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 UBSAN: shift-out-of-bounds in raid5_run
2026/08/06 10:20 linux-6.1.y fb28aa725e05 cd5b1963 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 UBSAN: shift-out-of-bounds in raid5_run
* Struck through repros no longer work on HEAD.