================================================================== BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline] BUG: KASAN: use-after-free in atomic_fetch_add_relaxed include/asm-generic/atomic-instrumented.h:142 [inline] BUG: KASAN: use-after-free in __refcount_add include/linux/refcount.h:193 [inline] BUG: KASAN: use-after-free in __refcount_inc include/linux/refcount.h:250 [inline] BUG: KASAN: use-after-free in refcount_inc include/linux/refcount.h:267 [inline] BUG: KASAN: use-after-free in get_task_struct include/linux/sched/task.h:104 [inline] BUG: KASAN: use-after-free in kthread_stop+0x76/0x610 kernel/kthread.c:616 Write of size 4 at addr ffff88801e29e520 by task syz-executor.1/23562 CPU: 1 PID: 23562 Comm: syz-executor.1 Not tainted 5.10.52 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x107/0x163 lib/dump_stack.c:118 print_address_description.constprop.0+0x1c/0x210 mm/kasan/report.c:385 __kasan_report mm/kasan/report.c:545 [inline] kasan_report.cold+0x37/0x7c mm/kasan/report.c:562 check_memory_region_inline mm/kasan/generic.c:186 [inline] check_memory_region+0xf9/0x1e0 mm/kasan/generic.c:192 instrument_atomic_read_write include/linux/instrumented.h:101 [inline] atomic_fetch_add_relaxed include/asm-generic/atomic-instrumented.h:142 [inline] __refcount_add include/linux/refcount.h:193 [inline] __refcount_inc include/linux/refcount.h:250 [inline] refcount_inc include/linux/refcount.h:267 [inline] get_task_struct include/linux/sched/task.h:104 [inline] kthread_stop+0x76/0x610 kernel/kthread.c:616 ext4_stop_mmpd+0x47/0xd0 fs/ext4/mmp.c:254 ext4_put_super+0x87c/0xf90 fs/ext4/super.c:1263 generic_shutdown_super+0x142/0x370 fs/super.c:464 kill_block_super+0x9d/0xf0 fs/super.c:1446 deactivate_locked_super+0x99/0x160 fs/super.c:335 deactivate_super+0xad/0xd0 fs/super.c:366 cleanup_mnt+0x396/0x500 fs/namespace.c:1118 task_work_run+0xe2/0x1a0 kernel/task_work.c:151 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop kernel/entry/common.c:164 [inline] exit_to_user_mode_prepare+0x155/0x160 kernel/entry/common.c:191 syscall_exit_to_user_mode+0x38/0x230 kernel/entry/common.c:266 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x467a67 Code: ff d0 48 89 c7 b8 3c 00 00 00 0f 05 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 b8 a6 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:00007ffc87e5b318 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 0000000000000196 RCX: 0000000000467a67 RDX: 00007ffc87e5b3eb RSI: 0000000000000002 RDI: 00007ffc87e5b3e0 RBP: 00007ffc87e5b3e0 R08: 00000000ffffffff R09: 00007ffc87e5b1b0 R10: 00000000033fbb43 R11: 0000000000000246 R12: 00000000004bee70 R13: 00007ffc87e5c4b0 R14: 00000000033fbb00 R15: 00007ffc87e5c4f0 Allocated by task 2: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_set_track mm/kasan/common.c:56 [inline] __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:461 slab_post_alloc_hook mm/slab.h:532 [inline] slab_alloc_node mm/slub.c:2889 [inline] kmem_cache_alloc_node+0x14b/0x370 mm/slub.c:2925 alloc_task_struct_node kernel/fork.c:170 [inline] dup_task_struct kernel/fork.c:860 [inline] copy_process+0x4380/0x6650 kernel/fork.c:1947 kernel_clone+0xe7/0xa20 kernel/fork.c:2465 kernel_thread+0xb5/0xf0 kernel/fork.c:2517 create_kthread kernel/kthread.c:315 [inline] kthreadd+0x4bb/0x710 kernel/kthread.c:658 ret_from_fork+0x22/0x30 arch/x86/entry/entry_64.S:296 Freed by task 29834: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_set_track+0x1c/0x30 mm/kasan/common.c:56 kasan_set_free_info+0x1b/0x30 mm/kasan/generic.c:355 __kasan_slab_free+0x110/0x150 mm/kasan/common.c:422 slab_free_hook mm/slub.c:1542 [inline] slab_free_freelist_hook+0x64/0x150 mm/slub.c:1575 slab_free mm/slub.c:3140 [inline] kmem_cache_free+0x97/0x2f0 mm/slub.c:3156 __put_task_struct+0x25a/0x3e0 kernel/fork.c:741 put_task_struct include/linux/sched/task.h:113 [inline] delayed_put_task_struct+0x1a4/0x2b0 kernel/exit.c:173 rcu_do_batch kernel/rcu/tree.c:2484 [inline] rcu_core+0x52d/0x1660 kernel/rcu/tree.c:2719 __do_softirq+0x1b8/0x867 kernel/softirq.c:298 Last call_rcu(): kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_record_aux_stack+0x9e/0xb0 mm/kasan/generic.c:346 __call_rcu kernel/rcu/tree.c:2960 [inline] call_rcu+0x8a/0xa20 kernel/rcu/tree.c:3034 put_task_struct_rcu_user+0x7f/0xb0 kernel/exit.c:179 finish_task_switch+0x428/0x5d0 kernel/sched/core.c:3649 context_switch kernel/sched/core.c:3779 [inline] __schedule+0x850/0x1e80 kernel/sched/core.c:4525 schedule+0xcb/0x270 kernel/sched/core.c:4603 freezable_schedule include/linux/freezer.h:172 [inline] do_nanosleep+0x1b1/0x670 kernel/time/hrtimer.c:1896 hrtimer_nanosleep+0x25c/0x670 kernel/time/hrtimer.c:1949 common_nsleep+0xa2/0xc0 kernel/time/posix-timers.c:1227 __do_sys_clock_nanosleep kernel/time/posix-timers.c:1267 [inline] __se_sys_clock_nanosleep kernel/time/posix-timers.c:1245 [inline] __x64_sys_clock_nanosleep+0x2fb/0x420 kernel/time/posix-timers.c:1245 do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Second to last call_rcu(): kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_record_aux_stack+0x9e/0xb0 mm/kasan/generic.c:346 __call_rcu kernel/rcu/tree.c:2960 [inline] call_rcu+0x8a/0xa20 kernel/rcu/tree.c:3034 put_task_struct_rcu_user+0x7f/0xb0 kernel/exit.c:179 wait_task_zombie kernel/exit.c:1093 [inline] wait_consider_task+0x2f21/0x3b70 kernel/exit.c:1320 do_wait_thread kernel/exit.c:1383 [inline] do_wait+0x350/0x900 kernel/exit.c:1454 kernel_wait4+0x14c/0x260 kernel/exit.c:1616 __do_sys_wait4+0x13f/0x150 kernel/exit.c:1644 do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff88801e29e500 which belongs to the cache task_struct of size 6208 The buggy address is located 32 bytes inside of 6208-byte region [ffff88801e29e500, ffff88801e29fd40) The buggy address belongs to the page: page:00000000d9e2f79a refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1e298 head:00000000d9e2f79a order:3 compound_mapcount:0 compound_pincount:0 flags: 0x100000000010200(slab|head) raw: 0100000000010200 0000000000000000 0000000300000001 ffff888007fdc140 raw: 0000000000000000 0000000000050005 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88801e29e400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88801e29e480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88801e29e500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88801e29e580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801e29e600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ------------[ cut here ]------------ refcount_t: addition on 0; use-after-free. WARNING: CPU: 1 PID: 23562 at lib/refcount.c:25 refcount_warn_saturate+0x178/0x1f0 lib/refcount.c:25 Modules linked in: CPU: 1 PID: 23562 Comm: syz-executor.1 Tainted: G B 5.10.52 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 RIP: 0010:refcount_warn_saturate+0x178/0x1f0 lib/refcount.c:25 Code: 03 31 ff 89 de e8 58 22 51 ff 84 db 0f 85 2e ff ff ff e8 1b 29 51 ff 48 c7 c7 c0 37 3b 84 c6 05 3e 63 54 03 01 e8 57 0c c9 01 <0f> 0b e9 0f ff ff ff e8 fc 28 51 ff 0f b6 1d 28 63 54 03 31 ff 89 RSP: 0018:ffff888032d17d38 EFLAGS: 00010286 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: ffff888015cbe500 RSI: ffffffff81293053 RDI: ffffed10065a2f99 RBP: ffff88801e29e520 R08: 0000000000000001 R09: ffff88806cf2facf R10: 0000000000000000 R11: 0000000000000001 R12: ffff88801e29e520 R13: ffff888035bea848 R14: 0000000000000000 R15: ffff888035bea438 FS: 00000000033fa400(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffc87e5abd8 CR3: 000000003159a000 CR4: 0000000000350ee0 Call Trace: __refcount_add include/linux/refcount.h:199 [inline] __refcount_inc include/linux/refcount.h:250 [inline] refcount_inc include/linux/refcount.h:267 [inline] get_task_struct include/linux/sched/task.h:104 [inline] kthread_stop+0x583/0x610 kernel/kthread.c:616 ext4_stop_mmpd+0x47/0xd0 fs/ext4/mmp.c:254 ext4_put_super+0x87c/0xf90 fs/ext4/super.c:1263 generic_shutdown_super+0x142/0x370 fs/super.c:464 kill_block_super+0x9d/0xf0 fs/super.c:1446 deactivate_locked_super+0x99/0x160 fs/super.c:335 deactivate_super+0xad/0xd0 fs/super.c:366 cleanup_mnt+0x396/0x500 fs/namespace.c:1118 task_work_run+0xe2/0x1a0 kernel/task_work.c:151 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop kernel/entry/common.c:164 [inline] exit_to_user_mode_prepare+0x155/0x160 kernel/entry/common.c:191 syscall_exit_to_user_mode+0x38/0x230 kernel/entry/common.c:266 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x467a67 Code: ff d0 48 89 c7 b8 3c 00 00 00 0f 05 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 b8 a6 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:00007ffc87e5b318 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 0000000000000196 RCX: 0000000000467a67 RDX: 00007ffc87e5b3eb RSI: 0000000000000002 RDI: 00007ffc87e5b3e0 RBP: 00007ffc87e5b3e0 R08: 00000000ffffffff R09: 00007ffc87e5b1b0 R10: 00000000033fbb43 R11: 0000000000000246 R12: 00000000004bee70 R13: 00007ffc87e5c4b0 R14: 00000000033fbb00 R15: 00007ffc87e5c4f0 irq event stamp: 1895560 hardirqs last enabled at (1895559): [] quarantine_put+0x87/0x1a0 mm/kasan/quarantine.c:217 hardirqs last disabled at (1895560): [] __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:108 [inline] hardirqs last disabled at (1895560): [] _raw_spin_lock_irqsave+0x4b/0x50 kernel/locking/spinlock.c:159 softirqs last enabled at (1894896): [] asm_call_irq_on_stack+0x12/0x20 softirqs last disabled at (1894797): [] asm_call_irq_on_stack+0x12/0x20 ---[ end trace f7111880d711ef57 ]--- general protection fault, probably for non-canonical address 0x748affff888046b3: 0000 [#1] SMP KASAN NOPTI CPU: 1 PID: 29857 Comm: syz-executor.0 Tainted: G B W 5.10.52 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 RIP: 0010:qlist_move_cache+0x61/0xe0 mm/kasan/quarantine.c:283 Code: eb 25 48 83 3f 00 0f 84 83 00 00 00 48 8b 47 08 48 89 10 48 89 57 08 48 c7 02 00 00 00 00 48 01 77 10 48 85 c9 74 66 48 89 ca <48> 8b 09 48 89 d0 4c 01 c0 72 68 4c 89 de 48 2b 35 2a 58 3a 03 48 RSP: 0018:ffff88803407fb70 EFLAGS: 00010002 RAX: ffff88804796b800 RBX: ffffea000078a600 RCX: 748affff888046b3 RDX: 748affff888046b3 RSI: 0000000000001940 RDI: ffffffff86898be0 RBP: 0000000000000246 R08: 0000000080000000 R09: ffff88803407fb80 R10: ffff888039793a00 R11: ffffffff80000000 R12: ffff888039793a00 R13: ffff88803407fc30 R14: dffffc0000000000 R15: 0000000000000000 FS: 00007f64c5b38700(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000002fa5b38 CR3: 0000000034154000 CR4: 0000000000350ee0 Call Trace: quarantine_remove_cache+0x6c/0xe0 mm/kasan/quarantine.c:325 shutdown_cache mm/slab_common.c:448 [inline] kmem_cache_destroy+0x42/0xe0 mm/slab_common.c:496 p9_client_destroy+0x221/0x370 net/9p/client.c:1097 v9fs_session_close+0x41/0x1c0 fs/9p/v9fs.c:498 v9fs_kill_super+0x49/0x90 fs/9p/vfs_super.c:224 deactivate_locked_super+0x99/0x160 fs/super.c:335 v9fs_mount+0x728/0x8f0 fs/9p/vfs_super.c:205 legacy_get_tree+0x105/0x220 fs/fs_context.c:592 vfs_get_tree+0x8e/0x2f0 fs/super.c:1549 do_new_mount fs/namespace.c:2881 [inline] path_mount+0x139a/0x2080 fs/namespace.c:3211 do_mount fs/namespace.c:3224 [inline] __do_sys_mount fs/namespace.c:3432 [inline] __se_sys_mount fs/namespace.c:3409 [inline] __x64_sys_mount+0x27e/0x300 fs/namespace.c:3409 do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x466609 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f64c5b38188 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 0000000000466609 RDX: 00000000200000c0 RSI: 0000000020000040 RDI: 0000000000000000 RBP: 00000000004bfcb9 R08: 0000000020000200 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80 R13: 00007fff7695626f R14: 00007f64c5b38300 R15: 0000000000022000 Modules linked in: ---[ end trace f7111880d711ef58 ]--- RIP: 0010:qlist_move_cache+0x61/0xe0 mm/kasan/quarantine.c:283 Code: eb 25 48 83 3f 00 0f 84 83 00 00 00 48 8b 47 08 48 89 10 48 89 57 08 48 c7 02 00 00 00 00 48 01 77 10 48 85 c9 74 66 48 89 ca <48> 8b 09 48 89 d0 4c 01 c0 72 68 4c 89 de 48 2b 35 2a 58 3a 03 48 RSP: 0018:ffff88803407fb70 EFLAGS: 00010002 RAX: ffff88804796b800 RBX: ffffea000078a600 RCX: 748affff888046b3 RDX: 748affff888046b3 RSI: 0000000000001940 RDI: ffffffff86898be0 RBP: 0000000000000246 R08: 0000000080000000 R09: ffff88803407fb80 R10: ffff888039793a00 R11: ffffffff80000000 R12: ffff888039793a00 R13: ffff88803407fc30 R14: dffffc0000000000 R15: 0000000000000000 FS: 00007f64c5b38700(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000002fa5b38 CR3: 0000000034154000 CR4: 0000000000350ee0 note: syz-executor.0[29857] exited with preempt_count 1 BUG: sleeping function called from invalid context at include/linux/percpu-rwsem.h:49 in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 29857, name: syz-executor.0 INFO: lockdep is turned off. irq event stamp: 0 hardirqs last enabled at (0): [<0000000000000000>] 0x0 hardirqs last disabled at (0): [] copy_process+0x15bc/0x6650 kernel/fork.c:2049 softirqs last enabled at (0): [] copy_process+0x15fd/0x6650 kernel/fork.c:2053 softirqs last disabled at (0): [<0000000000000000>] 0x0 CPU: 1 PID: 29857 Comm: syz-executor.0 Tainted: G B D W 5.10.52 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x107/0x163 lib/dump_stack.c:118 ___might_sleep.cold+0x141/0x16f kernel/sched/core.c:7297 percpu_down_read include/linux/percpu-rwsem.h:49 [inline] cgroup_threadgroup_change_begin include/linux/cgroup-defs.h:733 [inline] exit_signals+0x23/0x850 kernel/signal.c:2843 do_exit+0x30a/0x2770 kernel/exit.c:767 rewind_stack_do_exit+0x17/0x20 arch/x86/entry/entry_64.S:1483 RIP: 0033:0x466609 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f64c5b38188 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 0000000000466609 RDX: 00000000200000c0 RSI: 0000000020000040 RDI: 0000000000000000 RBP: 00000000004bfcb9 R08: 0000000020000200 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80 R13: 00007fff7695626f R14: 00007f64c5b38300 R15: 0000000000022000