================================================================== 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 ffff8881def331c8 by task syz.0.547/2579 CPU: 1 PID: 2579 Comm: syz.0.547 Not tainted 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:memory_is_nonzero mm/kasan/generic.c:119 [inline] RIP: 0010:memory_is_poisoned_n mm/kasan/generic.c:134 [inline] RIP: 0010:memory_is_poisoned mm/kasan/generic.c:165 [inline] RIP: 0010:check_memory_region_inline mm/kasan/generic.c:181 [inline] RIP: 0010:check_memory_region+0x162/0x280 mm/kasan/generic.c:191 Code: 44 29 fb 49 01 d9 4d 29 ce 4c 89 f5 48 8d 5d 07 48 85 ed 48 0f 49 dd 48 c1 eb 03 85 db 74 22 31 ed 4d 8b 34 29 4d 85 f6 75 44 <48> 83 c5 08 ff cb 75 ef 4d 29 ca 49 29 ea 4d 01 da 49 01 e9 4c 89 RSP: 0018:ffff8881d28befc8 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13 RAX: 0000000000000001 RBX: 0000000000000055 RCX: ffffffff81720264 RDX: 0000000000000000 RSI: 0000000000001c00 RDI: ffff8881e5524000 RBP: 00000000000000d8 R08: dffffc0000000000 R09: ffffed103caa4800 R10: 1ffff1103caa4b7f R11: dffffc0000000001 R12: ffffffff81720264 R13: ffff8881e8f50200 R14: 0000000000000000 R15: 0000000000000000 memcpy+0x25/0x50 mm/kasan/common.c:123 copy_stack_state kernel/bpf/verifier.c:555 [inline] copy_func_state kernel/bpf/verifier.c:712 [inline] copy_verifier_state+0x814/0xbf0 kernel/bpf/verifier.c:751 is_state_visited kernel/bpf/verifier.c:7702 [inline] do_check+0x3286/0x9820 kernel/bpf/verifier.c:7837 bpf_check+0x2183/0xb3e0 kernel/bpf/verifier.c:9637 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:0x7fc397c2f169 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:00007fc396299038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007fc397e47fa0 RCX: 00007fc397c2f169 RDX: 0000000000000048 RSI: 0000200000000200 RDI: 0000000000000005 RBP: 00007fc397cb02a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fc397e47fa0 R15: 00007ffe6971de88 The buggy address belongs to the page: page:ffffea00077bccc0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 flags: 0x8000000000000000() raw: 8000000000000000 0000000000000000 ffffea00077bcc88 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: ffff8881def33080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8881def33100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff8881def33180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8881def33200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8881def33280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== ---------------- Code disassembly (best guess): 0: 44 29 fb sub %r15d,%ebx 3: 49 01 d9 add %rbx,%r9 6: 4d 29 ce sub %r9,%r14 9: 4c 89 f5 mov %r14,%rbp c: 48 8d 5d 07 lea 0x7(%rbp),%rbx 10: 48 85 ed test %rbp,%rbp 13: 48 0f 49 dd cmovns %rbp,%rbx 17: 48 c1 eb 03 shr $0x3,%rbx 1b: 85 db test %ebx,%ebx 1d: 74 22 je 0x41 1f: 31 ed xor %ebp,%ebp 21: 4d 8b 34 29 mov (%r9,%rbp,1),%r14 25: 4d 85 f6 test %r14,%r14 28: 75 44 jne 0x6e * 2a: 48 83 c5 08 add $0x8,%rbp <-- trapping instruction 2e: ff cb dec %ebx 30: 75 ef jne 0x21 32: 4d 29 ca sub %r9,%r10 35: 49 29 ea sub %rbp,%r10 38: 4d 01 da add %r11,%r10 3b: 49 01 e9 add %rbp,%r9 3e: 4c rex.WR 3f: 89 .byte 0x89