syzbot


general protection fault in kernfs_add_one
Status: fixed on 2019/12/03 19:05
Reported-by: syzbot+23e2b75b45e0821f1115@syzkaller.appspotmail.com
Fix commit: 5432923a6b20 driver core: Fix use-after-free and double free on glue directory
First crash: 1096d, last: 1027d

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 (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-414 general protection fault in kernfs_add_one 1 981d 981d 0/1 auto-closed as invalid on 2020/01/14 07:42
linux-4.19 general protection fault in kernfs_add_one C done 8 994d 1133d 1/1 fixed on 2019/12/05 10:31
upstream general protection fault in kernfs_add_one C done 98 1022d 1346d 14/22 fixed on 2019/11/22 12:17

Sample crash report:
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
kobject: 'hci4' (ffff888094b76668): kobject_uevent_env
Modules linked in:
CPU: 1 PID: 7372 Comm: syz-executor143 Not tainted 4.14.135 #31
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
task: ffff888096c5a440 task.stack: ffff8880a58d8000
RIP: 0010:kernfs_add_one+0x2cb/0x3a0 fs/kernfs/dir.c:794
RSP: 0018:ffff8880a58df980 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000003
RDX: 0000000000000001 RSI: 0000000000000002 RDI: 0000000000000008
RBP: ffff8880a58df9b8 R08: fffffbfff12354d8 R09: ffff888096c5a440
R10: dffffc0000000000 R11: ffff888096c5a440 R12: ffff88809e96a9a0
R13: ffff88809e96a9a0 R14: 0000000000000000 R15: ffff88809e96a9c8
FS:  0000000000f75880(0000) GS:ffff8880aef00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000000043fc4a CR3: 0000000096d23000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 kernfs_create_dir_ns+0xea/0x140 fs/kernfs/dir.c:1008
 sysfs_create_dir_ns+0xbe/0x1d0 fs/sysfs/dir.c:55
 create_dir lib/kobject.c:71 [inline]
 kobject_add_internal.part.0.cold+0x114/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
kobject: 'hci1' (ffff888080326728): kobject_add_internal: parent: 'bluetooth', set: 'devices'
 device_add+0x383/0x1490 drivers/base/core.c:1809
kobject: 'hci3' (ffff88807d4ea768): kobject_add_internal: parent: 'bluetooth', set: 'devices'
 hci_register_dev+0x2d9/0x810 net/bluetooth/hci_core.c:3118
 __vhci_create_device+0x2a6/0x560 drivers/bluetooth/hci_vhci.c:139
 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
 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
kobject: 'hci4' (ffff888094b76668): fill_kobj_path: path = '/devices/virtual/bluetooth/hci4'
 vfs_write+0x198/0x500 fs/read_write.c:544
 SYSC_write fs/read_write.c:590 [inline]
 SyS_write+0xfd/0x230 fs/read_write.c:582
kobject: 'hci1' (ffff888080326728): kobject_uevent_env
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
kobject: 'hci4' (ffff888094b76668): kobject_cleanup, parent           (null)
RIP: 0033:0x441289
RSP: 002b:00007ffc9895ea08 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441289
RDX: 0000000000000002 RSI: 0000000020000000 RDI: 0000000000000003
RBP: 000000000000ef25 R08: 00000000004002c8 R09: 00000000004002c8
R10: 00000000004002c8 R11: 0000000000000246 R12: 0000000000402000
R13: 0000000000402090 R14: 0000000000000000 R15: 0000000000000000
Code: 
kobject: 'hci3' (ffff88807d4ea768): kobject_uevent_env
70 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 9a 00 
kobject: 'hci1' (ffff888080326728): fill_kobj_path: path = '/devices/virtual/bluetooth/hci1'
00 00 48 b8 00 00 00 00 00 fc ff df 48 8b 5b 70 48 8d 7b 08 48 89 fa 48 
kobject: 'hci4' (ffff888094b76668): calling ktype release
c1 ea 03 <0f> b6 04 02 84 c0 74 04 3c 03 7e 6e 
kobject: 'hci3' (ffff88807d4ea768): fill_kobj_path: path = '/devices/virtual/bluetooth/hci3'
f6 43 08 01 0f 85 09 fe ff 
RIP: kernfs_add_one+0x2cb/0x3a0 fs/kernfs/dir.c:794 RSP: ffff8880a58df980
kobject: 'hci4' (ffff88807d4367a8): kobject_add_internal: parent: 'bluetooth', set: 'devices'
kobject: 'rfkill504' (ffff888095d42ee8): kobject_add_internal: parent: 'hci1', set: 'devices'
kobject: 'hci5' (ffff8880952827e8): kobject_add_internal: parent: 'bluetooth', set: 'devices'
kobject: 'hci4': free name
kobject: 'hci4' (ffff88807d4367a8): kobject_uevent_env
kobject: 'rfkill504' (ffff888095d42ee8): kobject_uevent_env
kobject: 'hci5' (ffff8880952827e8): kobject_uevent_env
kobject: 'rfkill504' (ffff888095d42ee8): fill_kobj_path: path = '/devices/virtual/bluetooth/hci1/rfkill504'
kobject: 'hci4' (ffff88807d4367a8): fill_kobj_path: path = '/devices/virtual/bluetooth/hci4'
kobject: 'hci6' (ffff888093d76828): kobject_add_internal: parent: 'bluetooth', set: 'devices'
kobject: 'hci5' (ffff8880952827e8): fill_kobj_path: path = '/devices/virtual/bluetooth/hci5'
kobject: 'rfkill505' (ffff888095d42668): kobject_add_internal: parent: 'hci3', set: 'devices'
---[ end trace b43566f41a9fd557 ]---
kobject: 'rfkill505' (ffff888095d42668): kobject_uevent_env

Crashes (5):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2019/08/01 23:42 linux-4.14.y 10d6aa565d05 835dffe7 .config log report syz C
ci2-linux-4-14 2019/07/05 10:43 linux-4.14.y e3c1b27308ae 429efa16 .config log report syz C
ci2-linux-4-14 2019/06/30 23:00 linux-4.14.y f4cc0ed9b2c7 699d6448 .config log report
ci2-linux-4-14 2019/06/30 22:58 linux-4.14.y f4cc0ed9b2c7 699d6448 .config log report
ci2-linux-4-14 2019/05/24 21:56 linux-4.14.y bbcb3c09eae4 85c57315 .config log report