WARNING: refcount bug in kobject_put

8 views
Skip to first unread message

syzbot

unread,
Apr 25, 2019, 12:05:06 AM4/25/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 68d7a45e Linux 4.14.113
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=131f8b47200000
kernel config: https://syzkaller.appspot.com/x/.config?x=dbf1fde4d7489e1c
dashboard link: https://syzkaller.appspot.com/bug?extid=bb830280a18c94996cbd
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16e9e0eca00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1306e590a00000

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

refcount_t: underflow; use-after-free.
------------[ cut here ]------------
WARNING: CPU: 1 PID: 7729 at lib/refcount.c:187 refcount_sub_and_test
lib/refcount.c:187 [inline]
WARNING: CPU: 1 PID: 7729 at lib/refcount.c:187
refcount_sub_and_test.cold+0x18/0x22 lib/refcount.c:177
Kernel panic - not syncing: panic_on_warn set ...

kobject: 'hci3': free name
CPU: 1 PID: 7729 Comm: syz-executor476 Not tainted 4.14.113 #3
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/0x438 kernel/panic.c:182
__warn.cold+0x2f/0x34 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:944
RIP: 0010:refcount_sub_and_test lib/refcount.c:187 [inline]
RIP: 0010:refcount_sub_and_test.cold+0x18/0x22 lib/refcount.c:177
RSP: 0018:ffff8880a0177a68 EFLAGS: 00010286
RAX: 0000000000000026 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffff8880835b6a00 RDI: ffffed101402ef43
RBP: ffff8880a0177a90 R08: 0000000000000026 R09: ffff8880835b6a20
R10: 0000000000000000 R11: 0000000000000000 R12: ffff88821a9f1078
R13: 0000000000000001 R14: 00000000ffffffff R15: ffff88821a9f0ff8
refcount_dec_and_test+0x1b/0x20 lib/refcount.c:212
kref_put include/linux/kref.h:69 [inline]
kobject_put+0x60/0x80 lib/kobject.c:692
kset_put include/linux/kobject.h:215 [inline]
kobj_kset_leave+0x17f/0x220 lib/kobject.c:184
kobject_del.part.0+0x79/0xf0 lib/kobject.c:579
kobject_del+0x20/0x30 lib/kobject.c:571
cleanup_glue_dir.part.0+0xd2/0x100 drivers/base/core.c:1581
cleanup_glue_dir drivers/base/core.c:614 [inline]
device_del+0x78e/0xaa0 drivers/base/core.c:2024
hci_unregister_dev+0x298/0x7d0 net/bluetooth/hci_core.c:3212
vhci_release+0x76/0xf0 drivers/bluetooth/hci_vhci.c:354
__fput+0x277/0x7a0 fs/file_table.c:210
____fput+0x16/0x20 fs/file_table.c:244
task_work_run+0x119/0x190 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0x7df/0x2c10 kernel/exit.c:874
do_group_exit+0x111/0x330 kernel/exit.c:977
SYSC_exit_group kernel/exit.c:988 [inline]
SyS_exit_group+0x1d/0x20 kernel/exit.c:986
do_syscall_64+0x1eb/0x630 arch/x86/entry/common.c:289
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x43fed8
RSP: 002b:00007ffd3b0ea108 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000043fed8
RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
RBP: 00000000004bf710 R08: 00000000000000e7 R09: ffffffffffffffd0
R10: 0000000000000004 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006d1180 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#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,
Dec 3, 2019, 7:54:02 PM12/3/19
to syzkaller...@googlegroups.com
syzbot suspects this bug was fixed by commit:

commit 5432923a6b208b253d95d95cee72d0508c803421
Author: Muchun Song <smu...@gmail.com>
Date: Sat Jul 27 03:21:22 2019 +0000

driver core: Fix use-after-free and double free on glue directory

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=13e6fbf2e00000
start commit: 68d7a45e Linux 4.14.113
git tree: linux-4.14.y
If the result looks correct, please mark the bug fixed by replying with:

#syz fix: driver core: Fix use-after-free and double free on glue directory

For information about bisection process see: https://goo.gl/tpsmEJ#bisection
Reply all
Reply to author
Forward
0 new messages