================================================================== BUG: KASAN: slab-use-after-free in hlist_add_head include/linux/list.h:945 [inline] BUG: KASAN: slab-use-after-free in enqueue_timer+0xad/0x550 kernel/time/timer.c:605 Write of size 8 at addr ffff888067e69500 by task kworker/u4:2/41 CPU: 0 PID: 41 Comm: kworker/u4:2 Not tainted 6.3.0-syzkaller-12728-g348551ddaf31 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023 Workqueue: netns cleanup_net Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:351 [inline] print_report+0x15f/0x540 mm/kasan/report.c:462 kasan_report+0x172/0x1a0 mm/kasan/report.c:572 hlist_add_head include/linux/list.h:945 [inline] enqueue_timer+0xad/0x550 kernel/time/timer.c:605 internal_add_timer kernel/time/timer.c:634 [inline] __mod_timer+0xa72/0xf40 kernel/time/timer.c:1131 addrconf_rs_timer+0x450/0x610 net/ipv6/addrconf.c:3945 call_timer_fn+0x170/0x560 kernel/time/timer.c:1700 expire_timers kernel/time/timer.c:1751 [inline] __run_timers+0x64b/0x860 kernel/time/timer.c:2022 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:2035 __do_softirq+0x2a7/0x8fc kernel/softirq.c:571 invoke_softirq kernel/softirq.c:445 [inline] __irq_exit_rcu+0x155/0x230 kernel/softirq.c:650 irq_exit_rcu+0x5/0x20 kernel/softirq.c:662 sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1106 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:645 RIP: 0010:lock_acquire+0x256/0x520 kernel/locking/lockdep.c:5695 Code: 2b 00 74 08 4c 89 f7 e8 38 60 7a 00 f6 44 24 61 02 0f 85 84 01 00 00 41 f7 c7 00 02 00 00 74 01 fb 48 c7 44 24 40 0e 36 e0 45 <4b> c7 44 25 00 00 00 00 00 43 c7 44 25 09 00 00 00 00 43 c7 44 25 RSP: 0018:ffffc90000b278e0 EFLAGS: 00000206 RAX: 0000000000000001 RBX: 1ffff92000164f28 RCX: 0000000000000001 RDX: dffffc0000000000 RSI: ffffffff8aec01a0 RDI: ffffffff8b3dbb00 RBP: ffffc90000b27a40 R08: dffffc0000000000 R09: fffffbfff20a324d R10: 0000000000000000 R11: dffffc0000000001 R12: 1ffff92000164f24 R13: dffffc0000000000 R14: ffffc90000b27940 R15: 0000000000000246 rcu_lock_acquire+0x2a/0x30 include/linux/rcupdate.h:327 rcu_read_lock include/linux/rcupdate.h:773 [inline] inet_twsk_purge+0x124/0xad0 net/ipv4/inet_timewait_sock.c:292 ops_exit_list net/core/net_namespace.c:175 [inline] cleanup_net+0x763/0xb80 net/core/net_namespace.c:614 process_one_work+0x894/0x10c0 kernel/workqueue.c:2405 worker_thread+0xa5f/0x1210 kernel/workqueue.c:2552 kthread+0x2b0/0x340 kernel/kthread.c:379 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 Allocated by task 10912: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x94/0xa0 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:196 [inline] __do_kmalloc_node mm/slab_common.c:966 [inline] __kmalloc_node+0xb4/0x220 mm/slab_common.c:973 kmalloc_node include/linux/slab.h:579 [inline] kvmalloc_node+0x6e/0x180 mm/util.c:604 kvmalloc include/linux/slab.h:697 [inline] kvzalloc include/linux/slab.h:705 [inline] alloc_netdev_mqs+0x85/0xf30 net/core/dev.c:10626 rtnl_create_link+0x2f3/0xc00 net/core/rtnetlink.c:3315 rtnl_newlink_create net/core/rtnetlink.c:3433 [inline] __rtnl_newlink net/core/rtnetlink.c:3660 [inline] rtnl_newlink+0x1375/0x2000 net/core/rtnetlink.c:3673 rtnetlink_rcv_msg+0x821/0xf40 net/core/rtnetlink.c:6395 netlink_rcv_skb+0x1db/0x420 net/netlink/af_netlink.c:2546 netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline] netlink_unicast+0x7bf/0x990 net/netlink/af_netlink.c:1365 netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1913 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg net/socket.c:747 [inline] __sys_sendto+0x471/0x630 net/socket.c:2144 __do_sys_sendto net/socket.c:2156 [inline] __se_sys_sendto net/socket.c:2152 [inline] __x64_sys_sendto+0xda/0xf0 net/socket.c:2152 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 41: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:521 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook mm/slub.c:1807 [inline] slab_free mm/slub.c:3786 [inline] __kmem_cache_free+0x25c/0x3c0 mm/slub.c:3799 device_release+0x91/0x1c0 kobject_cleanup lib/kobject.c:683 [inline] kobject_release lib/kobject.c:714 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x224/0x460 lib/kobject.c:731 netdev_run_todo+0xe56/0xf40 net/core/dev.c:10400 default_device_exit_batch+0x5c5/0x630 net/core/dev.c:11392 ops_exit_list net/core/net_namespace.c:175 [inline] cleanup_net+0x763/0xb80 net/core/net_namespace.c:614 process_one_work+0x894/0x10c0 kernel/workqueue.c:2405 worker_thread+0xa5f/0x1210 kernel/workqueue.c:2552 kthread+0x2b0/0x340 kernel/kthread.c:379 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:491 insert_work+0x54/0x3d0 kernel/workqueue.c:1365 __queue_work+0xb37/0xf10 kernel/workqueue.c:1526 call_timer_fn+0x170/0x560 kernel/time/timer.c:1700 expire_timers kernel/time/timer.c:1746 [inline] __run_timers+0x676/0x860 kernel/time/timer.c:2022 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:2035 __do_softirq+0x2a7/0x8fc kernel/softirq.c:571 Second to last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:491 insert_work+0x54/0x3d0 kernel/workqueue.c:1365 __queue_work+0xb37/0xf10 kernel/workqueue.c:1526 call_timer_fn+0x170/0x560 kernel/time/timer.c:1700 expire_timers kernel/time/timer.c:1746 [inline] __run_timers+0x676/0x860 kernel/time/timer.c:2022 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:2035 __do_softirq+0x2a7/0x8fc kernel/softirq.c:571 The buggy address belongs to the object at ffff888067e68000 which belongs to the cache kmalloc-cg-8k of size 8192 The buggy address is located 5376 bytes inside of freed 8192-byte region [ffff888067e68000, ffff888067e6a000) The buggy address belongs to the physical page: page:ffffea00019f9a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888067e6c000 pfn:0x67e68 head:ffffea00019f9a00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff8880183231a1 anon flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000010200 ffff88801244f640 0000000000000000 dead000000000001 raw: ffff888067e6c000 0000000080020001 00000001ffffffff ffff8880183231a1 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d60c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5776, tgid 5776 (syz-executor.5), ts 102451494109, free_ts 13594761170 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1d2/0x1f0 mm/page_alloc.c:1722 prep_new_page mm/page_alloc.c:1729 [inline] get_page_from_freelist+0x31f8/0x3370 mm/page_alloc.c:3493 __alloc_pages+0x251/0x660 mm/page_alloc.c:4759 alloc_slab_page+0x6a/0x150 mm/slub.c:1851 allocate_slab mm/slub.c:1998 [inline] new_slab+0x84/0x2d0 mm/slub.c:2051 ___slab_alloc+0xa71/0x1080 mm/slub.c:3192 __slab_alloc mm/slub.c:3291 [inline] __slab_alloc_node mm/slub.c:3344 [inline] slab_alloc_node mm/slub.c:3441 [inline] __kmem_cache_alloc_node+0x1b4/0x280 mm/slub.c:3490 __do_kmalloc_node mm/slab_common.c:965 [inline] __kmalloc_node+0xa3/0x220 mm/slab_common.c:973 kmalloc_node include/linux/slab.h:579 [inline] kvmalloc_node+0x6e/0x180 mm/util.c:604 kvmalloc include/linux/slab.h:697 [inline] kvzalloc include/linux/slab.h:705 [inline] netif_alloc_netdev_queues net/core/dev.c:9948 [inline] alloc_netdev_mqs+0x841/0xf30 net/core/dev.c:10687 rtnl_create_link+0x2f3/0xc00 net/core/rtnetlink.c:3315 rtnl_newlink_create net/core/rtnetlink.c:3433 [inline] __rtnl_newlink net/core/rtnetlink.c:3660 [inline] rtnl_newlink+0x1375/0x2000 net/core/rtnetlink.c:3673 rtnetlink_rcv_msg+0x821/0xf40 net/core/rtnetlink.c:6395 netlink_rcv_skb+0x1db/0x420 net/netlink/af_netlink.c:2546 netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline] netlink_unicast+0x7bf/0x990 net/netlink/af_netlink.c:1365 netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1913 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1302 [inline] free_unref_page_prepare+0x8ee/0xa10 mm/page_alloc.c:2555 free_unref_page+0x33/0x3f0 mm/page_alloc.c:2650 free_contig_range+0x9a/0x150 mm/page_alloc.c:6985 destroy_args+0xfe/0x9a0 mm/debug_vm_pgtable.c:1023 debug_vm_pgtable+0x401/0x480 mm/debug_vm_pgtable.c:1403 do_one_initcall+0x239/0x7c0 init/main.c:1246 do_initcall_level+0x157/0x210 init/main.c:1319 do_initcalls+0x3f/0x80 init/main.c:1335 kernel_init_freeable+0x437/0x5c0 init/main.c:1571 kernel_init+0x19/0x290 init/main.c:1462 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 Memory state around the buggy address: ffff888067e69400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888067e69480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888067e69500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888067e69580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888067e69600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 2b 00 sub (%rax),%eax 2: 74 08 je 0xc 4: 4c 89 f7 mov %r14,%rdi 7: e8 38 60 7a 00 callq 0x7a6044 c: f6 44 24 61 02 testb $0x2,0x61(%rsp) 11: 0f 85 84 01 00 00 jne 0x19b 17: 41 f7 c7 00 02 00 00 test $0x200,%r15d 1e: 74 01 je 0x21 20: fb sti 21: 48 c7 44 24 40 0e 36 movq $0x45e0360e,0x40(%rsp) 28: e0 45 * 2a: 4b c7 44 25 00 00 00 movq $0x0,0x0(%r13,%r12,1) <-- trapping instruction 31: 00 00 33: 43 c7 44 25 09 00 00 movl $0x0,0x9(%r13,%r12,1) 3a: 00 00 3c: 43 rex.XB 3d: c7 .byte 0xc7 3e: 44 rex.R 3f: 25 .byte 0x25