WARNING: refcount bug in cdev_get

20 views
Skip to first unread message

syzbot

unread,
Aug 16, 2019, 6:04:07 PM8/16/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: a5aa8058 Linux 4.19.67
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10ff69e2600000
kernel config: https://syzkaller.appspot.com/x/.config?x=8e5f93d2c874cdab
dashboard link: https://syzkaller.appspot.com/bug?extid=f41669cbb0aeb785392e
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1750b25a600000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=135803ee600000

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

input: syz1 as /devices/virtual/input/input986
input: syz1 as /devices/virtual/input/input987
input: syz1 as /devices/virtual/input/input988
------------[ cut here ]------------
refcount_t: increment on 0; use-after-free.
WARNING: CPU: 0 PID: 12435 at lib/refcount.c:153 refcount_inc_checked
lib/refcount.c:153 [inline]
WARNING: CPU: 0 PID: 12435 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: 12435 Comm: syz-executor200 Not tainted 4.19.67 #41
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 b1 4a 13 06 31 ff 89 de e8 6b c5 46 fe 84 db 75 dd e8 22 c4 46 fe
48 c7 c7 e0 26 82 87 c6 05 91 4a 13 06 01 e8 4d 46 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:ffff88809461f8b8 EFLAGS: 00010282
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff8155d916 RDI: ffffed10128c3f09
RBP: ffff88809461f8c8 R08: ffff8880a4fe0300 R09: ffffed1015d03ee3
R10: ffffed1015d03ee2 R11: ffff8880ae81f717 R12: ffff8880a9b03b28
R13: 0000000000000000 R14: ffff888095a59340 R15: ffff8880a0623f10
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:0x406311
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:00007f0d54c28960 EFLAGS: 00000293 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000406311
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00007f0d54c28970
RBP: 6666666666666667 R08: 000000000000000f R09: 00007f0d54c29700
R10: 00007f0d54c299d0 R11: 0000000000000293 R12: 00000000006dbc3c
R13: 0000000000000000 R14: 0000000000000000 R15: 00000000317a7973
Kernel Offset: disabled
Rebooting in 86400 seconds..


---
This bug 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 bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Aug 16, 2019, 7:47:07 PM8/16/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 45f092f9 Linux 4.14.139
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10798b02600000
kernel config: https://syzkaller.appspot.com/x/.config?x=56ab4cf14cc8892d
dashboard link: https://syzkaller.appspot.com/bug?extid=8f6326d01bc61afbc095
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=156fddba600000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14405772600000

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

input: syz1 as /devices/virtual/input/input4729
input: syz1 as /devices/virtual/input/input4730
input: syz1 as /devices/virtual/input/input4731
refcount_t: increment on 0; use-after-free.
------------[ cut here ]------------
WARNING: CPU: 0 PID: 16486 at lib/refcount.c:153 refcount_inc
lib/refcount.c:153 [inline]
WARNING: CPU: 0 PID: 16486 at lib/refcount.c:153
refcount_inc.cold+0x18/0x1f lib/refcount.c:151
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 16486 Comm: syz-executor928 Not tainted 4.14.139 #35
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x138/0x19c lib/dump_stack.c:53
panic+0x1f2/0x426 kernel/panic.c:182
__warn.cold+0x2f/0x36 kernel/panic.c:546
report_bug+0x216/0x254 lib/bug.c:186
fixup_bug arch/x86/kernel/traps.c:177 [inline]
fixup_bug arch/x86/kernel/traps.c:172 [inline]
do_error_trap+0x1bb/0x310 arch/x86/kernel/traps.c:295
do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:314
invalid_op+0x1b/0x40 arch/x86/entry/entry_64.S:963
RIP: 0010:refcount_inc lib/refcount.c:153 [inline]
RIP: 0010:refcount_inc.cold+0x18/0x1f lib/refcount.c:151
RSP: 0018:ffff88809183f980 EFLAGS: 00010286
RAX: 000000000000002b RBX: 1ffff11012307f3d RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff869d2b40 RDI: ffffed1012307f26
RBP: ffff88809183f988 R08: 000000000000002b R09: ffff88808aa6af20
R10: 0000000000000000 R11: 0000000000000000 R12: ffff8880a9b04f20
R13: 0000000000000000 R14: ffff8880919082c0 R15: ffff888096927ee8
kref_get include/linux/kref.h:47 [inline]
kobject_get+0x5b/0x70 lib/kobject.c:596
cdev_get+0x54/0xa0 fs/char_dev.c:364
chrdev_open+0x9b/0x590 fs/char_dev.c:409
do_dentry_open+0x73b/0xeb0 fs/open.c:777
vfs_open+0x105/0x220 fs/open.c:891
do_last fs/namei.c:3425 [inline]
path_openat+0x8bd/0x3f70 fs/namei.c:3566
do_filp_open+0x18e/0x250 fs/namei.c:3600
do_sys_open+0x2c5/0x430 fs/open.c:1084
SYSC_open fs/open.c:1102 [inline]
SyS_open+0x2d/0x40 fs/open.c:1097
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x404f60
RSP: 002b:00007ffd273c1ab8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 000000000000000a RCX: 0000000000404f60
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00007ffd273c1ad0
RBP: 0000000000000000 R08: 000000000000000f R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000306
R13: 0000000000406290 R14: 0000000000000000 R15: 0000000000000000

syzbot

unread,
Jan 19, 2020, 9:45:02 AM1/19/20
to syzkaller...@googlegroups.com
syzbot suspects this bug was fixed by commit:

commit f57fd58dda426cdebe36a1dae169b1c87b2ad295
Author: Nicolas Dichtel <nicolas...@6wind.com>
Date: Fri Sep 6 09:47:02 2019 +0000

bridge/mdb: remove wrong use of NLM_F_MULTI

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1628f4c9e00000
start commit: db2d0b7c Linux 4.19.73
git tree: linux-4.19.y
kernel config: https://syzkaller.appspot.com/x/.config?x=1515ac7d82731bf1
dashboard link: https://syzkaller.appspot.com/bug?extid=f41669cbb0aeb785392e
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14c131be600000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12246e65600000

If the result looks correct, please mark the bug fixed by replying with:

#syz fix: bridge/mdb: remove wrong use of NLM_F_MULTI

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

syzbot

unread,
Jan 24, 2020, 1:23:03 AM1/24/20
to syzkaller...@googlegroups.com
syzbot suspects this bug was fixed by commit:

commit 03a70959304028f2eed3713f03bd1c92585699b0
Author: Andrew Lunn <and...@lunn.ch>
Date: Thu Oct 17 19:29:26 2019 +0000

net: usb: lan78xx: Connect PHY before registering MAC

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1638bb69e00000
start commit: f6e27dbb Linux 4.14.146
git tree: linux-4.14.y
kernel config: https://syzkaller.appspot.com/x/.config?x=cb75afefe94a0801
dashboard link: https://syzkaller.appspot.com/bug?extid=8f6326d01bc61afbc095
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1173437d600000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1271f82b600000

If the result looks correct, please mark the bug fixed by replying with:

#syz fix: net: usb: lan78xx: Connect PHY before registering MAC
Reply all
Reply to author
Forward
0 new messages