syzbot


KASAN: use-after-free Read in lockref_get

Status: fixed on 2020/09/16 22:51
Subsystems: fs
[Documentation on labels]
Reported-by: syzbot+603294af2d01acfdd6da@syzkaller.appspotmail.com
Fix commit: bad8e64fb19d blktrace: fix debugfs use after free
First crash: 1745d, last: 1645d
Duplicate bugs (2)
duplicates (2):
Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
general protection fault in simple_recursive_removal fs 2 1737d 1791d 0/28 closed as dup on 2020/06/28 17:09
KASAN: use-after-free Read in debugfs_remove (3) C done error 88 1782d 2249d 0/28 closed as dup on 2020/06/28 17:08
Discussions (20)
Title Replies (including bot) Last reply
[PATCH 4.19 00/71] 4.19.156-rc1 review 87 (87) 2020/11/19 08:10
[PATCH 4.14 00/48] 4.14.205-rc1 review 53 (53) 2020/11/10 10:04
[PATCH 5.8 000/464] 5.8.2-rc1 review 475 (475) 2020/08/19 06:11
[PATCH 5.4 000/270] 5.4.59-rc1 review 275 (275) 2020/08/18 22:37
[PATCH 5.7 000/393] 5.7.16-rc1 review 398 (398) 2020/08/18 22:36
[PATCH AUTOSEL 5.8 01/72] ARM: dts: stm32: fix uart nodes ordering in stm32mp15-pinctrl 74 (74) 2020/08/16 13:50
[PATCH AUTOSEL 5.4 01/40] x86/mce/inject: Fix a wrong assignment of i_mce.status 40 (40) 2020/08/08 23:38
[PATCH AUTOSEL 5.7 01/58] ARM: dts: stm32: fix uart7_pins_a comments in stm32mp15-pinctrl 58 (58) 2020/08/08 23:37
[PATCH v7 0/8] blktrace: fix debugfs use after free 24 (24) 2020/06/23 16:56
[PATCH v6 0/8] block: fix blktrace debugfs use after free 22 (22) 2020/06/19 20:23
[PATCH v5 0/7] block: fix blktrace debugfs use after free 24 (24) 2020/06/05 22:33
[PATCH v4 0/5] block: fix blktrace debugfs use after free 16 (16) 2020/05/16 01:39
[PATCH v3 0/6] block: fix blktrace debugfs use after free 34 (34) 2020/05/07 11:30
Re: [PATCH v3 4/6] blktrace: fix debugfs use after free 1 (1) 2020/04/29 08:48
[PATCH v2 00/10] block: fix blktrace debugfs use after free 58 (58) 2020/04/25 11:43
[PATCH 0/5] blktrace: fix use after free 53 (53) 2020/04/17 04:09
[RFC v2 0/5] blktrace: fix use after free 20 (20) 2020/04/14 03:38
Re: [RFC v2 2/5] blktrace: fix debugfs use after free 1 (1) 2020/04/10 19:37
[RFC 0/3] block: address blktrace use-after-free 29 (29) 2020/04/09 20:59
KASAN: use-after-free Read in lockref_get 0 (1) 2020/02/26 07:00

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x3b1e/0x48a0 kernel/locking/lockdep.c:4250
Read of size 8 at addr ffff888086217940 by task syz-executor.5/15483

CPU: 1 PID: 15483 Comm: syz-executor.5 Not tainted 5.7.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x188/0x20d lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xd3/0x413 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 __lock_acquire+0x3b1e/0x48a0 kernel/locking/lockdep.c:4250
 lock_acquire+0x1f2/0x8f0 kernel/locking/lockdep.c:4959
 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
 _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151
 lockref_get+0x11/0x50 include/linux/spinlock.h:353
 dget include/linux/dcache.h:323 [inline]
 simple_recursive_removal+0x43/0x730 fs/libfs.c:268
 debugfs_remove fs/debugfs/inode.c:703 [inline]
 debugfs_remove+0x59/0x80 fs/debugfs/inode.c:697
 blk_trace_free+0x31/0x130 kernel/trace/blktrace.c:311
 do_blk_trace_setup+0x711/0xb30 kernel/trace/blktrace.c:557
 __blk_trace_setup+0xca/0x180 kernel/trace/blktrace.c:571
 blk_trace_ioctl+0x162/0x2b0 kernel/trace/blktrace.c:712
 blkdev_ioctl+0xc1/0x6c0 block/ioctl.c:613
 block_ioctl+0xf9/0x140 fs/block_dev.c:1987
 vfs_ioctl fs/ioctl.c:47 [inline]
 ksys_ioctl+0x11a/0x180 fs/ioctl.c:771
 __do_sys_ioctl fs/ioctl.c:780 [inline]
 __se_sys_ioctl fs/ioctl.c:778 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:778
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295
 entry_SYSCALL_64_after_hwframe+0x49/0xb3
