WARNING: refcount bug in nbd_config_put

8 views
Skip to first unread message

syzbot

unread,
Mar 31, 2021, 11:27:22 AM3/31/21
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 2034d6f0 Linux 4.19.184
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1651bf7cd00000
kernel config: https://syzkaller.appspot.com/x/.config?x=42af7daace4bc0cc
dashboard link: https://syzkaller.appspot.com/bug?extid=fe82ccae196c926dba29
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17d0145ed00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=100dc726d00000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+fe82cc...@syzkaller.appspotmail.com

------------[ cut here ]------------
refcount_t: underflow; use-after-free.
WARNING: CPU: 0 PID: 8529 at lib/refcount.c:280 refcount_dec_not_one+0x1bc/0x1d0 lib/refcount.c:280
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 8529 Comm: systemd-udevd Not tainted 4.19.184-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
panic+0x26a/0x50e kernel/panic.c:186
__warn.cold+0x20/0x5a kernel/panic.c:541
report_bug+0x262/0x2b0 lib/bug.c:186
fixup_bug arch/x86/kernel/traps.c:178 [inline]
fixup_bug arch/x86/kernel/traps.c:173 [inline]
do_error_trap+0x1d7/0x310 arch/x86/kernel/traps.c:296
invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:1038
RIP: 0010:refcount_dec_not_one+0x1bc/0x1d0 lib/refcount.c:280
Code: 1d 3f df 98 07 31 ff 89 de e8 70 91 ec fd 84 db 75 89 e8 37 90 ec fd 48 c7 c7 40 b8 b3 88 c6 05 1f df 98 07 01 e8 94 7e 7b 04 <0f> 0b 41 bc 01 00 00 00 e9 6a ff ff ff e8 82 d7 c1 fd 66 90 41 54
RSP: 0018:ffff8880909ffbd0 EFLAGS: 00010282
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff814ddd51 RDI: ffffed101213ff6c
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000005 R11: 0000000000000000 R12: 00000000ffffffff
R13: 1ffff1101213ff7b R14: ffff8880909ffbf8 R15: ffff8880b247d0e8
refcount_dec_and_mutex_lock+0x1c/0x80 lib/refcount.c:308
nbd_put drivers/block/nbd.c:228 [inline]
nbd_config_put+0x5bb/0x870 drivers/block/nbd.c:1185
nbd_release+0xf4/0x170 drivers/block/nbd.c:1461
__blkdev_put+0x636/0x870 fs/block_dev.c:1819
blkdev_close+0x86/0xb0 fs/block_dev.c:1888
__fput+0x2ce/0x890 fs/file_table.c:278
task_work_run+0x148/0x1c0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:193 [inline]
exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f6ed00ab270
Code: 73 01 c3 48 8b 0d 38 7d 20 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 83 3d 59 c1 20 00 00 75 10 b8 03 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 ee fb ff ff 48 89 04 24
RSP: 002b:00007fffaa3aae38 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000007 RCX: 00007f6ed00ab270
RDX: 000000000aba9500 RSI: 0000000000000000 RDI: 0000000000000007
RBP: 00007f6ed0f65710 R08: 000055e48babbcd0 R09: 0000000000000018
R10: 000055e48bab9dc8 R11: 0000000000000246 R12: 0000000000000000
R13: 000055e48bab56e0 R14: 0000000000000003 R15: 000000000000000e
Kernel Offset: disabled
Rebooting in 86400 seconds..


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches
Reply all
Reply to author
Forward
0 new messages