syzbot


general protection fault in kernfs_add_one

Status: fixed on 2019/12/05 10:31
Reported-by: syzbot+80d979a6936a96034ed7@syzkaller.appspotmail.com
Fix commit: e1666bcbae0c driver core: Fix use-after-free and double free on glue directory
First crash: 2044d, last: 1905d
Fix bisection: fixed by (bisect log) :
commit e1666bcbae0c5edb6d7a752b31a8f28c59b54546
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
linux-4.14 general protection fault in kernfs_add_one C done 5 1938d 2007d 1/1 fixed on 2019/12/03 19:05
android-414 general protection fault in kernfs_add_one 1 1893d 1893d 0/1 auto-closed as invalid on 2020/01/14 07:42
upstream general protection fault in kernfs_add_one C done 98 1934d 2258d 13/28 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: 'hci1' (00000000b435db3c): kobject_add_internal: parent: 'bluetooth', set: 'devices'
CPU: 1 PID: 9809 Comm: syz-executor001 Not tainted 4.19.67 #41
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:kernfs_add_one+0x343/0x4d0 fs/kernfs/dir.c:811
Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 52 01 00 00 48 b8 00 00 00 00 00 fc ff df 48 8b 5b 70 48 8d 7b 08 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e 1f 01 00 00 8b 5b 08 31 ff 83
kobject: 'hci6' (0000000098ee085c): kobject_add_internal: parent: 'bluetooth', set: 'devices'
RSP: 0018:ffff8880a68d7850 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff86f2d008
RDX: 0000000000000001 RSI: ffffffff81cd8dbb RDI: 0000000000000008
RBP: ffff8880a68d7890 R08: 1ffffffff1110d7c R09: fffffbfff1110d7d
R10: fffffbfff1110d7c R11: ffffffff88886be7 R12: ffff8880a03c3540
R13: ffff8880a03c3540 R14: 0000000000000000 R15: 0000000000000000
kobject: 'hci4' (000000004d9e3f15): kobject_add_internal: parent: 'bluetooth', set: 'devices'
FS:  000000000133e880(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000004bf748 CR3: 000000009b5a3000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
kobject: 'hci6' (0000000098ee085c): kobject_uevent_env
Call Trace:
 kernfs_create_dir_ns+0xff/0x160 fs/kernfs/dir.c:1030
 sysfs_create_dir_ns+0x131/0x290 fs/sysfs/dir.c:58
kobject: 'hci1' (00000000b435db3c): kobject_uevent_env
 create_dir lib/kobject.c:88 [inline]
 kobject_add_internal lib/kobject.c:247 [inline]
 kobject_add_internal.cold+0xe5/0x5d1 lib/kobject.c:217
kobject: 'hci6' (0000000098ee085c): fill_kobj_path: path = '/devices/virtual/bluetooth/hci6'
 kobject_add_varg lib/kobject.c:382 [inline]
 kobject_add+0x150/0x1c0 lib/kobject.c:426
kobject: 'hci4' (000000004d9e3f15): kobject_uevent_env
 device_add+0x3cc/0x1760 drivers/base/core.c:1885
kobject: 'hci1' (00000000b435db3c): fill_kobj_path: path = '/devices/virtual/bluetooth/hci1'
 hci_register_dev+0x304/0x880 net/bluetooth/hci_core.c:3198
kobject: 'rfkill2610' (0000000067e401b7): kobject_add_internal: parent: 'hci6', set: 'devices'
 __vhci_create_device+0x2d0/0x5a0 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+0x2d6/0x470 drivers/bluetooth/hci_vhci.c:299
kobject: 'hci4' (000000004d9e3f15): fill_kobj_path: path = '/devices/virtual/bluetooth/hci4'
 call_write_iter include/linux/fs.h:1820 [inline]
 new_sync_write fs/read_write.c:474 [inline]
 __vfs_write+0x587/0x810 fs/read_write.c:487
kobject: 'rfkill2610' (0000000067e401b7): kobject_uevent_env
kobject: 'rfkill2610' (0000000067e401b7): fill_kobj_path: path = '/devices/virtual/bluetooth/hci6/rfkill2610'
kobject: 'rfkill2611' (00000000ef6b4ea1): kobject_add_internal: parent: 'hci1', set: 'devices'
 vfs_write+0x20c/0x560 fs/read_write.c:549
 ksys_write+0x14f/0x2d0 fs/read_write.c:599
kobject: 'rfkill2610' (0000000067e401b7): kobject_uevent_env
kobject: 'rfkill2611' (00000000ef6b4ea1): kobject_uevent_env
 __do_sys_write fs/read_write.c:611 [inline]
 __se_sys_write fs/read_write.c:608 [inline]
 __x64_sys_write+0x73/0xb0 fs/read_write.c:608
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x441279
kobject: 'rfkill2611' (00000000ef6b4ea1): fill_kobj_path: path = '/devices/virtual/bluetooth/hci1/rfkill2611'
Code: e8 ac e8 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 eb 08 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffc8beda988 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441279
RDX: 0000000000000002 RSI: 0000000020000380 RDI: 0000000000000003
RBP: 00000000000829d6 R08: 00000000004002c8 R09: 00000000004002c8
R10: 0000000000000004 R11: 0000000000000246 R12: 0000000000401ff0
kobject: 'rfkill2612' (00000000b39ac12f): kobject_add_internal: parent: 'hci4', set: 'devices'
R13: 0000000000402080 R14: 0000000000000000 R15: 0000000000000000
Modules linked in:
kobject: 'hci3' (00000000e204b4d0): kobject_cleanup, parent           (null)
kobject: 'rfkill2611' (00000000ef6b4ea1): kobject_uevent_env
kobject: 'hci3' (00000000e204b4d0): calling ktype release
kobject: 'hci3': free name
kobject: 'rfkill2612' (00000000b39ac12f): kobject_uevent_env
kobject: 'rfkill2608' (0000000031a8ce32): calling ktype release
kobject: 'rfkill2611' (00000000ef6b4ea1): fill_kobj_path: path = '/devices/virtual/bluetooth/hci1/rfkill2611'
kobject: 'rfkill2610' (0000000067e401b7): fill_kobj_path: path = '/devices/virtual/bluetooth/hci6/rfkill2610'
kobject: 'rfkill2612' (00000000b39ac12f): fill_kobj_path: path = '/devices/virtual/bluetooth/hci4/rfkill2612'
kobject: 'rfkill2608': free name
kobject: 'rfkill2612' (00000000b39ac12f): kobject_uevent_env
kobject: 'rfkill2610' (0000000067e401b7): kobject_cleanup, parent           (null)
kobject: 'rfkill2612' (00000000b39ac12f): fill_kobj_path: path = '/devices/virtual/bluetooth/hci4/rfkill2612'
kobject: 'hci3' (00000000b4c8b079): kobject_add_internal: parent: 'bluetooth', set: 'devices'
kobject: 'rfkill2612' (00000000b39ac12f): kobject_cleanup, parent           (null)
kobject: 'rfkill2611' (00000000ef6b4ea1): kobject_cleanup, parent           (null)
kobject: 'rfkill2612' (00000000b39ac12f): calling ktype release
kobject: 'hci5' (00000000678a6eb7): kobject_uevent_env
kobject: 'rfkill2612': free name
kobject: 'rfkill2610' (0000000067e401b7): calling ktype release
kobject: 'hci4' (000000004d9e3f15): kobject_uevent_env
kobject: 'hci3' (00000000b4c8b079): kobject_uevent_env
kobject: 'hci4' (000000004d9e3f15): fill_kobj_path: path = '/devices/virtual/bluetooth/hci4'
kobject: 'rfkill2611' (00000000ef6b4ea1): calling ktype release
kobject: 'hci4' (000000004d9e3f15): kobject_cleanup, parent           (null)
kobject: 'hci5' (00000000678a6eb7): fill_kobj_path: path = '/devices/virtual/bluetooth/hci5'
kobject: 'hci4' (000000004d9e3f15): calling ktype release
kobject: 'hci3' (00000000b4c8b079): fill_kobj_path: path = '/devices/virtual/bluetooth/hci3'
kobject: 'hci4': free name
kobject: 'rfkill2613' (000000007e1d4995): kobject_add_internal: parent: 'hci3', set: 'devices'
---[ end trace 60a6c05b9240622d ]---
kobject: 'rfkill2611': free name
kobject: 'hci4' (0000000042340d60): kobject_add_internal: parent: 'bluetooth', set: 'devices'
kobject: 'hci5' (00000000678a6eb7): kobject_cleanup, parent           (null)
kobject: 'hci4' (0000000042340d60): kobject_uevent_env
kobject: 'rfkill2613' (000000007e1d4995): kobject_uevent_env
kobject: 'rfkill2610': free name
RIP: 0010:kernfs_add_one+0x343/0x4d0 fs/kernfs/dir.c:811
kobject: 'hci6' (0000000098ee085c): kobject_uevent_env
kobject: 'hci5' (00000000678a6eb7): calling ktype release
kobject: 'hci6' (0000000098ee085c): fill_kobj_path: path = '/devices/virtual/bluetooth/hci6'
kobject: 'hci1' (00000000b435db3c): kobject_uevent_env
kobject: 'hci4' (0000000042340d60): fill_kobj_path: path = '/devices/virtual/bluetooth/hci4'
Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 52 01 00 00 48 b8 00 00 00 00 00 fc ff df 48 8b 5b 70 48 8d 7b 08 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e 1f 01 00 00 8b 5b 08 31 ff 83
kobject: 'hci6' (0000000098ee085c): kobject_cleanup, parent           (null)
kobject: 'rfkill2613' (000000007e1d4995): fill_kobj_path: path = '/devices/virtual/bluetooth/hci3/rfkill2613'
kobject: 'hci6' (0000000098ee085c): calling ktype release
kobject: 'hci5': free name
kobject: 'hci6': free name
RSP: 0018:ffff8880a68d7850 EFLAGS: 00010202
kobject: 'hci1' (00000000b435db3c): fill_kobj_path: path = '/devices/virtual/bluetooth/hci1'
kobject: 'rfkill2613' (000000007e1d4995): kobject_uevent_env
kobject: 'rfkill2614' (00000000b0f663d1): kobject_add_internal: parent: 'hci4', set: 'devices'
kobject: 'hci5' (00000000ed1b18bd): kobject_add_internal: parent: 'bluetooth', set: 'devices'
kobject: 'rfkill2613' (000000007e1d4995): fill_kobj_path: path = '/devices/virtual/bluetooth/hci3/rfkill2613'
kobject: 'rfkill2614' (00000000b0f663d1): kobject_uevent_env
kobject: 'hci6' (0000000082ab1c57): kobject_add_internal: parent: 'bluetooth', set: 'devices'
kobject: 'hci1' (00000000b435db3c): kobject_cleanup, parent           (null)
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff86f2d008
kobject: 'hci5' (00000000ed1b18bd): kobject_uevent_env
RDX: 0000000000000001 RSI: ffffffff81cd8dbb RDI: 0000000000000008
kobject: 'hci5' (00000000ed1b18bd): fill_kobj_path: path = '/devices/virtual/bluetooth/hci5'
kobject: 'hci6' (0000000082ab1c57): kobject_uevent_env
kobject: 'hci1' (00000000b435db3c): calling ktype release
RBP: ffff8880a68d7890 R08: 1ffffffff1110d7c R09: fffffbfff1110d7d
kobject: 'rfkill2614' (00000000b0f663d1): fill_kobj_path: path = '/devices/virtual/bluetooth/hci4/rfkill2614'
kobject: 'hci6' (0000000082ab1c57): fill_kobj_path: path = '/devices/virtual/bluetooth/hci6'
kobject: 'rfkill2614' (00000000b0f663d1): kobject_uevent_env
kobject: 'rfkill2613' (000000007e1d4995): kobject_cleanup, parent           (null)
kobject: 'rfkill2615' (000000003c2ed4e8): kobject_add_internal: parent: 'hci5', set: 'devices'
R10: fffffbfff1110d7c R11: ffffffff88886be7 R12: ffff8880a03c3540
kobject: 'hci1': free name
kobject: 'rfkill2613' (000000007e1d4995): calling ktype release
kobject: 'rfkill2614' (00000000b0f663d1): fill_kobj_path: path = '/devices/virtual/bluetooth/hci4/rfkill2614'
kobject: 'rfkill2613': free name
kobject: 'rfkill2615' (000000003c2ed4e8): kobject_uevent_env
kobject: 'hci1' (000000009d06688f): kobject_add_internal: parent: 'bluetooth', set: 'devices'
kobject: 'rfkill2615' (000000003c2ed4e8): fill_kobj_path: path = '/devices/virtual/bluetooth/hci5/rfkill2615'
R13: ffff8880a03c3540 R14: 0000000000000000 R15: 0000000000000000
kobject: 'rfkill2615' (000000003c2ed4e8): kobject_uevent_env
kobject: 'rfkill2616' (0000000060974a67): kobject_add_internal: parent: 'hci6', set: 'devices'
kobject: 'rfkill2615' (000000003c2ed4e8): fill_kobj_path: path = '/devices/virtual/bluetooth/hci5/rfkill2615'
kobject: 'hci3' (00000000b4c8b079): kobject_uevent_env
kobject: 'hci1' (000000009d06688f): kobject_uevent_env
kobject: 'rfkill2616' (0000000060974a67): kobject_uevent_env
FS:  000000000133e880(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000
kobject: 'hci3' (00000000b4c8b079): fill_kobj_path: path = '/devices/virtual/bluetooth/hci3'
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
kobject: 'rfkill2616' (0000000060974a67): fill_kobj_path: path = '/devices/virtual/bluetooth/hci6/rfkill2616'
kobject: 'hci1' (000000009d06688f): fill_kobj_path: path = '/devices/virtual/bluetooth/hci1'
kobject: 'hci3' (00000000b4c8b079): kobject_cleanup, parent           (null)
CR2: 00000000004bf748 CR3: 000000009b5a3000 CR4: 00000000001406f0
kobject: 'rfkill2616' (0000000060974a67): kobject_uevent_env
kobject: 'rfkill2614' (00000000b0f663d1): kobject_cleanup, parent           (null)
kobject: 'hci3' (00000000b4c8b079): calling ktype release
kobject: 'rfkill2615' (000000003c2ed4e8): kobject_cleanup, parent           (null)
kobject: 'hci3': free name
kobject: 'rfkill2617' (00000000f9d296c7): kobject_add_internal: parent: 'hci1', set: 'devices'
kobject: 'rfkill2616' (0000000060974a67): fill_kobj_path: path = '/devices/virtual/bluetooth/hci6/rfkill2616'
kobject: 'rfkill2617' (00000000f9d296c7): kobject_uevent_env
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
kobject: 'rfkill2615' (000000003c2ed4e8): calling ktype release
kobject: 'rfkill2617' (00000000f9d296c7): fill_kobj_path: path = '/devices/virtual/bluetooth/hci1/rfkill2617'
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
kobject: 'rfkill2615': free name
kobject: 'rfkill2614' (00000000b0f663d1): calling ktype release
kobject: 'hci3' (00000000c4188502): kobject_add_internal: parent: 'bluetooth', set: 'devices'

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/08/17 11:28 linux-4.19.y a5aa80588fcd 8fd428a1 .config console log report syz C ci2-linux-4-19
2019/07/04 20:04 linux-4.19.y 1a0592436669 deef5fbc .config console log report syz C ci2-linux-4-19
2019/04/26 00:32 linux-4.19.y c98875d930e9 f46aabc8 .config console log report syz C ci2-linux-4-19
2019/04/17 17:21 linux-4.19.y 4b0e041c9dad b0e8efcb .config console log report syz C ci2-linux-4-19
2019/09/03 20:58 linux-4.19.y 97ab07e11fbf 48448e71 .config console log report ci2-linux-4-19
2019/08/20 08:38 linux-4.19.y a5aa80588fcd cfc9868f .config console log report ci2-linux-4-19
2019/07/22 04:57 linux-4.19.y be9b6782a9eb 1656845f .config console log report ci2-linux-4-19
2019/06/06 20:57 linux-4.19.y e109a984cf38 f5dd5568 .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.