RIP: 0033:0x45ca69
Code: 0d b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 db b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f553d9a0c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000004e1900 RCX: 000000000045ca69
RDX: 0000000020000080 RSI: 00000000c0481273 RDI: 0000000000000008
RBP: 000000000078bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 000000000000022a R14: 00000000004c4746 R15: 00007f553d9a16d4

Allocated by task 15483:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc mm/kasan/common.c:494 [inline]
 __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:467
 slab_post_alloc_hook mm/slab.h:586 [inline]
 slab_alloc mm/slab.c:3320 [inline]
 kmem_cache_alloc+0x11b/0x740 mm/slab.c:3484
 __d_alloc+0x2a/0x920 fs/dcache.c:1709
 d_alloc+0x4a/0x240 fs/dcache.c:1788
 d_alloc_parallel+0xe8/0x1b10 fs/dcache.c:2540
 __lookup_slow+0x193/0x490 fs/namei.c:1515
 lookup_one_len+0x163/0x190 fs/namei.c:2548
 start_creating+0x12b/0x250 fs/debugfs/inode.c:338
 __debugfs_create_file+0x62/0x400 fs/debugfs/inode.c:383
 do_blk_trace_setup+0x351/0xb30 kernel/trace/blktrace.c:524
 __blk_trace_setup+0xca/0x180 kernel/trace/blktrace.c:571
 blk_trace_ioctl+0x162/0x2b0 kernel/trace/blktrace.c:712
 blkdev_ioctl+0xc1/0x6c0 block/ioctl.c:613
 block_ioctl+0xf9/0x140 fs/block_dev.c:1987
 vfs_ioctl fs/ioctl.c:47 [inline]
 ksys_ioctl+0x11a/0x180 fs/ioctl.c:771
 __do_sys_ioctl fs/ioctl.c:780 [inline]
 __se_sys_ioctl fs/ioctl.c:778 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:778
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295
 entry_SYSCALL_64_after_hwframe+0x49/0xb3

Freed by task 6811:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 kasan_set_free_info mm/kasan/common.c:316 [inline]
 __kasan_slab_free+0xf7/0x140 mm/kasan/common.c:455
 __cache_free mm/slab.c:3426 [inline]
 kmem_cache_free+0x7f/0x320 mm/slab.c:3694
 rcu_do_batch kernel/rcu/tree.c:2396 [inline]
 rcu_core+0x59f/0x1370 kernel/rcu/tree.c:2623
 __do_softirq+0x26c/0x9f7 kernel/softirq.c:292

The buggy address belongs to the object at ffff8880862178a0
 which belongs to the cache dentry of size 304
The buggy address is located 160 bytes inside of
 304-byte region [ffff8880862178a0, ffff8880862179d0)
The buggy address belongs to the page:
page:ffffea00021885c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea0002185648 ffffea0002188648 ffff88821bc50540
raw: 0000000000000000 ffff888086217000 000000010000000b 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888086217800: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
 ffff888086217880: fc fc fc fc fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888086217900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                           ^
 ffff888086217980: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc
 ffff888086217a00: fc fc 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/06/04 20:45 upstream acf25aa66371 6720fdef .config console log report ci-upstream-kasan-gce-root
2020/04/26 18:46 upstream b2768df24ec4 0ce7569e .config console log report ci-upstream-kasan-gce
2020/03/25 13:42 upstream 76ccd234269b 41f049cc .config console log report ci-upstream-kasan-gce
2020/03/22 17:16 upstream b74b991fb8b9 78267cec .config console log report ci-upstream-kasan-gce-smack-root
2020/03/21 20:39 upstream 5ad0ec0b8652 4288d95e .config console log report ci-upstream-kasan-gce-smack-root
2020/02/26 03:02 upstream f8788d86ab28 59b57593 .config console log report ci-upstream-kasan-gce
2020/05/02 15:09 linux-next ac935d227366 58da4c35 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.