================================================================== 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+0x25/0x330 kernel/kthread.c:616 Write of size 4 at addr ffff88811d828f20 by task syz-executor.4/416 CPU: 0 PID: 416 Comm: syz-executor.4 Not tainted 5.10.50-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+0x84/0xad lib/dump_stack.c:118 print_address_description.constprop.0+0x21/0x220 mm/kasan/report.c:385 __kasan_report mm/kasan/report.c:545 [inline] kasan_report.cold+0x20/0x37 mm/kasan/report.c:562 check_memory_region_inline mm/kasan/generic.c:186 [inline] check_memory_region+0x148/0x190 mm/kasan/generic.c:192 __kasan_check_write+0x14/0x20 mm/kasan/common.c:77 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+0x25/0x330 kernel/kthread.c:616 ext4_stop_mmpd+0x39/0xb0 fs/ext4/mmp.c:254 ext4_put_super+0x70d/0xc80 fs/ext4/super.c:1263 generic_shutdown_super+0x12d/0x330 fs/super.c:464 kill_block_super+0x97/0xe0 fs/super.c:1446 deactivate_locked_super+0x8b/0x130 fs/super.c:335 deactivate_super+0x71/0x80 fs/super.c:366 cleanup_mnt+0x33a/0x4e0 fs/namespace.c:1118 __cleanup_mnt+0xd/0x10 fs/namespace.c:1125 task_work_run+0xc2/0x140 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+0xd9/0xe0 kernel/entry/common.c:191 syscall_exit_to_user_mode+0x27/0x160 kernel/entry/common.c:266 do_syscall_64+0x3f/0x80 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f0f8ad5cea7 Code: ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 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:00007ffde5617ba8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f0f8ad5cea7 RDX: 00007ffde5617c7a RSI: 0000000000000002 RDI: 00007ffde5617c70 RBP: 00007ffde5617c70 R08: 00000000ffffffff R09: 00007ffde5617a40 R10: 000055555648db83 R11: 0000000000000246 R12: 00007f0f8adb5035 R13: 00007ffde5618d30 R14: 000055555648db00 R15: 00007ffde5618d70 Allocated by task 2: kasan_save_stack+0x23/0x50 mm/kasan/common.c:48 kasan_set_track mm/kasan/common.c:56 [inline] __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:461 kasan_slab_alloc+0xe/0x10 mm/kasan/common.c:469 slab_post_alloc_hook mm/slab.h:532 [inline] slab_alloc_node mm/slub.c:2889 [inline] slab_alloc mm/slub.c:2897 [inline] kmem_cache_alloc+0x154/0x490 mm/slub.c:2902 kmem_cache_alloc_node include/linux/slab.h:423 [inline] alloc_task_struct_node kernel/fork.c:170 [inline] dup_task_struct kernel/fork.c:860 [inline] copy_process+0x45e/0x5e30 kernel/fork.c:1947 kernel_clone+0xc1/0x890 kernel/fork.c:2465 kernel_thread+0xba/0xf0 kernel/fork.c:2517 create_kthread kernel/kthread.c:315 [inline] kthreadd+0x353/0x4e0 kernel/kthread.c:658 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296 Freed by task 0: kasan_save_stack+0x23/0x50 mm/kasan/common.c:48 kasan_set_track+0x20/0x30 mm/kasan/common.c:56 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:355 __kasan_slab_free+0x117/0x170 mm/kasan/common.c:422 kasan_slab_free+0xe/0x10 mm/kasan/common.c:431 slab_free_hook mm/slub.c:1542 [inline] slab_free_freelist_hook+0x6d/0x120 mm/slub.c:1575 slab_free mm/slub.c:3140 [inline] kmem_cache_free+0xfe/0x450 mm/slub.c:3156 free_task_struct kernel/fork.c:175 [inline] free_task+0x9b/0xc0 kernel/fork.c:464 __put_task_struct+0x1ef/0x4b0 kernel/fork.c:741 put_task_struct include/linux/sched/task.h:113 [inline] delayed_put_task_struct+0xfb/0x130 kernel/exit.c:173 rcu_do_batch+0x3d7/0xac0 kernel/rcu/tree.c:2484 rcu_core+0x46a/0xaa0 kernel/rcu/tree.c:2719 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2732 __do_softirq+0x1b2/0x653 kernel/softirq.c:298 Last call_rcu(): kasan_save_stack+0x23/0x50 mm/kasan/common.c:48 kasan_record_aux_stack+0xb1/0xc0 mm/kasan/generic.c:346 __call_rcu kernel/rcu/tree.c:2960 [inline] call_rcu+0xf7/0x1310 kernel/rcu/tree.c:3034 put_task_struct_rcu_user+0x48/0x60 kernel/exit.c:179 finish_task_switch+0x4ee/0x720 kernel/sched/core.c:3649 context_switch kernel/sched/core.c:3779 [inline] __schedule+0x6e7/0x1890 kernel/sched/core.c:4525 schedule+0xdb/0x280 kernel/sched/core.c:4603 kthread_worker_fn+0x3bc/0x640 kernel/kthread.c:735 loop_kthread_worker_fn+0x4c/0x60 drivers/block/loop.c:938 kthread+0x345/0x420 kernel/kthread.c:292 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296 The buggy address belongs to the object at ffff88811d828f00 which belongs to the cache task_struct of size 3712 The buggy address is located 32 bytes inside of 3712-byte region [ffff88811d828f00, ffff88811d829d80) The buggy address belongs to the page: page:0000000070272a95 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11d828 head:0000000070272a95 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 dead000000000100 dead000000000122 ffff888100131780 raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL) set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook mm/page_alloc.c:2279 [inline] prep_new_page+0xf6/0x140 mm/page_alloc.c:2285 get_page_from_freelist+0x2f3a/0x5100 mm/page_alloc.c:3909 __alloc_pages_nodemask+0x26c/0x5d0 mm/page_alloc.c:4951 __alloc_pages include/linux/gfp.h:511 [inline] __alloc_pages_node include/linux/gfp.h:524 [inline] alloc_pages_node include/linux/gfp.h:538 [inline] alloc_pages include/linux/gfp.h:557 [inline] alloc_slab_page mm/slub.c:1613 [inline] allocate_slab+0x327/0x460 mm/slub.c:1756 new_slab mm/slub.c:1817 [inline] new_slab_objects mm/slub.c:2576 [inline] ___slab_alloc.constprop.0+0x339/0x750 mm/slub.c:2739 __slab_alloc mm/slub.c:2779 [inline] slab_alloc_node mm/slub.c:2854 [inline] slab_alloc mm/slub.c:2897 [inline] kmem_cache_alloc+0x43b/0x490 mm/slub.c:2902 kmem_cache_alloc_node include/linux/slab.h:423 [inline] alloc_task_struct_node kernel/fork.c:170 [inline] dup_task_struct kernel/fork.c:860 [inline] copy_process+0x45e/0x5e30 kernel/fork.c:1947 kernel_clone+0xc1/0x890 kernel/fork.c:2465 kernel_thread+0xba/0xf0 kernel/fork.c:2517 create_kthread kernel/kthread.c:315 [inline] kthreadd+0x353/0x4e0 kernel/kthread.c:658 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1258 [inline] __free_pages_ok+0x3ee/0x7a0 mm/page_alloc.c:1521 free_the_page mm/page_alloc.c:5012 [inline] __free_pages+0xab/0xd0 mm/page_alloc.c:5018 __free_slab+0xdd/0x1d0 mm/slub.c:1842 free_slab mm/slub.c:1857 [inline] discard_slab+0x2b/0x40 mm/slub.c:1863 unfreeze_partials+0x1e1/0x240 mm/slub.c:2357 put_cpu_partial+0xdb/0x160 mm/slub.c:2393 __slab_free+0x3a9/0x530 mm/slub.c:3034 do_slab_free mm/slub.c:3128 [inline] ___cache_free+0x235/0x280 mm/slub.c:3147 qlink_free mm/kasan/quarantine.c:151 [inline] qlist_free_all+0x5a/0xd0 mm/kasan/quarantine.c:170 quarantine_reduce+0x15f/0x1d0 mm/kasan/quarantine.c:267 __kasan_kmalloc.constprop.0+0xa3/0xe0 mm/kasan/common.c:442 kasan_slab_alloc+0xe/0x10 mm/kasan/common.c:469 slab_post_alloc_hook mm/slab.h:532 [inline] slab_alloc_node mm/slub.c:2889 [inline] slab_alloc mm/slub.c:2897 [inline] kmem_cache_alloc_trace+0x15e/0x490 mm/slub.c:2914 kmalloc include/linux/slab.h:552 [inline] kzalloc include/linux/slab.h:664 [inline] kobject_uevent_env+0x1c3/0x1070 lib/kobject_uevent.c:524 kobject_uevent+0xb/0x10 lib/kobject_uevent.c:642 __loop_clr_fd+0x5fa/0xe90 drivers/block/loop.c:1261 Memory state around the buggy address: ffff88811d828e00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88811d828e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88811d828f00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88811d828f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88811d829000: 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: 416 at lib/refcount.c:25 refcount_warn_saturate+0xe7/0x140 lib/refcount.c:25 Modules linked in: CPU: 1 PID: 416 Comm: syz-executor.4 Tainted: G B 5.10.50-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:refcount_warn_saturate+0xe7/0x140 lib/refcount.c:25 Code: f8 df ab 03 01 e8 8d af cf 01 0f 0b eb 9b 80 3d e7 df ab 03 00 75 92 48 c7 c7 80 90 9e 84 c6 05 d7 df ab 03 01 e8 6d af cf 01 <0f> 0b e9 78 ff ff ff 80 3d c1 df ab 03 00 0f 85 6b ff ff ff 48 c7 RSP: 0018:ffffc900008c7ce0 EFLAGS: 00010286 RAX: 0000000000000000 RBX: ffff88811d828f20 RCX: 0000000000000000 RDX: 0000000000000001 RSI: ffffffff849eae60 RDI: fffff52000118f8e RBP: ffffc900008c7cf0 R08: 0000000000000001 R09: ffff8881f734ae67 R10: ffffed103ee695cc R11: 746e756f63666572 R12: 0000000000000002 R13: ffff88811d828f20 R14: 0000000000000000 R15: ffff88811d705278 FS: 000055555648c400(0000) GS:ffff8881f7200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fffdf6a6ca8 CR3: 0000000117bc6000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 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+0x2c6/0x330 kernel/kthread.c:616 ext4_stop_mmpd+0x39/0xb0 fs/ext4/mmp.c:254 ext4_put_super+0x70d/0xc80 fs/ext4/super.c:1263 generic_shutdown_super+0x12d/0x330 fs/super.c:464 kill_block_super+0x97/0xe0 fs/super.c:1446 deactivate_locked_super+0x8b/0x130 fs/super.c:335 deactivate_super+0x71/0x80 fs/super.c:366 cleanup_mnt+0x33a/0x4e0 fs/namespace.c:1118 __cleanup_mnt+0xd/0x10 fs/namespace.c:1125 task_work_run+0xc2/0x140 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+0xd9/0xe0 kernel/entry/common.c:191 syscall_exit_to_user_mode+0x27/0x160 kernel/entry/common.c:266 do_syscall_64+0x3f/0x80 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f0f8ad5cea7 Code: ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 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:00007ffde5617ba8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f0f8ad5cea7 RDX: 00007ffde5617c7a RSI: 0000000000000002 RDI: 00007ffde5617c70 RBP: 00007ffde5617c70 R08: 00000000ffffffff R09: 00007ffde5617a40 R10: 000055555648db83 R11: 0000000000000246 R12: 00007f0f8adb5035 R13: 00007ffde5618d30 R14: 000055555648db00 R15: 00007ffde5618d70 ---[ end trace 7fef31c98e9ae4d0 ]--- ------------[ cut here ]------------ refcount_t: underflow; use-after-free. WARNING: CPU: 0 PID: 416 at lib/refcount.c:28 refcount_warn_saturate+0x135/0x140 lib/refcount.c:28 Modules linked in: CPU: 0 PID: 416 Comm: syz-executor.4 Tainted: G B W 5.10.50-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:refcount_warn_saturate+0x135/0x140 lib/refcount.c:28 Code: af cf 01 0f 0b e9 51 ff ff ff 48 89 df e8 43 1a 71 ff e9 1f ff ff ff 48 c7 c7 e0 90 9e 84 c6 05 88 df ab 03 01 e8 1f af cf 01 <0f> 0b e9 2a ff ff ff 0f 1f 40 00 55 be 04 00 00 00 48 89 e5 41 57 RSP: 0018:ffffc900008c7ce0 EFLAGS: 00010286 RAX: 0000000000000000 RBX: ffff88811d828f20 RCX: 0000000000000000 RDX: 0000000000000001 RSI: 0000000000000008 RDI: fffff52000118f8e RBP: ffffc900008c7cf0 R08: 0000000000000000 R09: ffffc900008c78ef R10: fffff52000118f1d R11: 0000000063666572 R12: 0000000000000003 R13: ffff88811d828f20 R14: 0000000000000000 R15: ffff88811d705278 FS: 000055555648c400(0000) GS:ffff8881f7200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f40b32b9fe8 CR3: 0000000117bc6000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: __refcount_sub_and_test include/linux/refcount.h:283 [inline] __refcount_dec_and_test include/linux/refcount.h:315 [inline] refcount_dec_and_test include/linux/refcount.h:333 [inline] put_task_struct include/linux/sched/task.h:112 [inline] kthread_stop+0x2b4/0x330 kernel/kthread.c:623 ext4_stop_mmpd+0x39/0xb0 fs/ext4/mmp.c:254 ext4_put_super+0x70d/0xc80 fs/ext4/super.c:1263 generic_shutdown_super+0x12d/0x330 fs/super.c:464 kill_block_super+0x97/0xe0 fs/super.c:1446 deactivate_locked_super+0x8b/0x130 fs/super.c:335 deactivate_super+0x71/0x80 fs/super.c:366 cleanup_mnt+0x33a/0x4e0 fs/namespace.c:1118 __cleanup_mnt+0xd/0x10 fs/namespace.c:1125 task_work_run+0xc2/0x140 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+0xd9/0xe0 kernel/entry/common.c:191 syscall_exit_to_user_mode+0x27/0x160 kernel/entry/common.c:266 do_syscall_64+0x3f/0x80 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f0f8ad5cea7 Code: ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 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:00007ffde5617ba8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f0f8ad5cea7 RDX: 00007ffde5617c7a RSI: 0000000000000002 RDI: 00007ffde5617c70 RBP: 00007ffde5617c70 R08: 00000000ffffffff R09: 00007ffde5617a40 R10: 000055555648db83 R11: 0000000000000246 R12: 00007f0f8adb5035 R13: 00007ffde5618d30 R14: 000055555648db00 R15: 00007ffde5618d70 ---[ end trace 7fef31c98e9ae4d1 ]---