syzbot


linux-next test error: WARNING: held lock freed in kernfs_destroy_root

Status: auto-closed as invalid on 2022/01/12 23:56
Subsystems: kernfs
[Documentation on labels]
Reported-by: syzbot+9e5d9f74a10f9590610b@syzkaller.appspotmail.com
First crash: 880d, last: 872d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] linux-next test error: WARNING: held lock freed in kernfs_destroy_root 1 (2) 2021/11/28 19:19

Sample crash report:
cgroup: Unknown subsys name 'net'
=========================
WARNING: held lock freed!
5.16.0-rc3-next-20211203-syzkaller #0 Not tainted
-------------------------
syz-executor/6494 is freeing memory ffff88801872f800-ffff88801872f9ff, with a lock still held there!
ffff88801872f948 (&root->kernfs_rwsem){++++}-{3:3}, at: kernfs_remove fs/kernfs/dir.c:1396 [inline]
ffff88801872f948 (&root->kernfs_rwsem){++++}-{3:3}, at: kernfs_destroy_root+0x81/0xb0 fs/kernfs/dir.c:964
2 locks held by syz-executor/6494:
 #0: ffffffff8bbc4e48 (cgroup_mutex){+.+.}-{3:3}, at: cgroup_lock_and_drain_offline+0xa5/0x900 kernel/cgroup/cgroup.c:2998
 #1: ffff88801872f948 (&root->kernfs_rwsem){++++}-{3:3}, at: kernfs_remove fs/kernfs/dir.c:1396 [inline]
 #1: ffff88801872f948 (&root->kernfs_rwsem){++++}-{3:3}, at: kernfs_destroy_root+0x81/0xb0 fs/kernfs/dir.c:964

stack backtrace:
CPU: 1 PID: 6494 Comm: syz-executor Not tainted 5.16.0-rc3-next-20211203-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_freed_lock_bug kernel/locking/lockdep.c:6388 [inline]
 debug_check_no_locks_freed.cold+0x9d/0xa9 kernel/locking/lockdep.c:6421
 slab_free_hook mm/slub.c:1700 [inline]
 slab_free_freelist_hook+0x73/0x1c0 mm/slub.c:1754
 slab_free mm/slub.c:3510 [inline]
 kfree+0xd0/0x4b0 mm/slub.c:4561
 kernfs_put.part.0+0x331/0x540 fs/kernfs/dir.c:548
 kernfs_put+0x42/0x50 fs/kernfs/dir.c:513
 __kernfs_remove+0x7a3/0xb20 fs/kernfs/dir.c:1382
 kernfs_remove fs/kernfs/dir.c:1397 [inline]
 kernfs_destroy_root+0x89/0xb0 fs/kernfs/dir.c:964
 cgroup_setup_root+0x3a6/0xad0 kernel/cgroup/cgroup.c:2077
 cgroup1_root_to_use kernel/cgroup/cgroup-v1.c:1194 [inline]
 cgroup1_get_tree+0xd33/0x1390 kernel/cgroup/cgroup-v1.c:1211
 vfs_get_tree+0x89/0x2f0 fs/super.c:1500
 do_new_mount fs/namespace.c:3004 [inline]
 path_mount+0x1320/0x1fa0 fs/namespace.c:3334
 do_mount fs/namespace.c:3347 [inline]
 __do_sys_mount fs/namespace.c:3555 [inline]
 __se_sys_mount fs/namespace.c:3532 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3532
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f22e12cb01a
Code: 48 c7 c2 bc ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 b8 04 00 00 0f 1f 84 00 00 00 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff087bfc18 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fff087bfda8 RCX: 00007f22e12cb01a
RDX: 00007f22e132e051 RSI: 00007f22e1324324 RDI: 00007f22e1322dc9
RBP: 00007f22e1324324 R08: 00007f22e1324481 R09: 0000000000000026
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fff087bfc20
R13: 00007fff087bfdc8 R14: 00007fff087bfcf0 R15: 00007f22e132447b
 </TASK>
==================================================================
BUG: KASAN: use-after-free in __up_write kernel/locking/rwsem.c:1318 [inline]
BUG: KASAN: use-after-free in up_write+0x3ac/0x470 kernel/locking/rwsem.c:1576
Read of size 8 at addr ffff88801872f940 by task syz-executor/6494

