================================================================== 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+0x36/0x3d0 kernel/kthread.c:638 Write of size 4 at addr ffff888111e18020 by task syz-executor.0/376 CPU: 0 PID: 376 Comm: syz-executor.0 Not tainted 5.10.75-syzkaller-01082-g234d53d2bb60 #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_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x8d/0x3d0 mm/kasan/report.c:233 __kasan_report+0x142/0x220 mm/kasan/report.c:419 kasan_report+0x51/0x70 mm/kasan/report.c:436 check_region_inline mm/kasan/generic.c:135 [inline] kasan_check_range+0x2b6/0x2f0 mm/kasan/generic.c:186 __kasan_check_write+0x14/0x20 mm/kasan/shadow.c:37 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+0x36/0x3d0 kernel/kthread.c:638 ext4_stop_mmpd+0x47/0xb0 fs/ext4/mmp.c:254 ext4_put_super+0xa09/0xe90 fs/ext4/super.c:1263 generic_shutdown_super+0x13f/0x2c0 fs/super.c:464 kill_block_super+0x80/0xe0 fs/super.c:1446 deactivate_locked_super+0xb0/0x100 fs/super.c:335 deactivate_super+0xa5/0xd0 fs/super.c:366 cleanup_mnt+0x45f/0x510 fs/namespace.c:1118 __cleanup_mnt+0x19/0x20 fs/namespace.c:1125 task_work_run+0x147/0x1b0 kernel/task_work.c:154 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+0xc3/0xe0 kernel/entry/common.c:191 syscall_exit_to_user_mode+0x24/0x40 kernel/entry/common.c:266 do_syscall_64+0x3d/0x70 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f20b9ff9ea7 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:00007ffd39ffe578 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f20b9ff9ea7 RDX: 00007ffd39ffe64c RSI: 0000000000000002 RDI: 00007ffd39ffe640 RBP: 00007ffd39ffe640 R08: 00000000ffffffff R09: 00007ffd39ffe410 R10: 0000555555a8db83 R11: 0000000000000246 R12: 00007f20ba052035 R13: 00007ffd39fff700 R14: 0000555555a8db00 R15: 00007ffd39fff740 Allocated by task 2: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:428 [inline] __kasan_slab_alloc+0xb2/0xe0 mm/kasan/common.c:461 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook mm/slab.h:583 [inline] slab_alloc_node mm/slub.c:2941 [inline] slab_alloc mm/slub.c:2949 [inline] kmem_cache_alloc+0x1a2/0x380 mm/slub.c:2954 kmem_cache_alloc_node include/linux/slab.h:423 [inline] alloc_task_struct_node kernel/fork.c:176 [inline] dup_task_struct+0xbc/0xea0 kernel/fork.c:895 copy_process+0x665/0x5330 kernel/fork.c:1987 kernel_clone+0x21f/0x9a0 kernel/fork.c:2507 kernel_thread+0x16c/0x1e0 kernel/fork.c:2561 create_kthread kernel/kthread.c:336 [inline] kthreadd+0x3cd/0x510 kernel/kthread.c:680 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296 Freed by task 377: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:357 ____kasan_slab_free+0x133/0x170 mm/kasan/common.c:360 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1596 [inline] slab_free_freelist_hook+0xb2/0x180 mm/slub.c:1621 slab_free mm/slub.c:3195 [inline] kmem_cache_free+0xaa/0x1e0 mm/slub.c:3211 free_task_struct kernel/fork.c:181 [inline] free_task+0xb9/0x1e0 kernel/fork.c:473 __put_task_struct+0x2e0/0x440 kernel/fork.c:776 put_task_struct include/linux/sched/task.h:113 [inline] delayed_put_task_struct+0x67/0x190 kernel/exit.c:174 rcu_do_batch+0x4cd/0xb40 kernel/rcu/tree.c:2484 rcu_core+0x822/0x10d0 kernel/rcu/tree.c:2721 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2734 __do_softirq+0x27e/0x598 kernel/softirq.c:305 Last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:345 __call_rcu kernel/rcu/tree.c:2962 [inline] call_rcu+0x134/0x1470 kernel/rcu/tree.c:3036 put_task_struct_rcu_user+0x58/0xa0 kernel/exit.c:180 finish_task_switch+0x251/0x5f0 kernel/sched/core.c:3888 context_switch kernel/sched/core.c:4018 [inline] __schedule+0x94c/0xda0 kernel/sched/core.c:4776 schedule_idle+0x60/0x90 kernel/sched/core.c:4882 do_idle+0x584/0x5e0 kernel/sched/idle.c:330 cpu_startup_entry+0x25/0x30 kernel/sched/idle.c:398 rest_init+0xe6/0xf0 init/main.c:713 arch_call_rest_init+0xe/0x10 start_kernel+0x466/0x4d8 init/main.c:1052 x86_64_start_reservations+0x2a/0x2c arch/x86/kernel/head64.c:526 x86_64_start_kernel+0x7a/0x7d arch/x86/kernel/head64.c:507 secondary_startup_64_no_verify+0xb0/0xbb The buggy address belongs to the object at ffff888111e18000 which belongs to the cache task_struct of size 4800 The buggy address is located 32 bytes inside of 4800-byte region [ffff888111e18000, ffff888111e192c0) The buggy address belongs to the page: page:ffffea0004478600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x111e18 head:ffffea0004478600 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 dead000000000100 dead000000000122 ffff888100066d80 raw: 0000000000000000 0000000000060006 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), pid 2, ts 3188169352973, free_ts 3188132822378 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2385 [inline] prep_new_page mm/page_alloc.c:2391 [inline] get_page_from_freelist+0xa74/0xa90 mm/page_alloc.c:4063 __alloc_pages_nodemask+0x3c8/0x820 mm/page_alloc.c:5106 alloc_slab_page mm/slub.c:1800 [inline] allocate_slab+0x6b/0x350 mm/slub.c:1802 new_slab mm/slub.c:1863 [inline] new_slab_objects mm/slub.c:2622 [inline] ___slab_alloc+0x143/0x2f0 mm/slub.c:2785 __slab_alloc mm/slub.c:2825 [inline] slab_alloc_node mm/slub.c:2907 [inline] slab_alloc mm/slub.c:2949 [inline] kmem_cache_alloc+0x26f/0x380 mm/slub.c:2954 kmem_cache_alloc_node include/linux/slab.h:423 [inline] alloc_task_struct_node kernel/fork.c:176 [inline] dup_task_struct+0xbc/0xea0 kernel/fork.c:895 copy_process+0x665/0x5330 kernel/fork.c:1987 kernel_clone+0x21f/0x9a0 kernel/fork.c:2507 kernel_thread+0x16c/0x1e0 kernel/fork.c:2561 create_kthread kernel/kthread.c:336 [inline] kthreadd+0x3cd/0x510 kernel/kthread.c:680 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:28 [inline] free_pages_prepare mm/page_alloc.c:1331 [inline] __free_pages_ok+0xbe7/0xc20 mm/page_alloc.c:1611 free_the_page mm/page_alloc.c:5167 [inline] __free_pages+0x2d6/0x4a0 mm/page_alloc.c:5173 __free_slab+0xdf/0x1a0 mm/slub.c:1888 free_slab mm/slub.c:1903 [inline] discard_slab mm/slub.c:1909 [inline] __slab_free+0x458/0x4e0 mm/slub.c:3125 do_slab_free mm/slub.c:3183 [inline] ___cache_free+0x131/0x150 mm/slub.c:3202 qlink_free+0x38/0x40 mm/kasan/quarantine.c:146 qlist_free_all mm/kasan/quarantine.c:165 [inline] kasan_quarantine_reduce+0x178/0x1d0 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:438 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook mm/slab.h:583 [inline] slab_alloc_node mm/slub.c:2941 [inline] slab_alloc mm/slub.c:2949 [inline] kmem_cache_alloc+0x1a2/0x380 mm/slub.c:2954 getname_flags+0xba/0x650 fs/namei.c:141 getname+0x19/0x20 fs/namei.c:212 do_sys_openat2+0xd2/0x470 fs/open.c:1205 do_sys_open fs/open.c:1227 [inline] __do_sys_openat fs/open.c:1243 [inline] __se_sys_openat fs/open.c:1238 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1238 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Memory state around the buggy address: ffff888111e17f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888111e17f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888111e18000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888111e18080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888111e18100: 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: 0 PID: 376 at lib/refcount.c:25 refcount_warn_saturate+0x147/0x1b0 lib/refcount.c:25 Modules linked in: CPU: 0 PID: 376 Comm: syz-executor.0 Tainted: G B 5.10.75-syzkaller-01082-g234d53d2bb60 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:refcount_warn_saturate+0x147/0x1b0 lib/refcount.c:25 Code: c7 e0 b0 49 85 31 c0 e8 e7 7d eb fe 0f 0b eb a1 e8 1e 9b 18 ff c6 05 4b cb 68 04 01 48 c7 c7 80 b1 49 85 31 c0 e8 c9 7d eb fe <0f> 0b eb 83 e8 00 9b 18 ff c6 05 2e cb 68 04 01 48 c7 c7 e0 b1 49 RSP: 0018:ffffc90000bd7c60 EFLAGS: 00010246 RAX: 60f79027987a5e00 RBX: 0000000000000002 RCX: 1ffff9200017af44 RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000 RBP: ffffc90000bd7c70 R08: ffffffff81545368 R09: ffffed103ee095d8 R10: ffffed103ee095d8 R11: 0000000000000000 R12: ffff888111e18000 R13: dffffc0000000000 R14: 0000000000000002 R15: dffffc0000000000 FS: 0000555555a8c400(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffdafde8f98 CR3: 000000014a0b1000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: __refcount_add include/linux/refcount.h:200 [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+0x1b0/0x3d0 kernel/kthread.c:638 ext4_stop_mmpd+0x47/0xb0 fs/ext4/mmp.c:254 ext4_put_super+0xa09/0xe90 fs/ext4/super.c:1263 generic_shutdown_super+0x13f/0x2c0 fs/super.c:464 kill_block_super+0x80/0xe0 fs/super.c:1446 deactivate_locked_super+0xb0/0x100 fs/super.c:335 deactivate_super+0xa5/0xd0 fs/super.c:366 cleanup_mnt+0x45f/0x510 fs/namespace.c:1118 __cleanup_mnt+0x19/0x20 fs/namespace.c:1125 task_work_run+0x147/0x1b0 kernel/task_work.c:154 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+0xc3/0xe0 kernel/entry/common.c:191 syscall_exit_to_user_mode+0x24/0x40 kernel/entry/common.c:266 do_syscall_64+0x3d/0x70 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f20b9ff9ea7 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:00007ffd39ffe578 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f20b9ff9ea7 RDX: 00007ffd39ffe64c RSI: 0000000000000002 RDI: 00007ffd39ffe640 RBP: 00007ffd39ffe640 R08: 00000000ffffffff R09: 00007ffd39ffe410 R10: 0000555555a8db83 R11: 0000000000000246 R12: 00007f20ba052035 R13: 00007ffd39fff700 R14: 0000555555a8db00 R15: 00007ffd39fff740 ---[ end trace 88cf27b51c057f8d ]--- ------------[ cut here ]------------ refcount_t: underflow; use-after-free. WARNING: CPU: 1 PID: 376 at lib/refcount.c:28 refcount_warn_saturate+0x165/0x1b0 lib/refcount.c:28 Modules linked in: CPU: 0 PID: 376 Comm: syz-executor.0 Tainted: G B W 5.10.75-syzkaller-01082-g234d53d2bb60 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:refcount_warn_saturate+0x165/0x1b0 lib/refcount.c:28 Code: c7 80 b1 49 85 31 c0 e8 c9 7d eb fe 0f 0b eb 83 e8 00 9b 18 ff c6 05 2e cb 68 04 01 48 c7 c7 e0 b1 49 85 31 c0 e8 ab 7d eb fe <0f> 0b e9 62 ff ff ff e8 df 9a 18 ff c6 05 0e cb 68 04 01 48 c7 c7 RSP: 0018:ffffc90000bd7c60 EFLAGS: 00010246 RAX: 60f79027987a5e00 RBX: 0000000000000003 RCX: 1ffff9200017af44 RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000 RBP: ffffc90000bd7c70 R08: ffffffff81545368 R09: ffffed103ee295d8 R10: ffffed103ee295d8 R11: 0000000000000000 R12: 00000000ffffffff R13: dffffc0000000000 R14: 0000000000000003 R15: 0000000000000000 FS: 0000555555a8c400(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffdafde8f98 CR3: 000000014a0b1000 CR4: 00000000003506a0 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+0x1c7/0x3d0 kernel/kthread.c:645 ext4_stop_mmpd+0x47/0xb0 fs/ext4/mmp.c:254 ext4_put_super+0xa09/0xe90 fs/ext4/super.c:1263 generic_shutdown_super+0x13f/0x2c0 fs/super.c:464 kill_block_super+0x80/0xe0 fs/super.c:1446 deactivate_locked_super+0xb0/0x100 fs/super.c:335 deactivate_super+0xa5/0xd0 fs/super.c:366 cleanup_mnt+0x45f/0x510 fs/namespace.c:1118 __cleanup_mnt+0x19/0x20 fs/namespace.c:1125 task_work_run+0x147/0x1b0 kernel/task_work.c:154 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+0xc3/0xe0 kernel/entry/common.c:191 syscall_exit_to_user_mode+0x24/0x40 kernel/entry/common.c:266 do_syscall_64+0x3d/0x70 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f20b9ff9ea7 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:00007ffd39ffe578 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f20b9ff9ea7 RDX: 00007ffd39ffe64c RSI: 0000000000000002 RDI: 00007ffd39ffe640 RBP: 00007ffd39ffe640 R08: 00000000ffffffff R09: 00007ffd39ffe410 R10: 0000555555a8db83 R11: 0000000000000246 R12: 00007f20ba052035 R13: 00007ffd39fff700 R14: 0000555555a8db00 R15: 00007ffd39fff740 ---[ end trace 88cf27b51c057f8e ]---