syzbot


WARNING: refcount bug in kobject_put

Status: fixed on 2019/12/04 13:46
Reported-by: syzbot+bb830280a18c94996cbd@syzkaller.appspotmail.com
Fix commit: 5432923a6b20 driver core: Fix use-after-free and double free on glue directory
First crash: 1800d, last: 1693d
Fix bisection: fixed by (bisect log) :
commit 5432923a6b208b253d95d95cee72d0508c803421
Author: Muchun Song <smuchun@gmail.com>
Date: Sat Jul 27 03:21:22 2019 +0000

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

  
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream WARNING: refcount bug in kobject_put kernel C 4 1734d 1973d 0/26 closed as dup on 2018/11/02 15:33

Sample crash report:
Bluetooth: hci4 command 0x1009 tx timeout
Bluetooth: hci1 command 0x1009 tx timeout
Bluetooth: hci0 command 0x1009 tx timeout
refcount_t: underflow; use-after-free.
------------[ cut here ]------------
WARNING: CPU: 1 PID: 7205 at lib/refcount.c:187 refcount_sub_and_test lib/refcount.c:187 [inline]
WARNING: CPU: 1 PID: 7205 at lib/refcount.c:187 refcount_sub_and_test.cold+0x18/0x22 lib/refcount.c:177
Kernel panic - not syncing: panic_on_warn set ...

CPU: 1 PID: 7205 Comm: syz-executor805 Not tainted 4.14.138 #34
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_sub_and_test lib/refcount.c:187 [inline]
RIP: 0010:refcount_sub_and_test.cold+0x18/0x22 lib/refcount.c:177
RSP: 0018:ffff888095587940 EFLAGS: 00010282
RAX: 0000000000000026 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff869d2b40 RDI: ffffed1012ab0f1e
RBP: ffff888095587968 R08: 0000000000000026 R09: ffff88807c4c2ef0
R10: 0000000000000000 R11: 0000000000000000 R12: ffff88821a9b19b8
R13: 0000000000000001 R14: 00000000ffffffff R15: ffff8880a1321d08
 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+0x78a/0xaa0 drivers/base/core.c:2024
 hci_unregister_dev+0x298/0x7d0 net/bluetooth/hci_core.c:3212
 hci_uart_tty_close+0x1dd/0x230 drivers/bluetooth/hci_ldisc.c:548
 tty_ldisc_close.isra.0+0x99/0xd0 drivers/tty/tty_ldisc.c:498
 tty_ldisc_kill+0x4b/0xc0 drivers/tty/tty_ldisc.c:644
 tty_ldisc_release+0xb6/0x230 drivers/tty/tty_ldisc.c:811
 tty_release_struct+0x1b/0x50 drivers/tty/tty_io.c:1603
 tty_release+0xaa3/0xd60 drivers/tty/tty_io.c:1776
 __fput+0x275/0x7a0 fs/file_table.c:210
 ____fput+0x16/0x20 fs/file_table.c:244
 task_work_run+0x114/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+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x43ff28
RSP: 002b:00007ffcba9ef208 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000043ff28
RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
RBP: 00000000004bf750 R08: 00000000000000e7 R09: ffffffffffffffd0
R10: 00000000004002c8 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006d1180 R14: 0000000000000000 R15: 0000000000000000
Kernel Offset: disabled
Rebooting in 86400 seconds..

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/08/09 20:50 linux-4.14.y 3ffe1e79c174 aff9e255 .config console log report syz C ci2-linux-4-14
2019/04/25 03:04 linux-4.14.y 68d7a45eec10 8e3c52b1 .config console log report syz C ci2-linux-4-14
2019/06/30 22:55 linux-4.14.y f4cc0ed9b2c7 699d6448 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.