BUG: KASAN: use-after-free in __lock_acquire+0x77/0x1f80 kernel/locking/lockdep.c:4925 Read of size 8 at addr ffff88802057a6b0 by task segctord/5911 CPU: 1 PID: 5911 Comm: segctord Not tainted 6.2.0-rc8-syzkaller-00151-g925cf0457d7e #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:306 [inline] print_report+0x163/0x4f0 mm/kasan/report.c:417 kasan_report+0x13a/0x170 mm/kasan/report.c:517 __lock_acquire+0x77/0x1f80 kernel/locking/lockdep.c:4925 lock_acquire+0x235/0x630 kernel/locking/lockdep.c:5668 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162 try_to_wake_up+0xb6/0x12b0 kernel/sched/core.c:4152 call_timer_fn+0x1ed/0x820 kernel/time/timer.c:1700 expire_timers kernel/time/timer.c:1751 [inline] __run_timers+0x64f/0x860 kernel/time/timer.c:2022 run_timer_softirq+0x67/0xf0 kernel/time/timer.c:2035 __do_softirq+0x308/0xb15 kernel/softirq.c:571 invoke_softirq kernel/softirq.c:445 [inline] __irq_exit_rcu+0x159/0x250 kernel/softirq.c:650 irq_exit_rcu+0x9/0x20 kernel/softirq.c:662 sysvec_apic_timer_interrupt+0x95/0xb0 arch/x86/kernel/apic/apic.c:1107 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:649 RIP: 0010:kernel_text_address+0x7/0xe0 kernel/extable.c:95 Code: 93 c1 48 c7 c2 cb 5a a6 8f 48 39 d3 0f 92 c2 20 ca 08 c2 0f b6 c2 5b c3 66 2e 0f 1f 84 00 00 00 00 00 90 66 0f 1f 00 55 41 56 <53> 48 89 fb 48 c7 c0 00 00 00 81 bd 01 00 00 00 48 39 c7 72 0c 48 RSP: 0018:ffffc900055ef0d8 EFLAGS: 00000246 RAX: 0000000000000000 RBX: ffffffff83527b01 RCX: 0000000080000000 RDX: dffffc0000000000 RSI: ffffc900055e8000 RDI: ffffffff83527b01 RBP: ffffc900055ef1b0 R08: ffffc900055ef6f0 R09: ffffc900055ef170 R10: 0000000000000000 R11: dffffc0000000001 R12: ffff888026cad7c0 R13: ffffffff81798700 R14: dffffc0000000000 R15: 1ffff92000abde2d __kernel_text_address+0xd/0x40 kernel/extable.c:79 unwind_get_return_address+0x4d/0x90 arch/x86/kernel/unwind_orc.c:342 arch_stack_walk+0xf7/0x140 arch/x86/kernel/stacktrace.c:26 stack_trace_save+0x117/0x1c0 kernel/stacktrace.c:122 kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4f/0x80 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:523 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook mm/slub.c:1807 [inline] slab_free mm/slub.c:3787 [inline] kmem_cache_free+0x2b5/0x580 mm/slub.c:3809 nilfs_btree_assign+0xa48/0xd10 fs/nilfs2/btree.c:2291 nilfs_bmap_assign+0x8b/0x160 fs/nilfs2/bmap.c:382 nilfs_segctor_update_payload_blocknr fs/nilfs2/segment.c:1595 [inline] nilfs_segctor_assign fs/nilfs2/segment.c:1629 [inline] nilfs_segctor_do_construct+0x3a11/0x6f70 fs/nilfs2/segment.c:2056 nilfs_segctor_construct+0x145/0x8c0 fs/nilfs2/segment.c:2379 nilfs_segctor_thread_construct fs/nilfs2/segment.c:2487 [inline] nilfs_segctor_thread+0x53a/0x1140 fs/nilfs2/segment.c:2570 kthread+0x270/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 Allocated by task 2: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4f/0x80 mm/kasan/common.c:52 __kasan_slab_alloc+0x69/0x80 mm/kasan/common.c:328 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook+0x68/0x390 mm/slab.h:761 slab_alloc_node mm/slub.c:3452 [inline] kmem_cache_alloc_node+0x158/0x2c0 mm/slub.c:3497 alloc_task_struct_node kernel/fork.c:171 [inline] dup_task_struct+0x57/0x6d0 kernel/fork.c:979 copy_process+0x5c9/0x3f50 kernel/fork.c:2097 kernel_clone+0x22d/0x990 kernel/fork.c:2681 kernel_thread+0x156/0x1d0 kernel/fork.c:2741 create_kthread kernel/kthread.c:399 [inline] kthreadd+0x583/0x750 kernel/kthread.c:746 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 Freed by task 5862: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4f/0x80 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:523 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook mm/slub.c:1807 [inline] slab_free mm/slub.c:3787 [inline] kmem_cache_free+0x2b5/0x580 mm/slub.c:3809 rcu_do_batch kernel/rcu/tree.c:2246 [inline] rcu_core+0xa9e/0x17a0 kernel/rcu/tree.c:2506 __do_softirq+0x308/0xb15 kernel/softirq.c:571 Last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:493 __call_rcu_common kernel/rcu/tree.c:2755 [inline] call_rcu+0x167/0xac0 kernel/rcu/tree.c:2868 context_switch kernel/sched/core.c:5299 [inline] __schedule+0x1411/0x43f0 kernel/sched/core.c:6609 schedule+0xc3/0x190 kernel/sched/core.c:6685 ptrace_stop+0x590/0x970 kernel/signal.c:2308 ptrace_do_notify kernel/signal.c:2345 [inline] ptrace_notify+0x229/0x350 kernel/signal.c:2357 ptrace_report_syscall include/linux/ptrace.h:411 [inline] ptrace_report_syscall_exit include/linux/ptrace.h:473 [inline] syscall_exit_work kernel/entry/common.c:251 [inline] syscall_exit_to_user_mode_prepare kernel/entry/common.c:278 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x171/0x2e0 kernel/entry/common.c:296 do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd Second to last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:493 __call_rcu_common kernel/rcu/tree.c:2755 [inline] call_rcu+0x167/0xac0 kernel/rcu/tree.c:2868 put_task_struct_rcu_user kernel/exit.c:231 [inline] release_task+0x155d/0x16a0 kernel/exit.c:281 wait_task_zombie kernel/exit.c:1198 [inline] wait_consider_task+0x19f8/0x2d30 kernel/exit.c:1425 do_wait_thread kernel/exit.c:1488 [inline] do_wait+0x396/0xc40 kernel/exit.c:1605 kernel_wait4+0x2a2/0x3e0 kernel/exit.c:1768 __do_sys_wait4 kernel/exit.c:1796 [inline] __se_sys_wait4 kernel/exit.c:1792 [inline] __x64_sys_wait4+0x134/0x1e0 kernel/exit.c:1792 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff888020579d40 which belongs to the cache task_struct of size 7232 The buggy address is located 2416 bytes inside of 7232-byte region [ffff888020579d40, ffff88802057b980) The buggy address belongs to the physical page: page:ffffea0000815e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x20578 head:ffffea0000815e00 order:3 compound_mapcount:0 subpages_mapcount:0 compound_pincount:0 anon flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffff888140007500 0000000000000000 dead000000000001 raw: 0000000000000000 0000000000040004 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 2, tgid 2 (kthreadd), ts 8881010723, free_ts 0 prep_new_page mm/page_alloc.c:2531 [inline] get_page_from_freelist+0x3449/0x35c0 mm/page_alloc.c:4283 __alloc_pages+0x291/0x7e0 mm/page_alloc.c:5549 alloc_slab_page+0x6a/0x160 mm/slub.c:1851 allocate_slab mm/slub.c:1998 [inline] new_slab+0x84/0x2f0 mm/slub.c:2051 ___slab_alloc+0xa85/0x10a0 mm/slub.c:3193 __slab_alloc mm/slub.c:3292 [inline] __slab_alloc_node mm/slub.c:3345 [inline] slab_alloc_node mm/slub.c:3442 [inline] kmem_cache_alloc_node+0x1dc/0x2c0 mm/slub.c:3497 alloc_task_struct_node kernel/fork.c:171 [inline] dup_task_struct+0x57/0x6d0 kernel/fork.c:979 copy_process+0x5c9/0x3f50 kernel/fork.c:2097 kernel_clone+0x22d/0x990 kernel/fork.c:2681 kernel_thread+0x156/0x1d0 kernel/fork.c:2741 create_kthread kernel/kthread.c:399 [inline] kthreadd+0x583/0x750 kernel/kthread.c:746 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 page_owner free stack trace missing Memory state around the buggy address: ffff88802057a580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802057a600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88802057a680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802057a700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802057a780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 2 bytes skipped: 0: 48 c7 c2 cb 5a a6 8f mov $0xffffffff8fa65acb,%rdx 7: 48 39 d3 cmp %rdx,%rbx a: 0f 92 c2 setb %dl d: 20 ca and %cl,%dl f: 08 c2 or %al,%dl 11: 0f b6 c2 movzbl %dl,%eax 14: 5b pop %rbx 15: c3 retq 16: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1) 1d: 00 00 00 20: 90 nop 21: 66 0f 1f 00 nopw (%rax) 25: 55 push %rbp 26: 41 56 push %r14 * 28: 53 push %rbx <-- trapping instruction 29: 48 89 fb mov %rdi,%rbx 2c: 48 c7 c0 00 00 00 81 mov $0xffffffff81000000,%rax 33: bd 01 00 00 00 mov $0x1,%ebp 38: 48 39 c7 cmp %rax,%rdi 3b: 72 0c jb 0x49 3d: 48 rex.W