CPU: 0 PID: 6494 Comm: syz-executor Not tainted 5.16.0-rc3-next-20211203-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description.constprop.0.cold+0xa5/0x3ed mm/kasan/report.c:255
 __kasan_report mm/kasan/report.c:442 [inline]
 kasan_report.cold+0x83/0xdf mm/kasan/report.c:459
 __up_write kernel/locking/rwsem.c:1318 [inline]
 up_write+0x3ac/0x470 kernel/locking/rwsem.c:1576
 cgroup_setup_root+0x3a6/0xad0 kernel/cgroup/cgroup.c:2077
 cgroup1_root_to_use kernel/cgroup/cgroup-v1.c:1194 [inline]
 cgroup1_get_tree+0xd33/0x1390 kernel/cgroup/cgroup-v1.c:1211
 vfs_get_tree+0x89/0x2f0 fs/super.c:1500
 do_new_mount fs/namespace.c:3004 [inline]
 path_mount+0x1320/0x1fa0 fs/namespace.c:3334
 do_mount fs/namespace.c:3347 [inline]
 __do_sys_mount fs/namespace.c:3555 [inline]
 __se_sys_mount fs/namespace.c:3532 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3532
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f22e12cb01a
Code: 48 c7 c2 bc ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 b8 04 00 00 0f 1f 84 00 00 00 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff087bfc18 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fff087bfda8 RCX: 00007f22e12cb01a
RDX: 00007f22e132e051 RSI: 00007f22e1324324 RDI: 00007f22e1322dc9
RBP: 00007f22e1324324 R08: 00007f22e1324481 R09: 0000000000000026
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fff087bfc20
R13: 00007fff087bfdc8 R14: 00007fff087bfcf0 R15: 00007f22e132447b
 </TASK>

Allocated by task 6494:
 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:436 [inline]
 ____kasan_kmalloc mm/kasan/common.c:515 [inline]
 ____kasan_kmalloc mm/kasan/common.c:474 [inline]
 __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:524
 kmalloc include/linux/slab.h:581 [inline]
 kzalloc include/linux/slab.h:715 [inline]
 kernfs_create_root+0x4c/0x410 fs/kernfs/dir.c:913
 cgroup_setup_root+0x243/0xad0 kernel/cgroup/cgroup.c:2018
 cgroup1_root_to_use kernel/cgroup/cgroup-v1.c:1194 [inline]
 cgroup1_get_tree+0xd33/0x1390 kernel/cgroup/cgroup-v1.c:1211
 vfs_get_tree+0x89/0x2f0 fs/super.c:1500
 do_new_mount fs/namespace.c:3004 [inline]
 path_mount+0x1320/0x1fa0 fs/namespace.c:3334
 do_mount fs/namespace.c:3347 [inline]
 __do_sys_mount fs/namespace.c:3555 [inline]
 __se_sys_mount fs/namespace.c:3532 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3532
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 6494:
 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
 kasan_set_track+0x21/0x30 mm/kasan/common.c:45
 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370
 ____kasan_slab_free mm/kasan/common.c:366 [inline]
 ____kasan_slab_free+0x166/0x1a0 mm/kasan/common.c:328
 kasan_slab_free include/linux/kasan.h:236 [inline]
 slab_free_hook mm/slub.c:1728 [inline]
 slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1754
 slab_free mm/slub.c:3510 [inline]
 kfree+0xd0/0x4b0 mm/slub.c:4561
 kernfs_put.part.0+0x331/0x540 fs/kernfs/dir.c:548
 kernfs_put+0x42/0x50 fs/kernfs/dir.c:513
 __kernfs_remove+0x7a3/0xb20 fs/kernfs/dir.c:1382
 kernfs_remove fs/kernfs/dir.c:1397 [inline]
 kernfs_destroy_root+0x89/0xb0 fs/kernfs/dir.c:964
 cgroup_setup_root+0x3a6/0xad0 kernel/cgroup/cgroup.c:2077
 cgroup1_root_to_use kernel/cgroup/cgroup-v1.c:1194 [inline]
 cgroup1_get_tree+0xd33/0x1390 kernel/cgroup/cgroup-v1.c:1211
 vfs_get_tree+0x89/0x2f0 fs/super.c:1500
 do_new_mount fs/namespace.c:3004 [inline]
 path_mount+0x1320/0x1fa0 fs/namespace.c:3334
 do_mount fs/namespace.c:3347 [inline]
 __do_sys_mount fs/namespace.c:3555 [inline]
 __se_sys_mount fs/namespace.c:3532 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3532
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

