================================================================== BUG: KASAN: slab-use-after-free in __lock_acquire+0x4208/0x5de0 kernel/locking/lockdep.c:5004 Read of size 8 at addr ffff88802b180b88 by task syz-executor115/6007 CPU: 1 PID: 6007 Comm: syz-executor115 Not tainted 6.6.0-syzkaller-10265-gbabe393974de #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/09/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 __lock_acquire+0x4208/0x5de0 kernel/locking/lockdep.c:5004 lock_acquire kernel/locking/lockdep.c:5753 [inline] lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5718 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/0x50 kernel/locking/spinlock.c:162 class_raw_spinlock_irqsave_constructor include/linux/spinlock.h:518 [inline] try_to_wake_up+0xb0/0x15d0 kernel/sched/core.c:4226 call_timer_fn+0x193/0x580 kernel/time/timer.c:1700 expire_timers kernel/time/timer.c:1751 [inline] __run_timers+0x764/0xb10 kernel/time/timer.c:2022 run_timer_softirq+0x58/0xd0 kernel/time/timer.c:2035 __do_softirq+0x21a/0x968 kernel/softirq.c:553 invoke_softirq kernel/softirq.c:427 [inline] __irq_exit_rcu kernel/softirq.c:632 [inline] irq_exit_rcu+0xb7/0x120 kernel/softirq.c:644 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1076 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645 RIP: 0010:orc_find arch/x86/kernel/unwind_orc.c:220 [inline] RIP: 0010:unwind_next_frame+0x2d4/0x2390 arch/x86/kernel/unwind_orc.c:494 Code: 03 38 d0 7c 09 84 d2 74 05 e8 18 b5 a2 00 44 8b 74 24 28 42 8b 04 ad 54 d9 50 90 4b 8d 14 76 4c 8d ac 12 64 1e 9c 8f 83 c0 01 <49> 81 fd 54 d9 50 90 89 44 24 34 0f 83 0a 0a 00 00 e8 46 f3 4c 00 RSP: 0018:ffffc900052b7210 EFLAGS: 00000202 RAX: 000000000002ad94 RBX: ffffc900052b7290 RCX: ffffffff813a8861 RDX: 000000000008088f RSI: ffffffff813a886f RDI: ffffffff9053d638 RBP: 0000000000000001 R08: 0000000000000004 R09: 000000000000bf38 R10: 000000000009c000 R11: dffffc0000000000 R12: ffffffff81bf387f R13: ffffffff8fac2f82 R14: 000000000002ad85 R15: ffffc900052b72c5 arch_stack_walk+0xfa/0x170 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x96/0xd0 kernel/stacktrace.c:122 save_stack+0x160/0x1f0 mm/page_owner.c:128 __set_page_owner+0x1f/0x60 mm/page_owner.c:192 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1536 prep_new_page mm/page_alloc.c:1543 [inline] get_page_from_freelist+0xee0/0x2f20 mm/page_alloc.c:3170 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4426 __folio_alloc+0x16/0x40 mm/page_alloc.c:4458 vma_alloc_folio+0x156/0x890 mm/mempolicy.c:2264 shmem_alloc_folio+0xb5/0x170 mm/shmem.c:1658 shmem_alloc_and_acct_folio+0xcb/0x140 mm/shmem.c:1683 shmem_get_folio_gfp+0xbe9/0x1890 mm/shmem.c:2020 shmem_get_folio mm/shmem.c:2143 [inline] shmem_write_begin+0x15c/0x460 mm/shmem.c:2688 generic_perform_write+0x278/0x600 mm/filemap.c:3969 shmem_file_write_iter+0x110/0x140 mm/shmem.c:2865 call_write_iter include/linux/fs.h:2020 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x64f/0xdf0 fs/read_write.c:584 ksys_write+0x12f/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7f59a9f3e360 Code: 40 00 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 80 3d 41 ad 07 00 00 74 17 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 48 83 ec 28 48 89 RSP: 002b:00007ffd4d32be28 EFLAGS: 00000202 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f59a9f3e360 RDX: 0000000000200000 RSI: 00007f59a1b00000 RDI: 0000000000000003 RBP: 00007f59a1b00000 R08: 0000000000000eaf R09: 0000000000000eab R10: 0000000020000f82 R11: 0000000000000202 R12: 00007ffd4d32be70 R13: 00007ffd4d32beb0 R14: 0000000000200000 R15: 0000000000000003 Allocated by task 2: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 __kasan_slab_alloc+0x81/0x90 mm/kasan/common.c:328 kasan_slab_alloc include/linux/kasan.h:188 [inline] slab_post_alloc_hook mm/slab.h:762 [inline] slab_alloc_node mm/slab.c:3237 [inline] kmem_cache_alloc_node+0x173/0x540 mm/slab.c:3509 alloc_task_struct_node kernel/fork.c:173 [inline] dup_task_struct kernel/fork.c:1110 [inline] copy_process+0x41c/0x73f0 kernel/fork.c:2332 kernel_clone+0xfd/0x920 kernel/fork.c:2914 kernel_thread+0xc0/0x100 kernel/fork.c:2976 create_kthread kernel/kthread.c:411 [inline] kthreadd+0x4fb/0x7d0 kernel/kthread.c:746 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 Freed by task 5068: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x28/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x138/0x190 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:164 [inline] __cache_free mm/slab.c:3370 [inline] __do_kmem_cache_free mm/slab.c:3557 [inline] kmem_cache_free+0x104/0x380 mm/slab.c:3582 put_task_struct include/linux/sched/task.h:136 [inline] put_task_struct include/linux/sched/task.h:123 [inline] delayed_put_task_struct+0x21b/0x2b0 kernel/exit.c:228 rcu_do_batch kernel/rcu/tree.c:2153 [inline] rcu_core+0x830/0x1c50 kernel/rcu/tree.c:2417 __do_softirq+0x21a/0x968 kernel/softirq.c:553 Last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0x78/0x80 mm/kasan/generic.c:492 __call_rcu_common.constprop.0+0x9a/0x790 kernel/rcu/tree.c:2667 put_task_struct_rcu_user kernel/exit.c:234 [inline] put_task_struct_rcu_user+0x87/0xc0 kernel/exit.c:231 context_switch kernel/sched/core.c:5379 [inline] __schedule+0xeea/0x59a0 kernel/sched/core.c:6688 preempt_schedule_irq+0x52/0x90 kernel/sched/core.c:7008 irqentry_exit+0x35/0x80 kernel/entry/common.c:432 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645 Second to last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0x78/0x80 mm/kasan/generic.c:492 __call_rcu_common.constprop.0+0x9a/0x790 kernel/rcu/tree.c:2667 put_task_struct_rcu_user kernel/exit.c:234 [inline] put_task_struct_rcu_user+0x87/0xc0 kernel/exit.c:231 context_switch kernel/sched/core.c:5379 [inline] __schedule+0xeea/0x59a0 kernel/sched/core.c:6688 preempt_schedule_irq+0x52/0x90 kernel/sched/core.c:7008 irqentry_exit+0x35/0x80 kernel/entry/common.c:432 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645 The buggy address belongs to the object at ffff88802b180180 which belongs to the cache task_struct of size 7360 The buggy address is located 2568 bytes inside of freed 7360-byte region [ffff88802b180180, ffff88802b181e40) The buggy address belongs to the physical page: page:ffffea0000ac6000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2b180 head:ffffea0000ac6000 order:1 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0x1() raw: 00fff00000000840 ffff888140051500 ffffea0000807810 ffffea000080e190 raw: 0000000000000000 ffff88802b180180 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 4805, tgid 4805 (dhcpcd-run-hook), ts 72579064960, free_ts 72353568211 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1536 prep_new_page mm/page_alloc.c:1543 [inline] get_page_from_freelist+0xee0/0x2f20 mm/page_alloc.c:3170 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4426 __alloc_pages_node include/linux/gfp.h:237 [inline] kmem_getpages mm/slab.c:1356 [inline] cache_grow_begin+0x99/0x3a0 mm/slab.c:2550 cache_alloc_refill+0x294/0x3a0 mm/slab.c:2923 ____cache_alloc mm/slab.c:2999 [inline] ____cache_alloc mm/slab.c:2982 [inline] __do_cache_alloc mm/slab.c:3182 [inline] slab_alloc_node mm/slab.c:3230 [inline] kmem_cache_alloc_node+0x481/0x540 mm/slab.c:3509 alloc_task_struct_node kernel/fork.c:173 [inline] dup_task_struct kernel/fork.c:1110 [inline] copy_process+0x41c/0x73f0 kernel/fork.c:2332 kernel_clone+0xfd/0x920 kernel/fork.c:2914 __do_sys_clone+0xba/0x100 kernel/fork.c:3057 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1136 [inline] free_unref_page_prepare+0x476/0xa40 mm/page_alloc.c:2312 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2405 slab_destroy mm/slab.c:1608 [inline] slabs_destroy+0x85/0xc0 mm/slab.c:1628 cache_flusharray mm/slab.c:3341 [inline] ___cache_free+0x2b7/0x420 mm/slab.c:3404 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x4c/0x1b0 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:188 [inline] slab_post_alloc_hook mm/slab.h:762 [inline] slab_alloc_node mm/slab.c:3237 [inline] __kmem_cache_alloc_node+0x163/0x470 mm/slab.c:3521 kmalloc_trace+0x25/0xe0 mm/slab_common.c:1098 kmalloc include/linux/slab.h:600 [inline] tomoyo_print_header security/tomoyo/audit.c:156 [inline] tomoyo_init_log+0x1a0/0x2110 security/tomoyo/audit.c:255 tomoyo_supervisor+0x30c/0xea0 security/tomoyo/common.c:2089 tomoyo_audit_path_log security/tomoyo/file.c:168 [inline] tomoyo_path_permission security/tomoyo/file.c:587 [inline] tomoyo_path_permission+0x270/0x3b0 security/tomoyo/file.c:573 tomoyo_check_open_permission+0x371/0x3b0 security/tomoyo/file.c:777 tomoyo_file_open security/tomoyo/tomoyo.c:332 [inline] tomoyo_file_open+0xa8/0xd0 security/tomoyo/tomoyo.c:327 security_file_open+0x6a/0xe0 security/security.c:2836 do_dentry_open+0x583/0x18d0 fs/open.c:935 Memory state around the buggy address: ffff88802b180a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802b180b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88802b180b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802b180c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802b180c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 03 38 add (%rax),%edi 2: d0 7c 09 84 sarb -0x7c(%rcx,%rcx,1) 6: d2 74 05 e8 shlb %cl,-0x18(%rbp,%rax,1) a: 18 b5 a2 00 44 8b sbb %dh,-0x74bbff5e(%rbp) 10: 74 24 je 0x36 12: 28 42 8b sub %al,-0x75(%rdx) 15: 04 ad add $0xad,%al 17: 54 push %rsp 18: d9 50 90 fsts -0x70(%rax) 1b: 4b 8d 14 76 lea (%r14,%r14,2),%rdx 1f: 4c 8d ac 12 64 1e 9c lea -0x7063e19c(%rdx,%rdx,1),%r13 26: 8f 27: 83 c0 01 add $0x1,%eax * 2a: 49 81 fd 54 d9 50 90 cmp $0xffffffff9050d954,%r13 <-- trapping instruction 31: 89 44 24 34 mov %eax,0x34(%rsp) 35: 0f 83 0a 0a 00 00 jae 0xa45 3b: e8 46 f3 4c 00 call 0x4cf386