================================================================== 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 ffff8881eb2ff1c8 by task syz.4.813/3288 CPU: 1 PID: 3288 Comm: syz.4.813 Tainted: G W 5.4.290-syzkaller-00002-g41adfeb3d639 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 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/0x490 arch/x86/kernel/apic/apic.c:1161 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:834 RIP: 0010:unwind_next_frame+0x6/0x1ea0 arch/x86/kernel/unwind_orc.c:413 Code: 5e 41 5f c3 44 89 f1 80 e1 07 80 c1 03 38 c1 7c 95 4c 89 f7 e8 eb 78 64 00 eb 8b 66 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 57 <41> 56 41 55 41 54 53 48 83 e4 e0 48 81 ec c0 02 00 00 49 89 fe 65 RSP: 0018:ffff8881e4377748 EFLAGS: 00000202 ORIG_RAX: ffffffffffffff13 RAX: ffff8881e2bd5e01 RBX: ffff8881e4377760 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000010 RDI: ffff8881e4377760 RBP: ffff8881e4377750 R08: ffffffff8153c592 R09: ffff8881e43777b0 R10: 0000000000000000 R11: dffffc0000000001 R12: ffff8881e2bd5e80 R13: ffffffff8153c430 R14: ffff8881e4377840 R15: 0000000000000000 arch_stack_walk+0x111/0x140 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x118/0x1c0 kernel/stacktrace.c:123 save_stack+0x95/0x880 mm/page_owner.c:122 __reset_page_owner+0x1f/0x100 mm/page_owner.c:149 reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1176 [inline] free_pcp_prepare mm/page_alloc.c:1233 [inline] free_unref_page_prepare+0x297/0x380 mm/page_alloc.c:3085 free_unref_page mm/page_alloc.c:3134 [inline] free_the_page mm/page_alloc.c:4953 [inline] __free_pages+0xaf/0x140 mm/page_alloc.c:4961 __vunmap+0x75b/0x890 mm/vmalloc.c:2260 kcov_mmap+0x8c/0x120 kernel/kcov.c:474 call_mmap include/linux/fs.h:1996 [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 RIP: 0033:0x7ff1328881a3 Code: f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 41 89 ca 41 f7 c1 ff 0f 00 00 75 14 b8 09 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 25 c3 0f 1f 40 00 48 c7 c0 a8 ff ff ff 64 c7 RSP: 002b:00007fff440ba408 EFLAGS: 00000246 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 00007ff132aa12d8 RCX: 00007ff1328881a3 RDX: 0000000000000003 RSI: 0000000000400000 RDI: 00007ff130a8f000 RBP: 00007ff132aa1240 R08: 00000000000000db R09: 0000000000000000 R10: 0000000000000011 R11: 0000000000000246 R12: 00007ff132aa0fa0 R13: 00007ff132aa1240 R14: 00000000000000af R15: 0000000000000003 The buggy address belongs to the page: page:ffffea0007acbfc0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 flags: 0x8000000000000000() raw: 8000000000000000 0000000000000000 ffffea0007acbfc8 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 2, migratetype Unmovable, gfp_mask 0x146dc0(GFP_USER|__GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_COMP|__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 __alloc_pages include/linux/gfp.h:503 [inline] __alloc_pages_node include/linux/gfp.h:516 [inline] alloc_pages_node include/linux/gfp.h:530 [inline] kmalloc_order mm/slab_common.c:1342 [inline] kmalloc_order_trace+0x2a/0x100 mm/slab_common.c:1358 __kmalloc_node include/linux/slab.h:422 [inline] kmalloc_node include/linux/slab.h:599 [inline] kvmalloc_node+0x7e/0xf0 mm/util.c:596 kvmalloc include/linux/mm.h:761 [inline] kvzalloc include/linux/mm.h:769 [inline] alloc_netdev_mqs+0x85/0xc70 net/core/dev.c:9629 tun_set_iff+0x51f/0xdc0 drivers/net/tun.c:2893 __tun_chr_ioctl+0x8a9/0x1d00 drivers/net/tun.c:3187 do_vfs_ioctl+0x742/0x1720 fs/ioctl.c:47 ksys_ioctl fs/ioctl.c:742 [inline] __do_sys_ioctl fs/ioctl.c:749 [inline] __se_sys_ioctl fs/ioctl.c:747 [inline] __x64_sys_ioctl+0xd4/0x110 fs/ioctl.c:747 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 device_release+0x6b/0x190 drivers/base/core.c:1776 kobject_cleanup lib/kobject.c:716 [inline] kobject_release lib/kobject.c:747 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1e6/0x2f0 lib/kobject.c:764 tun_set_iff+0x870/0xdc0 drivers/net/tun.c:2924 __tun_chr_ioctl+0x8a9/0x1d00 drivers/net/tun.c:3187 do_vfs_ioctl+0x742/0x1720 fs/ioctl.c:47 ksys_ioctl fs/ioctl.c:742 [inline] __do_sys_ioctl fs/ioctl.c:749 [inline] __se_sys_ioctl fs/ioctl.c:747 [inline] __x64_sys_ioctl+0xd4/0x110 fs/ioctl.c:747 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 Memory state around the buggy address: ffff8881eb2ff080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8881eb2ff100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff8881eb2ff180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8881eb2ff200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8881eb2ff280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor instruction fetch in kernel mode #PF: error_code(0x0010) - not-present page PGD 1ec2b4067 P4D 1ec2b4067 PUD 0 Oops: 0010 [#1] PREEMPT SMP KASAN CPU: 1 PID: 3290 Comm: syz.0.812 Tainted: G B W 5.4.290-syzkaller-00002-g41adfeb3d639 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 RIP: 0010:0x0 Code: Bad RIP value. RSP: 0018:ffff8881f6f09d18 EFLAGS: 00010202 RAX: ffffffff8154e8ca RBX: 0000000000000101 RCX: ffff8881e9af1f80 RDX: 0000000000000101 RSI: 0000000000000000 RDI: ffff8881eb2ff1c0 RBP: ffff8881f6f09ec8 R08: ffffffff8154e50e R09: 0000000000000003 R10: ffffffffffffffff R11: dffffc0000000001 R12: 00000000ffffbc70 R13: dffffc0000000000 R14: 0000000000000000 R15: ffff8881eb2ff1c0 FS: 00007f673c4706c0(0000) GS:ffff8881f6f00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffffffffffd6 CR3: 00000001c489e000 CR4: 00000000003406a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Call Trace: 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/0x490 arch/x86/kernel/apic/apic.c:1161 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:834 RIP: 0010:unwind_next_frame+0x704/0x1ea0 arch/x86/kernel/unwind_orc.c:400 Code: 83 c6 70 4c 89 f7 4c 89 e6 e8 58 24 00 00 42 80 3c 3b 00 74 08 4c 89 e7 e8 f9 71 64 00 48 8b 84 24 c0 01 00 00 e9 4d 07 00 00 <48> 8b 04 24 48 8d 58 40 48 89 d8 48 c1 e8 03 42 80 3c 38 00 74 0e RSP: 0018:ffff8881e628e880 EFLAGS: 00000293 ORIG_RAX: ffffffffffffff13 RAX: 0000000000000002 RBX: ffff8881e628ebb8 RCX: ffffffff8656e6ec RDX: ffffffff86847ce0 RSI: ffffffff86847cdc RDI: ffffffff812fbdbc RBP: ffff8881e628eb70 R08: 000000000000000a R09: ffff8881e628ebd0 R10: 0000000000000000 R11: dffffc0000000001 R12: 1ffffffff0d08f9c R13: ffffffff86847cdc R14: ffff8881e628ebb8 R15: dffffc0000000000 arch_stack_walk+0x111/0x140 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x118/0x1c0 kernel/stacktrace.c:123 save_stack+0x95/0x880 mm/page_owner.c:122 __set_page_owner+0x33/0x1e0 mm/page_owner.c:191 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 __alloc_pages include/linux/gfp.h:503 [inline] __alloc_pages_node include/linux/gfp.h:516 [inline] alloc_pages_node include/linux/gfp.h:530 [inline] kmalloc_order mm/slab_common.c:1342 [inline] kmalloc_order_trace+0x2a/0x100 mm/slab_common.c:1358 __kmalloc_node include/linux/slab.h:422 [inline] kmalloc_node include/linux/slab.h:599 [inline] kvmalloc_node+0x7e/0xf0 mm/util.c:596 kvmalloc include/linux/mm.h:761 [inline] kvzalloc include/linux/mm.h:769 [inline] bpf_check+0xf4/0xb3e0 kernel/bpf/verifier.c:9561 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 RIP: 0033:0x7f673de06169 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:00007f673c470038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f673e01efa0 RCX: 00007f673de06169 RDX: 0000000000000048 RSI: 00002000000017c0 RDI: 0000000000000005 RBP: 00007f673de872a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f673e01efa0 R15: 00007ffea5696878 Modules linked in: CR2: 0000000000000000 ---[ end trace 41d57db1a6555fc3 ]--- RIP: 0010:0x0 Code: Bad RIP value. RSP: 0018:ffff8881f6f09d18 EFLAGS: 00010202 RAX: ffffffff8154e8ca RBX: 0000000000000101 RCX: ffff8881e9af1f80 RDX: 0000000000000101 RSI: 0000000000000000 RDI: ffff8881eb2ff1c0 RBP: ffff8881f6f09ec8 R08: ffffffff8154e50e R09: 0000000000000003 R10: ffffffffffffffff R11: dffffc0000000001 R12: 00000000ffffbc70 R13: dffffc0000000000 R14: 0000000000000000 R15: ffff8881eb2ff1c0 FS: 00007f673c4706c0(0000) GS:ffff8881f6f00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffffffffffd6 CR3: 00000001c489e000 CR4: 00000000003406a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 ---------------- Code disassembly (best guess): 0: 5e pop %rsi 1: 41 5f pop %r15 3: c3 ret 4: 44 89 f1 mov %r14d,%ecx 7: 80 e1 07 and $0x7,%cl a: 80 c1 03 add $0x3,%cl d: 38 c1 cmp %al,%cl f: 7c 95 jl 0xffffffa6 11: 4c 89 f7 mov %r14,%rdi 14: e8 eb 78 64 00 call 0x647904 19: eb 8b jmp 0xffffffa6 1b: 66 0f 1f 84 00 00 00 nopw 0x0(%rax,%rax,1) 22: 00 00 24: 55 push %rbp 25: 48 89 e5 mov %rsp,%rbp 28: 41 57 push %r15 * 2a: 41 56 push %r14 <-- trapping instruction 2c: 41 55 push %r13 2e: 41 54 push %r12 30: 53 push %rbx 31: 48 83 e4 e0 and $0xffffffffffffffe0,%rsp 35: 48 81 ec c0 02 00 00 sub $0x2c0,%rsp 3c: 49 89 fe mov %rdi,%r14 3f: 65 gs