================================================================== BUG: KASAN: use-after-free in hlist_add_head include/linux/list.h:814 [inline] BUG: KASAN: use-after-free in enqueue_timer+0xb7/0x300 kernel/time/timer.c:541 Write of size 8 at addr ffff8881dabf31c8 by task syz.2.403/1390 CPU: 1 PID: 1390 Comm: syz.2.403 Not tainted 5.4.276-syzkaller-00020-g4275fce9fe94 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1d8/0x241 lib/dump_stack.c:118 print_address_description+0x8c/0x600 mm/kasan/report.c:384 __kasan_report+0xf3/0x120 mm/kasan/report.c:516 kasan_report+0x30/0x60 mm/kasan/common.c:653 hlist_add_head include/linux/list.h:814 [inline] enqueue_timer+0xb7/0x300 kernel/time/timer.c:541 __internal_add_timer kernel/time/timer.c:554 [inline] internal_add_timer+0x240/0x430 kernel/time/timer.c:604 __mod_timer+0x6f1/0x13e0 kernel/time/timer.c:1065 call_timer_fn+0x36/0x390 kernel/time/timer.c:1448 expire_timers kernel/time/timer.c:1493 [inline] __run_timers+0x879/0xbe0 kernel/time/timer.c:1817 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1830 __do_softirq+0x23b/0x6b7 kernel/softirq.c:292 invoke_softirq kernel/softirq.c:373 [inline] irq_exit+0x195/0x1c0 kernel/softirq.c:413 exiting_irq arch/x86/include/asm/apic.h:539 [inline] smp_apic_timer_interrupt+0x11a/0x460 arch/x86/kernel/apic/apic.c:1149 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:834 RIP: 0010:__read_once_size include/linux/compiler.h:268 [inline] RIP: 0010:compound_head include/linux/page-flags.h:174 [inline] RIP: 0010:set_page_dirty+0x2b/0x2e0 mm/page-writeback.c:2553 Code: 41 57 41 56 41 55 41 54 53 49 89 fe 49 bc 00 00 00 00 00 fc ff df e8 c4 c4 e2 ff 4c 89 f7 e8 ac d5 04 00 49 89 c7 49 8d 5e 08 <48> 89 d8 48 c1 e8 03 42 80 3c 20 00 74 08 48 89 df e8 bf a9 12 00 RSP: 0018:ffff8881d5a0f568 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13 RAX: ffff8881e91e9c48 RBX: ffffea000782c648 RCX: ffff8881e81f5e80 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffff8881d5a0f790 R08: ffffffff81864be6 R09: fffff94000f058c9 R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000 R13: ffff8881d7498100 R14: ffffea000782c640 R15: ffff8881e91e9c48 zap_pte_range mm/memory.c:1098 [inline] zap_pmd_range mm/memory.c:1222 [inline] zap_pud_range mm/memory.c:1251 [inline] zap_p4d_range mm/memory.c:1272 [inline] unmap_page_range+0xee9/0x2620 mm/memory.c:1293 unmap_single_vma mm/memory.c:1338 [inline] unmap_vmas+0x355/0x4b0 mm/memory.c:1370 exit_mmap+0x2bc/0x520 mm/mmap.c:3191 __mmput+0x8e/0x2c0 kernel/fork.c:1101 exit_mm kernel/exit.c:536 [inline] do_exit+0xc08/0x2bc0 kernel/exit.c:846 do_group_exit+0x138/0x300 kernel/exit.c:982 get_signal+0xdb1/0x1440 kernel/signal.c:2735 do_signal+0xb0/0x11f0 arch/x86/kernel/signal.c:809 exit_to_usermode_loop+0xc0/0x1a0 arch/x86/entry/common.c:159 prepare_exit_to_usermode+0x199/0x200 arch/x86/entry/common.c:194 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 RIP: 0033:0x7fd19d2f2b99 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fd19c574048 EFLAGS: 00000246 ORIG_RAX: 0000000000000035 RAX: 0000000000000000 RBX: 00007fd19d480fa0 RCX: 00007fd19d2f2b99 RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000001 RBP: 00007fd19d37377e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000020000300 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fd19d480fa0 R15: 00007fff1291d0d8 The buggy address belongs to the page: page:ffffea00076afcc0 refcount:2 mapcount:1 mapping:0000000000000000 index:0x0 flags: 0x8000000000000000() raw: 8000000000000000 dead000000000100 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000000000 0000000200000000 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x102dc2(GFP_HIGHUSER|__GFP_NOWARN|__GFP_ZERO) set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook mm/page_alloc.c:2165 [inline] prep_new_page+0x18f/0x370 mm/page_alloc.c:2171 get_page_from_freelist+0x2d13/0x2d90 mm/page_alloc.c:3794 __alloc_pages_nodemask+0x393/0x840 mm/page_alloc.c:4893 __vmalloc_area_node mm/vmalloc.c:2431 [inline] __vmalloc_node_range+0x384/0x710 mm/vmalloc.c:2499 vmalloc_user+0x70/0x80 mm/vmalloc.c:2629 kcov_mmap+0x28/0x120 kernel/kcov.c:450 call_mmap include/linux/fs.h:1994 [inline] mmap_region+0x110d/0x16f0 mm/mmap.c:1812 do_mmap+0x822/0xd30 mm/mmap.c:1581 do_mmap_pgoff include/linux/mm.h:2480 [inline] vm_mmap_pgoff+0x1b5/0x260 mm/util.c:528 ksys_mmap_pgoff+0x168/0x1e0 mm/mmap.c:1631 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1176 [inline] __free_pages_ok+0x847/0x950 mm/page_alloc.c:1438 free_the_page mm/page_alloc.c:4955 [inline] __free_pages+0x91/0x140 mm/page_alloc.c:4961 bpf_check+0x8aaa/0xb340 kernel/bpf/verifier.c:9731 bpf_prog_load kernel/bpf/syscall.c:1724 [inline] __do_sys_bpf kernel/bpf/syscall.c:2891 [inline] __se_sys_bpf+0x8139/0xbcb0 kernel/bpf/syscall.c:2849 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 Memory state around the buggy address: ffff8881dabf3080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8881dabf3100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff8881dabf3180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffff8881dabf3200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8881dabf3280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== ---------------- Code disassembly (best guess): 0: 41 57 push %r15 2: 41 56 push %r14 4: 41 55 push %r13 6: 41 54 push %r12 8: 53 push %rbx 9: 49 89 fe mov %rdi,%r14 c: 49 bc 00 00 00 00 00 movabs $0xdffffc0000000000,%r12 13: fc ff df 16: e8 c4 c4 e2 ff call 0xffe2c4df 1b: 4c 89 f7 mov %r14,%rdi 1e: e8 ac d5 04 00 call 0x4d5cf 23: 49 89 c7 mov %rax,%r15 26: 49 8d 5e 08 lea 0x8(%r14),%rbx * 2a: 48 89 d8 mov %rbx,%rax <-- trapping instruction 2d: 48 c1 e8 03 shr $0x3,%rax 31: 42 80 3c 20 00 cmpb $0x0,(%rax,%r12,1) 36: 74 08 je 0x40 38: 48 89 df mov %rbx,%rdi 3b: e8 bf a9 12 00 call 0x12a9ff