The buggy address belongs to the object at ffff88801872f800
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 320 bytes inside of
 512-byte region [ffff88801872f800, ffff88801872fa00)
The buggy address belongs to the page:
page:ffffea000061cb00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1872c
head:ffffea000061cb00 order:2 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea00008af700 dead000000000002 ffff888010c41c80
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 243, ts 7525668115, free_ts 0
 prep_new_page mm/page_alloc.c:2433 [inline]
 get_page_from_freelist+0xa72/0x2f40 mm/page_alloc.c:4164
 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5376
 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2271
 alloc_slab_page mm/slub.c:1799 [inline]
 allocate_slab mm/slub.c:1944 [inline]
 new_slab+0x28d/0x3a0 mm/slub.c:2004
 ___slab_alloc+0x6be/0xd60 mm/slub.c:3019
 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3106
 slab_alloc_node mm/slub.c:3197 [inline]
 slab_alloc mm/slub.c:3239 [inline]
 kmem_cache_alloc_trace+0x289/0x2c0 mm/slub.c:3256
 kmalloc include/linux/slab.h:581 [inline]
 kzalloc include/linux/slab.h:715 [inline]
 alloc_bprm+0x51/0x8f0 fs/exec.c:1505
 kernel_execve+0x55/0x460 fs/exec.c:1945
 call_usermodehelper_exec_async+0x2e3/0x580 kernel/umh.c:112
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88801872f800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88801872f880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88801872f900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                           ^
 ffff88801872f980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88801872fa00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (36):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/12/03 23:55 linux-next 7afeac307a95 a617004c .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/03 23:55 linux-next 7afeac307a95 a617004c .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/03 23:55 linux-next 7afeac307a95 a617004c .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/03 12:02 linux-next 7afeac307a95 c7c20675 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/03 12:02 linux-next 7afeac307a95 c7c20675 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/03 12:02 linux-next 7afeac307a95 c7c20675 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/03 08:48 linux-next 7afeac307a95 61f86278 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/03 08:48 linux-next 7afeac307a95 61f86278 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/03 08:48 linux-next 7afeac307a95 61f86278 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/02 07:08 linux-next 9606f9efb1ce 61f86278 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/02 07:08 linux-next 9606f9efb1ce 61f86278 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/02 07:08 linux-next 9606f9efb1ce 61f86278 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/01 21:45 linux-next 048aeae86c39 61f86278 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/01 21:45 linux-next 048aeae86c39 61f86278 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/01 21:45 linux-next 048aeae86c39 61f86278 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/01 08:31 linux-next 048aeae86c39 5fa3eacc .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/01 08:31 linux-next 048aeae86c39 5fa3eacc .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/01 08:31 linux-next 048aeae86c39 5fa3eacc .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/01 06:05 linux-next 048aeae86c39 80270552 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/01 06:05 linux-next 048aeae86c39 80270552 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/12/01 06:05 linux-next 048aeae86c39 80270552 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/11/30 11:13 linux-next 34f255a1e91a 80270552 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/11/30 11:13 linux-next 34f255a1e91a 80270552 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/11/30 11:13 linux-next 34f255a1e91a 80270552 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/11/30 08:01 linux-next 34f255a1e91a d0830353 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/11/30 08:01 linux-next 34f255a1e91a d0830353 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/11/30 08:01 linux-next 34f255a1e91a d0830353 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/11/29 15:17 linux-next 92f408043621 d0830353 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/11/29 15:17 linux-next 92f408043621 d0830353 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/11/29 15:17 linux-next 92f408043621 d0830353 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/11/29 08:03 linux-next 92f408043621 63eeac02 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/11/29 08:03 linux-next 92f408043621 63eeac02 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/11/29 08:03 linux-next 92f408043621 63eeac02 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/11/26 05:43 linux-next f30a24ed97b4 63eeac02 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/11/26 05:43 linux-next f30a24ed97b4 63eeac02 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
2021/11/26 05:43 linux-next f30a24ed97b4 63eeac02 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next test error: WARNING: held lock freed in kernfs_destroy_root
* Struck through repros no longer work on HEAD.