syzbot


WARNING in kernfs_get

Status: fixed on 2019/12/07 19:24
Reported-by: syzbot+5c4d1ce9497564ba35da@syzkaller.appspotmail.com
Fix commit: 5432923a6b20 driver core: Fix use-after-free and double free on glue directory
First crash: 2062d, last: 1942d
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 (7)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream WARNING in kernfs_get (5) kernfs syz inconclusive 181 36m 219d 0/28 upstream: reported syz repro on 2024/05/08 11:07
linux-4.19 WARNING in kernfs_get C done 14 1918d 2058d 1/1 fixed on 2019/12/05 23:59
upstream WARNING in kernfs_get (2) kernfs 2 1538d 1556d 0/28 auto-closed as invalid on 2021/01/25 03:55
upstream WARNING in kernfs_get (4) kernfs syz error 3 674d 677d 0/28 auto-obsoleted due to no activity on 2023/06/07 19:32
upstream WARNING in kernfs_get C done 316 1957d 2286d 13/28 fixed on 2019/11/20 22:01
upstream WARNING in kernfs_get (3) kernfs 3 1103d 1107d 0/28 auto-closed as invalid on 2022/02/04 06:25
android-414 WARNING in kernfs_get syz 69 1921d 2073d 0/1 public: reported syz repro on 2019/04/10 15:44

Sample crash report:
kernfs_put: bluetooth/hci1: released with incorrect active_ref 0
------------[ cut here ]------------
WARNING: CPU: 0 PID: 10655 at fs/kernfs/dir.c:494 kernfs_get+0x58/0x70 fs/kernfs/dir.c:494
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 10655 Comm: syz-executor796 Not tainted 4.14.132 #26
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:960
RIP: 0010:kernfs_get+0x58/0x70 fs/kernfs/dir.c:494
RSP: 0018:ffff88809eb4fa18 EFLAGS: 00010297
RAX: ffff88808081a280 RBX: ffff88809c16b380 RCX: 0000000000000003
RDX: 0000000000000000 RSI: 0000000000000002 RDI: ffff88809c16b380
RBP: ffff88809eb4fa20 R08: fffffbfff12348d8 R09: ffff88808081a280
R10: dffffc0000000000 R11: ffff88808081a280 R12: ffff88809917eaa8
R13: ffff88809917ead8 R14: 0000000000000000 R15: ffffffff87c17320
 sysfs_get include/linux/sysfs.h:543 [inline]
 create_dir lib/kobject.c:85 [inline]
 kobject_add_internal.part.0.cold+0x2fa/0x5ae lib/kobject.c:229
 kobject_add_internal lib/kobject.c:205 [inline]
 kobject_add_varg lib/kobject.c:364 [inline]
 kobject_add+0x11f/0x180 lib/kobject.c:409
 device_add+0x383/0x1490 drivers/base/core.c:1809
------------[ cut here ]------------
WARNING: CPU: 1 PID: 10650 at fs/kernfs/dir.c:525 kernfs_put fs/kernfs/dir.c:525 [inline]
WARNING: CPU: 1 PID: 10650 at fs/kernfs/dir.c:525 kernfs_put.cold+0x8a/0xa4 fs/kernfs/dir.c:506
 hci_register_dev+0x2d9/0x810 net/bluetooth/hci_core.c:3118
Modules linked in:
 __vhci_create_device+0x2a6/0x560 drivers/bluetooth/hci_vhci.c:139
CPU: 1 PID: 10650 Comm: syz-executor796 Not tainted 4.14.132 #26
 vhci_create_device drivers/bluetooth/hci_vhci.c:163 [inline]
 vhci_get_user drivers/bluetooth/hci_vhci.c:219 [inline]
 vhci_write+0x2a1/0x437 drivers/bluetooth/hci_vhci.c:299
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 call_write_iter include/linux/fs.h:1777 [inline]
 new_sync_write fs/read_write.c:469 [inline]
 __vfs_write+0x4a7/0x6b0 fs/read_write.c:482
task: ffff888099820380 task.stack: ffff888085040000
RIP: 0010:kernfs_put fs/kernfs/dir.c:525 [inline]
RIP: 0010:kernfs_put.cold+0x8a/0xa4 fs/kernfs/dir.c:506
RSP: 0018:ffff8880850476b8 EFLAGS: 00010282
 vfs_write+0x198/0x500 fs/read_write.c:544
RAX: 0000000000000040 RBX: dffffc0000000000 RCX: 0000000000000000
 SYSC_write fs/read_write.c:590 [inline]
 SyS_write+0xfd/0x230 fs/read_write.c:582
