netlink: 160 bytes leftover after parsing attributes in process `syz.2.3960'. ================================================================== BUG: KASAN: use-after-free in bq_enqueue kernel/bpf/cpumap.c:749 [inline] BUG: KASAN: use-after-free in cpu_map_enqueue+0xb4/0x370 kernel/bpf/cpumap.c:775 Read of size 8 at addr ffff8881298a6508 by task syz.2.3960/16973 CPU: 0 PID: 16973 Comm: syz.2.3960 Not tainted 6.1.99-syzkaller-00108-gd4dab27b9d1c #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:316 [inline] print_report+0x158/0x4e0 mm/kasan/report.c:427 kasan_report+0x13c/0x170 mm/kasan/report.c:531 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:351 bq_enqueue kernel/bpf/cpumap.c:749 [inline] cpu_map_enqueue+0xb4/0x370 kernel/bpf/cpumap.c:775 __xdp_do_redirect_frame net/core/filter.c:4291 [inline] xdp_do_redirect+0x5b0/0xc60 net/core/filter.c:4335 tun_xdp_act+0xdb/0xc00 drivers/net/tun.c:1625 tun_build_skb drivers/net/tun.c:1715 [inline] tun_get_user+0xb35/0x3a90 drivers/net/tun.c:1818 tun_chr_write_iter+0x129/0x210 drivers/net/tun.c:2044 call_write_iter include/linux/fs.h:2274 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0xaf6/0xed0 fs/read_write.c:584 ksys_write+0x199/0x2c0 fs/read_write.c:637 __do_sys_write fs/read_write.c:649 [inline] __se_sys_write fs/read_write.c:646 [inline] __x64_sys_write+0x7b/0x90 fs/read_write.c:646 x64_sys_call+0x2f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:2 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7f12a2b7cadf Code: 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 c9 8d 02 00 48 8b 54 24 18 48 8b 74 24 10 41 89 c0 8b 7c 24 08 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 31 44 89 c7 48 89 44 24 08 e8 1c 8e 02 00 48 RSP: 002b:00007f12a3a37000 EFLAGS: 00000293 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f12a2d36058 RCX: 00007f12a2b7cadf RDX: 000000000000003e RSI: 0000000020002340 RDI: 00000000000000c8 RBP: 00007f12a2bf0296 R08: 0000000000000000 R09: 0000000000000000 R10: 000000000000003e R11: 0000000000000293 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f12a2d36058 R15: 00007ffd4a2f5058 Allocated by task 16623: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_alloc_info+0x1f/0x30 mm/kasan/generic.c:505 ____kasan_kmalloc mm/kasan/common.c:379 [inline] __kasan_kmalloc+0x9c/0xb0 mm/kasan/common.c:388 kasan_kmalloc include/linux/kasan.h:212 [inline] kmalloc_trace+0x44/0xa0 mm/slab_common.c:1052 kmalloc include/linux/slab.h:556 [inline] kzalloc include/linux/slab.h:692 [inline] kset_create lib/kobject.c:950 [inline] kset_create_and_add+0x5c/0x2b0 lib/kobject.c:993 register_queue_kobjects net/core/net-sysfs.c:1760 [inline] netdev_register_kobject+0x1a6/0x320 net/core/net-sysfs.c:2013 register_netdevice+0xe43/0x1490 net/core/dev.c:10107 veth_newlink+0x7fc/0xc70 drivers/net/veth.c:1775 rtnl_newlink_create net/core/rtnetlink.c:3390 [inline] __rtnl_newlink net/core/rtnetlink.c:3610 [inline] rtnl_newlink+0x14c6/0x2030 net/core/rtnetlink.c:3623 rtnetlink_rcv_msg+0x9a5/0xca0 net/core/rtnetlink.c:6121 netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2518 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:6139 netlink_unicast_kernel net/netlink/af_netlink.c:1327 [inline] netlink_unicast+0x906/0xab0 net/netlink/af_netlink.c:1353 netlink_sendmsg+0xa15/0xd30 net/netlink/af_netlink.c:1875 sock_sendmsg_nosec net/socket.c:716 [inline] __sock_sendmsg net/socket.c:728 [inline] __sys_sendto+0x480/0x600 net/socket.c:2138 __do_sys_sendto net/socket.c:2150 [inline] __se_sys_sendto net/socket.c:2146 [inline] __x64_sys_sendto+0xe5/0x100 net/socket.c:2146 x64_sys_call+0x15c/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:45 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Freed by task 2645: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:516 ____kasan_slab_free+0x131/0x180 mm/kasan/common.c:241 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:249 kasan_slab_free include/linux/kasan.h:178 [inline] slab_free_hook mm/slub.c:1745 [inline] slab_free_freelist_hook mm/slub.c:1771 [inline] slab_free mm/slub.c:3684 [inline] __kmem_cache_free+0x218/0x3b0 mm/slub.c:3697 kfree+0x7a/0xf0 mm/slab_common.c:1009 kset_release+0x19/0x20 lib/kobject.c:913 kobject_cleanup lib/kobject.c:681 [inline] kobject_release lib/kobject.c:712 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x178/0x260 lib/kobject.c:729 kset_unregister+0x6e/0x80 lib/kobject.c:876 remove_queue_kobjects net/core/net-sysfs.c:1829 [inline] netdev_unregister_kobject+0x175/0x260 net/core/net-sysfs.c:1977 unregister_netdevice_many+0x122c/0x1740 net/core/dev.c:10917 default_device_exit_batch+0x975/0xa00 net/core/dev.c:11403 ops_exit_list net/core/net_namespace.c:177 [inline] cleanup_net+0x6c9/0xbf0 net/core/net_namespace.c:604 process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299 worker_thread+0xa60/0x1260 kernel/workqueue.c:2446 kthread+0x26d/0x300 kernel/kthread.c:386 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+0xb4/0xc0 mm/kasan/generic.c:486 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496 __call_rcu_common kernel/rcu/tree.c:2806 [inline] call_rcu+0xee/0x1340 kernel/rcu/tree.c:2925 tnode_free net/ipv4/fib_trie.c:496 [inline] replace+0x19b/0x4b0 net/ipv4/fib_trie.c:522 inflate net/ipv4/fib_trie.c:624 [inline] resize+0xbaf/0x1d60 net/ipv4/fib_trie.c:869 trie_rebalance net/ipv4/fib_trie.c:1106 [inline] fib_insert_node net/ipv4/fib_trie.c:1150 [inline] fib_insert_alias+0xb20/0x1060 net/ipv4/fib_trie.c:1164 fib_table_insert+0xa01/0x20a0 net/ipv4/fib_trie.c:1378 fib_magic net/ipv4/fib_frontend.c:1104 [inline] fib_add_ifaddr+0x43f/0x15e0 net/ipv4/fib_frontend.c:1126 fib_inetaddr_event+0x159/0x310 net/ipv4/fib_frontend.c:1440 notifier_call_chain kernel/notifier.c:87 [inline] blocking_notifier_call_chain+0xbb/0x140 kernel/notifier.c:382 __inet_insert_ifa+0x8fb/0xb10 net/ipv4/devinet.c:554 inet_rtm_newaddr+0x8f7/0x1780 net/ipv4/devinet.c:960 rtnetlink_rcv_msg+0x9a5/0xca0 net/core/rtnetlink.c:6121 netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2518 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:6139 netlink_unicast_kernel net/netlink/af_netlink.c:1327 [inline] netlink_unicast+0x906/0xab0 net/netlink/af_netlink.c:1353 netlink_sendmsg+0xa15/0xd30 net/netlink/af_netlink.c:1875 sock_sendmsg_nosec net/socket.c:716 [inline] __sock_sendmsg net/socket.c:728 [inline] __sys_sendto+0x480/0x600 net/socket.c:2138 __do_sys_sendto net/socket.c:2150 [inline] __se_sys_sendto net/socket.c:2146 [inline] __x64_sys_sendto+0xe5/0x100 net/socket.c:2146 x64_sys_call+0x15c/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:45 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Second to last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496 __call_rcu_common kernel/rcu/tree.c:2806 [inline] call_rcu+0xee/0x1340 kernel/rcu/tree.c:2925 neigh_parms_release+0x1f2/0x230 net/core/neighbour.c:1751 addrconf_ifdown+0x1815/0x1ab0 net/ipv6/addrconf.c:3957 addrconf_notify+0x32f/0xe10 notifier_call_chain kernel/notifier.c:87 [inline] raw_notifier_call_chain+0x8c/0xf0 kernel/notifier.c:455 call_netdevice_notifiers_info net/core/dev.c:1978 [inline] call_netdevice_notifiers_extack net/core/dev.c:2016 [inline] call_netdevice_notifiers net/core/dev.c:2030 [inline] unregister_netdevice_many+0xe2a/0x1740 net/core/dev.c:10890 unregister_netdevice_queue+0x2e6/0x350 net/core/dev.c:10821 unregister_netdevice include/linux/netdevice.h:3100 [inline] __tun_detach+0xd14/0x1510 drivers/net/tun.c:685 tun_detach drivers/net/tun.c:701 [inline] tun_chr_close+0x92/0x140 drivers/net/tun.c:3489 __fput+0x1e5/0x870 fs/file_table.c:320 ____fput+0x15/0x20 fs/file_table.c:348 task_work_run+0x24d/0x2e0 kernel/task_work.c:179 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xbd5/0x2b80 kernel/exit.c:877 do_group_exit+0x21a/0x2d0 kernel/exit.c:1027 get_signal+0x169d/0x1820 kernel/signal.c:2880 arch_do_signal_or_restart+0xb0/0x16f0 arch/x86/kernel/signal.c:871 exit_to_user_mode_loop+0x74/0xa0 kernel/entry/common.c:174 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:210 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline] syscall_exit_to_user_mode+0x26/0x130 kernel/entry/common.c:303 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87 entry_SYSCALL_64_after_hwframe+0x68/0xd2 The buggy address belongs to the object at ffff8881298a6500 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 8 bytes inside of 192-byte region [ffff8881298a6500, ffff8881298a65c0) The buggy address belongs to the physical page: page:ffffea0004a62980 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1298a6 flags: 0x4000000000000200(slab|zone=1) raw: 4000000000000200 ffffea000441be80 dead000000000004 ffff888100042c00 raw: 0000000000000000 0000000000100010 00000001ffffffff 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 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 1217, tgid 1217 (syz-executor), ts 73822192331, free_ts 73765591020 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x213/0x220 mm/page_alloc.c:2590 prep_new_page+0x1b/0x110 mm/page_alloc.c:2597 get_page_from_freelist+0x27ea/0x2870 mm/page_alloc.c:4425 __alloc_pages+0x3a1/0x780 mm/page_alloc.c:5714 alloc_slab_page+0x6c/0xf0 allocate_slab mm/slub.c:1962 [inline] new_slab+0x90/0x3e0 mm/slub.c:2015 ___slab_alloc+0x6f9/0xb80 mm/slub.c:3203 __slab_alloc+0x5d/0xa0 mm/slub.c:3302 slab_alloc_node mm/slub.c:3387 [inline] __kmem_cache_alloc_node+0x1af/0x250 mm/slub.c:3460 __do_kmalloc_node mm/slab_common.c:956 [inline] __kmalloc+0xa3/0x1e0 mm/slab_common.c:970 kmalloc include/linux/slab.h:561 [inline] kzalloc include/linux/slab.h:692 [inline] ops_init+0x8e/0x480 net/core/net_namespace.c:128 setup_net+0x4ca/0xd60 net/core/net_namespace.c:335 copy_net_ns+0x35f/0x5b0 net/core/net_namespace.c:481 create_new_namespaces+0x416/0x670 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0x126/0x180 kernel/nsproxy.c:226 ksys_unshare+0x542/0xa00 kernel/fork.c:3312 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1498 [inline] free_pcp_prepare mm/page_alloc.c:1572 [inline] free_unref_page_prepare+0x83d/0x850 mm/page_alloc.c:3498 free_unref_page+0xb2/0x5c0 mm/page_alloc.c:3594 free_the_page mm/page_alloc.c:798 [inline] __free_pages+0x61/0xf0 mm/page_alloc.c:5803 __vunmap+0x9f3/0xb60 mm/vmalloc.c:2728 __vfree mm/vmalloc.c:2776 [inline] vfree+0x5c/0x80 mm/vmalloc.c:2807 kcov_put kernel/kcov.c:428 [inline] kcov_close+0x2b/0x50 kernel/kcov.c:524 __fput+0x1e5/0x870 fs/file_table.c:320 ____fput+0x15/0x20 fs/file_table.c:348 task_work_run+0x24d/0x2e0 kernel/task_work.c:179 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xbd5/0x2b80 kernel/exit.c:877 do_group_exit+0x21a/0x2d0 kernel/exit.c:1027 get_signal+0x169d/0x1820 kernel/signal.c:2880 arch_do_signal_or_restart+0xb0/0x16f0 arch/x86/kernel/signal.c:871 exit_to_user_mode_loop+0x74/0xa0 kernel/entry/common.c:174 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:210 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline] syscall_exit_to_user_mode+0x26/0x130 kernel/entry/common.c:303 Memory state around the buggy address: ffff8881298a6400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881298a6480: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff8881298a6500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881298a6580: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff8881298a6600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== general protection fault, probably for non-canonical address 0xe0b04d43dedc0155: 0000 [#1] PREEMPT SMP KASAN KASAN: maybe wild-memory-access in range [0x05828a1ef6e00aa8-0x05828a1ef6e00aaf] CPU: 0 PID: 16973 Comm: syz.2.3960 Tainted: G B 6.1.99-syzkaller-00108-gd4dab27b9d1c #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 RIP: 0010:bq_enqueue kernel/bpf/cpumap.c:751 [inline] RIP: 0010:cpu_map_enqueue+0x113/0x370 kernel/bpf/cpumap.c:775 Code: e8 03 42 80 3c 30 00 74 08 48 89 df e8 16 d4 24 00 4c 8b 23 4f 8d 74 3c 58 4d 89 f5 49 c1 ed 03 48 b8 00 00 00 00 00 fc ff df <41> 0f b6 44 05 00 84 c0 0f 85 a8 01 00 00 4d 01 fc 41 8b 1e bf 08 RSP: 0018:ffffc90000f8f7a8 EFLAGS: 00010207 RAX: dffffc0000000000 RBX: ffffffff86745880 RCX: 0000000000040000 RDX: ffffc90002033000 RSI: 000000000003ffff RDI: 0000000000040000 RBP: ffffc90000f8f7e0 R08: ffffffff81980e9e R09: fffffbfff0f6dafd R10: 0000000000000000 R11: dffffc0000000001 R12: ffff8881f6e00000 R13: 00b05143dedc0155 R14: 05828a1ef6e00aad R15: 0583019d00000a55 FS: 00007f12a3a376c0(0000) GS:ffff8881f6e00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f12a3a36f98 CR3: 0000000135200000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: __xdp_do_redirect_frame net/core/filter.c:4291 [inline] xdp_do_redirect+0x5b0/0xc60 net/core/filter.c:4335 tun_xdp_act+0xdb/0xc00 drivers/net/tun.c:1625 tun_build_skb drivers/net/tun.c:1715 [inline] tun_get_user+0xb35/0x3a90 drivers/net/tun.c:1818 tun_chr_write_iter+0x129/0x210 drivers/net/tun.c:2044 call_write_iter include/linux/fs.h:2274 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0xaf6/0xed0 fs/read_write.c:584 ksys_write+0x199/0x2c0 fs/read_write.c:637 __do_sys_write fs/read_write.c:649 [inline] __se_sys_write fs/read_write.c:646 [inline] __x64_sys_write+0x7b/0x90 fs/read_write.c:646 x64_sys_call+0x2f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:2 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7f12a2b7cadf Code: 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 c9 8d 02 00 48 8b 54 24 18 48 8b 74 24 10 41 89 c0 8b 7c 24 08 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 31 44 89 c7 48 89 44 24 08 e8 1c 8e 02 00 48 RSP: 002b:00007f12a3a37000 EFLAGS: 00000293 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f12a2d36058 RCX: 00007f12a2b7cadf RDX: 000000000000003e RSI: 0000000020002340 RDI: 00000000000000c8 RBP: 00007f12a2bf0296 R08: 0000000000000000 R09: 0000000000000000 R10: 000000000000003e R11: 0000000000000293 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f12a2d36058 R15: 00007ffd4a2f5058 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:bq_enqueue kernel/bpf/cpumap.c:751 [inline] RIP: 0010:cpu_map_enqueue+0x113/0x370 kernel/bpf/cpumap.c:775 Code: e8 03 42 80 3c 30 00 74 08 48 89 df e8 16 d4 24 00 4c 8b 23 4f 8d 74 3c 58 4d 89 f5 49 c1 ed 03 48 b8 00 00 00 00 00 fc ff df <41> 0f b6 44 05 00 84 c0 0f 85 a8 01 00 00 4d 01 fc 41 8b 1e bf 08 RSP: 0018:ffffc90000f8f7a8 EFLAGS: 00010207 RAX: dffffc0000000000 RBX: ffffffff86745880 RCX: 0000000000040000 RDX: ffffc90002033000 RSI: 000000000003ffff RDI: 0000000000040000 RBP: ffffc90000f8f7e0 R08: ffffffff81980e9e R09: fffffbfff0f6dafd R10: 0000000000000000 R11: dffffc0000000001 R12: ffff8881f6e00000 R13: 00b05143dedc0155 R14: 05828a1ef6e00aad R15: 0583019d00000a55 FS: 00007f12a3a376c0(0000) GS:ffff8881f6e00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f12a3a36f98 CR3: 0000000135200000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 ---------------- Code disassembly (best guess): 0: e8 03 42 80 3c call 0x3c804208 5: 30 00 xor %al,(%rax) 7: 74 08 je 0x11 9: 48 89 df mov %rbx,%rdi c: e8 16 d4 24 00 call 0x24d427 11: 4c 8b 23 mov (%rbx),%r12 14: 4f 8d 74 3c 58 lea 0x58(%r12,%r15,1),%r14 19: 4d 89 f5 mov %r14,%r13 1c: 49 c1 ed 03 shr $0x3,%r13 20: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax 27: fc ff df * 2a: 41 0f b6 44 05 00 movzbl 0x0(%r13,%rax,1),%eax <-- trapping instruction 30: 84 c0 test %al,%al 32: 0f 85 a8 01 00 00 jne 0x1e0 38: 4d 01 fc add %r15,%r12 3b: 41 8b 1e mov (%r14),%ebx 3e: bf .byte 0xbf 3f: 08 .byte 0x8