syzbot


WARNING: refcount bug in cdev_get

Status: fixed on 2020/01/19 15:05
Reported-by: syzbot+f41669cbb0aeb785392e@syzkaller.appspotmail.com
Fix commit: f57fd58dda42 bridge/mdb: remove wrong use of NLM_F_MULTI
First crash: 1144d, last: 1019d

Fix bisection: fixed by (bisect log) :
commit f57fd58dda426cdebe36a1dae169b1c87b2ad295
Author: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Fri Sep 6 09:47:02 2019 +0000

  bridge/mdb: remove wrong use of NLM_F_MULTI

similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream WARNING: refcount bug in cdev_get C done 105 1000d 1140d 16/24 fixed on 2020/02/18 14:31
linux-4.14 WARNING: refcount bug in cdev_get C done 21 1014d 1144d 1/1 fixed on 2020/01/24 06:24

Sample crash report:
input: syz1 as /devices/virtual/input/input751
input: syz1 as /devices/virtual/input/input752
input: syz1 as /devices/virtual/input/input753
------------[ cut here ]------------
refcount_t: increment on 0; use-after-free.
WARNING: CPU: 0 PID: 10654 at lib/refcount.c:153 refcount_inc_checked lib/refcount.c:153 [inline]
WARNING: CPU: 0 PID: 10654 at lib/refcount.c:153 refcount_inc_checked+0x61/0x70 lib/refcount.c:151
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 10654 Comm: syz-executor887 Not tainted 4.19.73 #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+0x172/0x1f0 lib/dump_stack.c:113
 panic+0x263/0x507 kernel/panic.c:185
 __warn.cold+0x20/0x4a kernel/panic.c:540
 report_bug+0x263/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+0x204/0x360 arch/x86/kernel/traps.c:296
 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:316
 invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:1037
RIP: 0010:refcount_inc_checked lib/refcount.c:153 [inline]
RIP: 0010:refcount_inc_checked+0x61/0x70 lib/refcount.c:151
Code: 1d 64 2c 13 06 31 ff 89 de e8 8b a2 46 fe 84 db 75 dd e8 42 a1 46 fe 48 c7 c7 20 2b 82 87 c6 05 44 2c 13 06 01 e8 5d 31 1a fe <0f> 0b eb c1 90 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 57 41
RSP: 0018:ffff88808c0578b8 EFLAGS: 00010282
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff8155dbd6 RDI: ffffed101180af09
RBP: ffff88808c0578c8 R08: ffff888079ee6080 R09: ffff888079ee6920
R10: 0000000000000000 R11: 0000000000000000 R12: ffff8880a09257a8
R13: 0000000000000000 R14: ffff8880a58cb340 R15: ffff8880a01dd480
 kref_get include/linux/kref.h:47 [inline]
 kobject_get+0x66/0xc0 lib/kobject.c:613
 cdev_get+0x60/0xb0 fs/char_dev.c:364
 chrdev_open+0xb0/0x6b0 fs/char_dev.c:409
 do_dentry_open+0x4c3/0x1210 fs/open.c:796
 vfs_open+0xa0/0xd0 fs/open.c:905
 do_last fs/namei.c:3418 [inline]
 path_openat+0x10d7/0x45e0 fs/namei.c:3534
 do_filp_open+0x1a1/0x280 fs/namei.c:3564
 do_sys_open+0x3fe/0x550 fs/open.c:1088
 __do_sys_open fs/open.c:1106 [inline]
 __se_sys_open fs/open.c:1101 [inline]
 __x64_sys_open+0x7e/0xc0 fs/open.c:1101
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x409701
Code: 75 14 b8 02 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 a4 18 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 02 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00007f9ace7aa8b0 EFLAGS: 00000293 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 6666666666666667 RCX: 0000000000409701
RDX: 0000000000000000 RSI: 0000000000024440 RDI: 00007f9ace7aa8d0
RBP: 00000000006e0c30 R08: 000000000000000f R09: 00007f9ace7ab700
R10: 00007f9ace7ab9d0 R11: 0000000000000293 R12: 00000000006e0c3c
R13: 00007fff19dcf13f R14: 00007f9ace7ab9c0 R15: 0000000000000003
Kernel Offset: disabled
Rebooting in 86400 seconds..

Crashes (12):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-19 2019/09/17 10:46 linux-4.19.y db2d0b7c1dde 51ca0454 .config log report syz C
ci2-linux-4-19 2019/08/16 21:04 linux-4.19.y a5aa80588fcd 8fd428a1 .config log report syz C
ci2-linux-4-19 2019/09/29 19:47 linux-4.19.y d573e8a79f70 c1ad5441 .config log report syz
ci2-linux-4-19 2019/11/20 09:12 linux-4.19.y c555efaf1402 432c7650 .config log report
ci2-linux-4-19 2019/11/09 20:20 linux-4.19.y 5ee93551c703 1e35461e .config log report
ci2-linux-4-19 2019/11/05 14:26 linux-4.19.y ef244c308885 af5c522d .config log report
ci2-linux-4-19 2019/10/15 21:28 linux-4.19.y dafd634415a7 b5268b89 .config log report
ci2-linux-4-19 2019/10/10 21:18 linux-4.19.y 58fce2064530 1a3bad90 .config log report
ci2-linux-4-19 2019/10/04 21:51 linux-4.19.y 555161ee1b7a c86336cf .config log report
ci2-linux-4-19 2019/09/23 03:35 linux-4.19.y d573e8a79f70 d96e88f3 .config log report
ci2-linux-4-19 2019/09/02 21:15 linux-4.19.y 97ab07e11fbf 14544a56 .config log report
ci2-linux-4-19 2019/09/02 01:50 linux-4.19.y 97ab07e11fbf bad3cce2 .config log report
* Struck through repros no longer work on HEAD.