RDX: 0000000000000000 RSI: ffff888099820c28 RDI: ffffed1010a08ecd
RBP: ffff888085047710 R08: 0000000000000040 R09: ffff888099820c48
R10: 0000000000000000 R11: 0000000000000000 R12: ffff88809c16b380
R13: ffff888080a402a0 R14: ffff88809c16b3b0 R15: ffffffff86fa9020
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
FS:  00007f34a287e700(0000) GS:ffff8880aef00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
CR2: 00000000200012c0 CR3: 000000009f10a000 CR4: 00000000001406e0
RIP: 0033:0x446dd9
Call Trace:
RSP: 002b:00007f34a289ece8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
 __kernfs_remove fs/kernfs/dir.c:1316 [inline]
 __kernfs_remove+0x382/0x7e0 fs/kernfs/dir.c:1253
RAX: ffffffffffffffda RBX: 00000000006dcc28 RCX: 0000000000446dd9
RDX: 0000000000000002 RSI: 00000000200000c0 RDI: 0000000000000003
RBP: 00000000006dcc20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dcc2c
 kernfs_remove+0x24/0x40 fs/kernfs/dir.c:1329
R13: 00007ffe1278a1cf R14: 00007f34a289f9c0 R15: 0000000000000000
 sysfs_remove_dir+0xc6/0x100 fs/sysfs/dir.c:97
 kobject_del.part.0+0x3a/0xf0 lib/kobject.c:575
 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
 vhci_release+0x76/0xf0 drivers/bluetooth/hci_vhci.c:354
 __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
 get_signal+0x381/0x1cd0 kernel/signal.c:2409
 do_signal+0x86/0x19a0 arch/x86/kernel/signal.c:814
 exit_to_usermode_loop+0x15c/0x220 arch/x86/entry/common.c:160
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
 do_syscall_64+0x4bc/0x640 arch/x86/entry/common.c:297
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x446dd9
RSP: 002b:00007f34a287dcf8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00000000006dcc38 RCX: 0000000000446dd9
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00000000006dcc38
RBP: 00000000006dcc30 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dcc3c
R13: 00007ffe1278a1cf R14: 00007f34a287e9c0 R15: 0000000000000001
Code: 89 f0 48 c1 e8 03 80 3c 18 00 74 08 4c 89 f7 e8 b4 65 dc ff 49 8b 54 24 30 4c 89 fe 48 c7 c7 40 7b 76 86 8b 4d d0 e8 00 0a a1 ff <0f> 0b e9 1b ba ff ff 49 c7 c7 00 7b 76 86 eb ba 4c 89 ff e8 65 
---[ end trace e596925b0f4d3a58 ]---
Kernel Offset: disabled
Rebooting in 86400 seconds..

Crashes (17):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/07/04 07:23 linux-4.14.y e3c1b27308ae 55565fa0 .config console log report syz C ci2-linux-4-14
2019/07/04 06:19 linux-4.14.y e3c1b27308ae 55565fa0 .config console log report syz C ci2-linux-4-14
2019/07/01 10:05 linux-4.14.y f4cc0ed9b2c7 699d6448 .config console log report syz C ci2-linux-4-14
2019/06/30 23:43 linux-4.14.y f4cc0ed9b2c7 699d6448 .config console log report syz C ci2-linux-4-14
2019/06/16 03:33 linux-4.14.y a74d0e937a3a 442206d7 .config console log report syz C ci2-linux-4-14
2019/06/15 05:49 linux-4.14.y 2bf3258a12af 442206d7 .config console log report syz C ci2-linux-4-14
2019/06/11 02:59 linux-4.14.y e6a95d8851f1 0159583c .config console log report syz C ci2-linux-4-14
2019/04/29 20:51 linux-4.14.y fa5941f45d7e b617407b .config console log report syz C ci2-linux-4-14
2019/04/27 03:37 linux-4.14.y 68d7a45eec10 b617407b .config console log report syz C ci2-linux-4-14
2019/04/21 17:17 linux-4.14.y 68d7a45eec10 b0e8efcb .config console log report syz C ci2-linux-4-14
2019/06/15 13:30 linux-4.14.y a74d0e937a3a 442206d7 .config console log report syz ci2-linux-4-14
2019/08/19 13:58 linux-4.14.y 45f092f9e9cb b8ceabfc .config console log report ci2-linux-4-14
2019/07/26 21:59 linux-4.14.y ff33472c282e 8fe30d3e .config console log report ci2-linux-4-14
2019/07/19 16:15 linux-4.14.y aea8526edf59 8304907d .config console log report ci2-linux-4-14
2019/07/01 16:33 linux-4.14.y f4cc0ed9b2c7 907bf746 .config console log report ci2-linux-4-14
2019/07/01 10:29 linux-4.14.y f4cc0ed9b2c7 699d6448 .config console log report ci2-linux-4-14
2019/06/15 09:09 linux-4.14.y 2bf3258a12af 442206d7 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.