================================================================== 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 ffff8881d4cc71c8 by task udevd/164 CPU: 1 PID: 164 Comm: udevd 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:get_reg+0x105/0x220 arch/x86/kernel/unwind_orc.c:400 Code: 4c 89 e7 41 89 f4 e8 ea 59 64 00 44 89 e6 4c 8d 64 24 40 48 c7 44 24 40 00 00 00 00 89 f0 49 8d 3c c7 4c 89 e6 e8 9b 0b 00 00 <42> 80 3c 2b 00 74 08 4c 89 e7 e8 3c 59 64 00 4c 8b 7c 24 40 eb 78 RSP: 0018:ffff8881ec2175a0 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13 RAX: 000055aadaed42e0 RBX: 1ffff1103d842ebc RCX: ffffffff86771794 RDX: ffff8881ec217900 RSI: ffff8881ec2175e0 RDI: ffff8881ec217f78 RBP: ffff8881ec217670 R08: 0000000000000004 R09: ffff8881ec2179d0 R10: 0000000000000000 R11: dffffc0000000001 R12: ffff8881ec2175e0 R13: dffffc0000000000 R14: 1ffff1103d842eb8 R15: ffff8881ec217f58 unwind_next_frame+0x1574/0x1ea0 arch/x86/kernel/unwind_orc.c:574 arch_stack_walk+0x111/0x140 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x118/0x1c0 kernel/stacktrace.c:123 save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] __kasan_kmalloc+0x171/0x210 mm/kasan/common.c:529 slab_post_alloc_hook mm/slab.h:584 [inline] slab_alloc_node mm/slub.c:2829 [inline] slab_alloc mm/slub.c:2837 [inline] kmem_cache_alloc+0xd9/0x250 mm/slub.c:2842 getname_flags+0xb8/0x4e0 fs/namei.c:141 do_sys_open+0x357/0x810 fs/open.c:1117 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 RIP: 0033:0x7f4d0e1ce477 Code: 10 00 00 00 44 8b 54 24 e0 48 89 44 24 c0 48 8d 44 24 d0 48 89 44 24 c8 44 89 c2 4c 89 ce bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 76 10 48 8b 15 82 69 0d 00 f7 d8 64 89 02 48 83 RSP: 002b:00007fff7dc0af18 EFLAGS: 00000287 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 000055aadae733f0 RCX: 00007f4d0e1ce477 RDX: 0000000000090800 RSI: 000055aadae70120 RDI: 00000000ffffff9c RBP: 000055aadaed42e0 R08: 0000000000090800 R09: 000055aadae70120 R10: 0000000000000000 R11: 0000000000000287 R12: 000055aadae70120 R13: 00000000000000fd R14: 000055aab8e7b1c4 R15: 0000000000000000 The buggy address belongs to the page: page:ffffea00075331c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 flags: 0x8000000000000000() raw: 8000000000000000 0000000000000000 ffffea00075331c8 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: ffff8881d4cc7080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8881d4cc7100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff8881d4cc7180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8881d4cc7200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8881d4cc7280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== ---------------- Code disassembly (best guess): 0: 4c 89 e7 mov %r12,%rdi 3: 41 89 f4 mov %esi,%r12d 6: e8 ea 59 64 00 call 0x6459f5 b: 44 89 e6 mov %r12d,%esi e: 4c 8d 64 24 40 lea 0x40(%rsp),%r12 13: 48 c7 44 24 40 00 00 movq $0x0,0x40(%rsp) 1a: 00 00 1c: 89 f0 mov %esi,%eax 1e: 49 8d 3c c7 lea (%r15,%rax,8),%rdi 22: 4c 89 e6 mov %r12,%rsi 25: e8 9b 0b 00 00 call 0xbc5 * 2a: 42 80 3c 2b 00 cmpb $0x0,(%rbx,%r13,1) <-- trapping instruction 2f: 74 08 je 0x39 31: 4c 89 e7 mov %r12,%rdi 34: e8 3c 59 64 00 call 0x645975 39: 4c 8b 7c 24 40 mov 0x40(%rsp),%r15 3e: eb 78 jmp 0xb8