WARNING: refcount bug in kobject_put

3 views
Skip to first unread message

syzbot

unread,
Nov 2, 2018, 11:31:03 AM11/2/18
to gre...@linuxfoundation.org, linux-...@vger.kernel.org, raf...@kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: e468f5c06b5e Merge tag 'compiler-attributes-for-linus-4.20..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17ad34b9400000
kernel config: https://syzkaller.appspot.com/x/.config?x=9384ecb1c973baed
dashboard link: https://syzkaller.appspot.com/bug?extid=3ed2626dbfac197ce4d4
compiler: gcc (GCC) 8.0.1 20180413 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16f6882b400000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1423f983400000

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

------------[ cut here ]------------
refcount_t: underflow; use-after-free.
WARNING: CPU: 1 PID: 7046 at lib/refcount.c:187
refcount_sub_and_test_checked+0x2c9/0x310 lib/refcount.c:187
Kernel panic - not syncing: panic_on_warn set ...
CPU: 1 PID: 7046 Comm: syz-executor895 Not tainted 4.19.0+ #315
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+0x244/0x39d lib/dump_stack.c:113
panic+0x2ad/0x55c kernel/panic.c:188
__warn.cold.8+0x20/0x45 kernel/panic.c:540
report_bug+0x254/0x2d0 lib/bug.c:186
fixup_bug arch/x86/kernel/traps.c:178 [inline]
do_error_trap+0x11b/0x200 arch/x86/kernel/traps.c:271
do_invalid_op+0x36/0x40 arch/x86/kernel/traps.c:290
invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:969
RIP: 0010:refcount_sub_and_test_checked+0x2c9/0x310 lib/refcount.c:187
Code: 89 de e8 0a 87 ed fd 84 db 74 07 31 db e9 4d ff ff ff e8 2a 86 ed fd
48 c7 c7 20 9d 60 88 c6 05 85 5e 7f 06 01 e8 c7 e6 b6 fd <0f> 0b 31 db e9
2c ff ff ff 48 89 cf e8 56 cd 30 fe e9 41 fe ff ff
RSP: 0018:ffff8801bcdd76a8 EFLAGS: 00010286
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff8165d6c5 RDI: 0000000000000005
RBP: ffff8801bcdd7790 R08: ffff8801bcb98700 R09: ffffed003b5e5020
R10: ffffed003b5e5020 R11: ffff8801daf28107 R12: ffff8801d72459b8
R13: 00000000ffffffff R14: ffff8801bcdd7768 R15: ffff8801bcdfa620
refcount_dec_and_test_checked+0x1a/0x20 lib/refcount.c:212
kref_put include/linux/kref.h:69 [inline]
kobject_put+0x6c/0xe0 lib/kobject.c:708
kset_put include/linux/kobject.h:218 [inline]
kobj_kset_leave+0x25b/0x3f0 lib/kobject.c:201
kobject_del.part.4+0x79/0xf0 lib/kobject.c:596
kobject_del+0x1f/0x30 lib/kobject.c:588
cleanup_glue_dir.part.19+0x1c2/0x210 drivers/base/core.c:1651
cleanup_glue_dir drivers/base/core.c:681 [inline]
device_del+0x813/0xb70 drivers/base/core.c:2094
hci_unregister_dev+0x3a2/0x990 net/bluetooth/hci_core.c:3355
vhci_release+0x76/0xf0 drivers/bluetooth/hci_vhci.c:354
__fput+0x385/0xa30 fs/file_table.c:278
____fput+0x15/0x20 fs/file_table.c:309
task_work_run+0x1e8/0x2a0 kernel/task_work.c:113
tracehook_notify_resume include/linux/tracehook.h:188 [inline]
exit_to_usermode_loop+0x318/0x380 arch/x86/entry/common.c:166
prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
syscall_return_slowpath arch/x86/entry/common.c:268 [inline]
do_syscall_64+0x6be/0x820 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x400dd0
Code: 01 f0 ff ff 0f 83 b0 0a 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f
44 00 00 83 3d fd 18 2d 00 00 75 14 b8 03 00 00 00 0f 05 <48> 3d 01 f0 ff
ff 0f 83 84 0a 00 00 c3 48 83 ec 08 e8 3a 01 00 00
RSP: 002b:00007ffc5caf19d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000003 RCX: 0000000000400dd0
RDX: 0000000000000002 RSI: 00000000200000c0 RDI: 0000000000000003
RBP: 0000000000000000 R08: 00000000004002c8 R09: 00000000004002c8
R10: 0000000000b0c880 R11: 0000000000000246 R12: 000000000000b95f
R13: 0000000000401d70 R14: 0000000000000000 R15: 0000000000000000
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#bug-status-tracking for how to communicate with
syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

Dmitry Vyukov

unread,
Nov 2, 2018, 11:33:58 AM11/2/18
to syzbot, Greg Kroah-Hartman, LKML, raf...@kernel.org, syzkall...@googlegroups.com
On Fri, Nov 2, 2018 at 4:31 PM, syzbot
<syzbot+3ed262...@syzkaller.appspotmail.com> wrote:
> Hello,
>
> syzbot found the following crash on:
>
> HEAD commit: e468f5c06b5e Merge tag 'compiler-attributes-for-linus-4.20..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=17ad34b9400000
> kernel config: https://syzkaller.appspot.com/x/.config?x=9384ecb1c973baed
> dashboard link: https://syzkaller.appspot.com/bug?extid=3ed2626dbfac197ce4d4
> compiler: gcc (GCC) 8.0.1 20180413 (experimental)
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16f6882b400000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1423f983400000

Looks the same as:

https://syzkaller.appspot.com/bug?id=b52dec65c1aaaec9b3893458b13a3304303de321

#syz dup: WARNING in kernfs_get
> --
> You received this message because you are subscribed to the Google Groups
> "syzkaller-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to syzkaller-bug...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/syzkaller-bugs/0000000000001c5bd90579b039b8%40google.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages