Re: [syzbot] [block?] general protection fault in bio_first_folio

From: syzbot
Date: Sat Dec 16 2023 - 02:29:15 EST


Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING in bio_first_folio

i: ffffc9000548f810, nr: 8, cn: 32764, bio_map_user_iov
r: -14, b: -14, icn: 32764, bio_map_user_iov
------------[ cut here ]------------
WARNING: CPU: 0 PID: 5485 at include/linux/bio.h:289 bio_first_folio+0x509/0x620 include/linux/bio.h:289
Modules linked in:
CPU: 0 PID: 5485 Comm: syz-executor.0 Not tainted 6.7.0-rc5-next-20231212-syzkaller-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
RIP: 0010:bio_first_folio+0x509/0x620 include/linux/bio.h:289
Code: fc 41 83 e4 01 4c 89 e6 e8 a4 37 43 fd 4d 85 e4 0f 84 52 fc ff ff e8 06 3c 43 fd 4d 8d 6f ff e9 44 fc ff ff e8 f8 3b 43 fd 90 <0f> 0b 90 e9 c6 fb ff ff e8 ea 3b 43 fd 90 0f 0b 90 e9 47 fb ff ff
RSP: 0018:ffffc9000548f448 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffffc9000548f4e8 RCX: ffffffff8444e18d
RDX: ffff88802b971dc0 RSI: ffffffff8444e5c8 RDI: 0000000000000003
RBP: ffff8880216b3088 R08: 0000000000000003 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
R13: ffff8880216b3000 R14: 0000000000000000 R15: ffff8880216b3000
FS: 00007f2666f3e6c0(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f2666f3dc98 CR3: 000000007b2e4000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__bio_release_pages+0x9d/0x4b0 block/bio.c:1150
bio_release_pages include/linux/bio.h:509 [inline]
bio_map_user_iov+0x969/0xaf0 block/blk-map.c:350
blk_rq_map_user_iov+0x6a5/0x1840 block/blk-map.c:666
blk_rq_map_user block/blk-map.c:693 [inline]
blk_rq_map_user_io+0x202/0x230 block/blk-map.c:726
sg_io+0x537/0xd70 drivers/scsi/scsi_ioctl.c:456
scsi_cdrom_send_packet+0x276/0x640 drivers/scsi/scsi_ioctl.c:820
scsi_ioctl+0x146/0x1840 drivers/scsi/scsi_ioctl.c:903
sg_ioctl+0xb7b/0x2760 drivers/scsi/sg.c:1163
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:871 [inline]
__se_sys_ioctl fs/ioctl.c:857 [inline]
__x64_sys_ioctl+0x18f/0x210 fs/ioctl.c:857
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x62/0x6a
RIP: 0033:0x7f266627cba9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f2666f3e0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f266639bf80 RCX: 00007f266627cba9
RDX: 0000000020000000 RSI: 0000000000005393 RDI: 0000000000000004
RBP: 00007f26662c847a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f266639bf80 R15: 00007fff081ca458
</TASK>


Tested on:

commit: abb240f7 Add linux-next specific files for 20231212
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
console output: https://syzkaller.appspot.com/x/log.txt?x=152a8d1ce80000
kernel config: https://syzkaller.appspot.com/x/.config?x=cc2485c21b49ddc4
dashboard link: https://syzkaller.appspot.com/bug?extid=8b23309d5788a79d3eea
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=1175872ae80000