Re: [syzbot] [block?] UBSAN: shift-out-of-bounds in null_process_zoned_cmd

syzbot <[email protected]>
Newsgroups org.kernel.vger.linux-block,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
syzbot has found a reproducer for the following issue on:

HEAD commit:    3d6d817622b0 Merge tag 'scsi-fixes' of git://git.kernel.or..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1767f479580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=c44651ea7dd2f307
dashboard link: https://syzkaller.appspot.com/bug?extid=abd6a8dca0f2b7726060
compiler:       gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=16038ac6580000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

------------[ cut here ]------------
UBSAN: shift-out-of-bounds in drivers/block/null_blk/zoned.c:21:14
shift exponent -1 is negative
CPU: 0 UID: 0 PID: 6032 Comm: syz-executor192 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120
 ubsan_epilogue+0xa/0x30 lib/ubsan.c:233
 __ubsan_handle_shift_out_of_bounds+0x279/0x2a0 lib/ubsan.c:494
 null_zone_no drivers/block/null_blk/zoned.c:21 [inline]
 null_process_zoned_cmd.cold+0x17/0x38 drivers/block/null_blk/zoned.c:728
 null_handle_cmd drivers/block/null_blk/main.c:1455 [inline]
 null_queue_rq+0x664/0xfb0 drivers/block/null_blk/main.c:1703
 __blk_mq_issue_directly+0xe2/0x200 block/blk-mq.c:2694
 blk_mq_try_issue_directly+0x21b/0x420 block/blk-mq.c:2754
 blk_mq_submit_bio+0x21ec/0x3000 block/blk-mq.c:3208
 __submit_bio+0x90/0x3d0 block/blk-core.c:673
 __submit_bio_noacct_mq block/blk-core.c:756 [inline]
 submit_bio_noacct_nocheck+0x549/0xc00 block/blk-core.c:790
 submit_bio_noacct+0xd18/0x1ff0 block/blk-core.c:921
 blk_crypto_submit_bio include/linux/blk-crypto.h:203 [inline]
 __bh_submit+0x721/0x950 fs/buffer.c:1225
 bh_submit fs/buffer.c:1239 [inline]
 block_read_full_folio+0x496/0x8c0 fs/buffer.c:2463
 filemap_read_folio+0xfc/0x3b0 mm/filemap.c:2516
 do_read_cache_folio+0x2d7/0x6b0 mm/filemap.c:4146
 read_mapping_folio include/linux/pagemap.h:1015 [inline]
 read_part_sector+0xd1/0x370 block/partitions/core.c:724
 adfspart_check_ICS+0x91/0x7d0 block/partitions/acorn.c:357
 check_partition block/partitions/core.c:143 [inline]
 blk_add_partitions block/partitions/core.c:591 [inline]
 bdev_disk_changed+0x7b1/0x1260 block/partitions/core.c:695
 blkdev_get_whole+0x187/0x290 block/bdev.c:751
 bdev_open+0x2c7/0xe40 block/bdev.c:960
 bdev_file_open_by_dev block/bdev.c:1062 [inline]
 bdev_file_open_by_dev+0x179/0x210 block/bdev.c:1037
 disk_scan_partitions+0x1ef/0x320 block/genhd.c:387
 add_disk_final block/genhd.c:412 [inline]
 add_disk_fwnode+0x3f4/0x480 block/genhd.c:606
 add_disk include/linux/blkdev.h:800 [inline]
 null_add_dev+0x129d/0x1df0 drivers/block/null_blk/main.c:2052
 nullb_device_power_store+0x29d/0x350 drivers/block/null_blk/main.c:501
 flush_write_buffer fs/configfs/file.c:207 [inline]
 configfs_write_iter+0x302/0x4e0 fs/configfs/file.c:229
 new_sync_write fs/read_write.c:595 [inline]
 vfs_write+0x6ac/0x1050 fs/read_write.c:687
 ksys_write+0x12a/0x250 fs/read_write.c:739
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc39344769e
Code: 08 0f 85 f5 e2 ff ff 49 89 fb 48 89 f0 48 89 d7 48 89 ce 4c 89 c2 4d 89 ca 4c 8b 44 24 08 4c 8b 4c 24 10 4c 89 5c 24 08 0f 05 <c3> 90 41 57 41 56 4d 89 c6 41 55 4d 89 cd 41 54 55 53 48 83 ec 08
RSP: 002b:00007fc3933ea128 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007fc3933ea6c0 RCX: 00007fc39344769e
RDX: 0000000000000002 RSI: 00007fc39348c03a RDI: 0000000000000003
RBP: 0000000000000021 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: ffffffffffffffd0
R13: 0000000000000011 R14: 00007ffcdf31cc10 R15: 00007ffcdf31ccf8
 </TASK>
---[ end trace ]---


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.