syzbot


UBSAN: shift-out-of-bounds in sg_build_indirect

Status: upstream: reported C repro on 2025/02/14 19:58
Subsystems: scsi
[Documentation on labels]
Reported-by: syzbot+270f1c719ee7baab9941@syzkaller.appspotmail.com
First crash: 6d19h, last: 6d13h
Discussions (2)
Title Replies (including bot) Last reply
[PATCH] scsi: sg: prevent the use of size 0 to obtain the page order of sg 1 (1) 2025/02/16 03:35
[syzbot] [scsi?] UBSAN: shift-out-of-bounds in sg_build_indirect 0 (1) 2025/02/14 19:58

Sample crash report:
------------[ cut here ]------------
UBSAN: shift-out-of-bounds in drivers/scsi/sg.c:1897:13
shift exponent 64 is too large for 32-bit type 'int'
CPU: 1 UID: 0 PID: 5832 Comm: syz-executor361 Not tainted 6.14.0-rc2-syzkaller-00185-g128c8f96eb86 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x16c/0x1f0 lib/dump_stack.c:120
 ubsan_epilogue lib/ubsan.c:231 [inline]
 __ubsan_handle_shift_out_of_bounds+0x24f/0x3f0 lib/ubsan.c:468
 sg_build_indirect.cold+0x1b/0x20 drivers/scsi/sg.c:1897
 sg_build_reserve+0xc4/0x180 drivers/scsi/sg.c:2007
 sg_add_sfp drivers/scsi/sg.c:2189 [inline]
 sg_open+0xc37/0x1910 drivers/scsi/sg.c:348
 chrdev_open+0x237/0x6a0 fs/char_dev.c:414
 do_dentry_open+0x735/0x1c40 fs/open.c:956
 vfs_open+0x82/0x3f0 fs/open.c:1086
 do_open fs/namei.c:3830 [inline]
 path_openat+0x1e88/0x2d80 fs/namei.c:3989
 do_filp_open+0x20c/0x470 fs/namei.c:4016
 do_sys_openat2+0x17a/0x1e0 fs/open.c:1428
 do_sys_open fs/open.c:1443 [inline]
 __do_sys_openat fs/open.c:1459 [inline]
 __se_sys_openat fs/open.c:1454 [inline]
 __x64_sys_openat+0x175/0x210 fs/open.c:1454
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f1dc41ca3e9
Code: 48 83 c4 28 c3 e8 37 17 00 00 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffeaa93f3d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007ffeaa93f5a8 RCX: 00007f1dc41ca3e9
RDX: 000000000008a002 RSI: 00004000000000c0 RDI: ffffffffffffff9c
RBP: 00007f1dc423d610 R08: 00007ffeaa93f5a8 R09: 00007ffeaa93f5a8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffeaa93f598 R14: 0000000000000001 R15: 0000000000000001
 </TASK>
---[ end trace ]---

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/02/14 15:00 upstream 128c8f96eb86 fe17639f .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto UBSAN: shift-out-of-bounds in sg_build_indirect
2025/02/14 09:02 upstream ab68d7eb7b1a d9a046cf .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto UBSAN: shift-out-of-bounds in sg_build_indirect
* Struck through repros no longer work on HEAD.