================================================================== BUG: KASAN: use-after-free in cpu_map_generic_redirect+0x1c7/0x650 kernel/bpf/cpumap.c:788 Read of size 8 at addr ffff88802765c018 by task syz.1.3390/19956 CPU: 0 PID: 19956 Comm: syz.1.3390 Tainted: G W 6.1.120-syzkaller-00773-g52f863f820fd #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description mm/kasan/report.c:316 [inline] print_report+0x15f/0x4f0 mm/kasan/report.c:427 kasan_report+0x136/0x160 mm/kasan/report.c:531 cpu_map_generic_redirect+0x1c7/0x650 kernel/bpf/cpumap.c:788 xdp_do_generic_redirect_map net/core/filter.c:4419 [inline] xdp_do_generic_redirect+0x401/0x850 net/core/filter.c:4466 do_xdp_generic+0x50b/0x6d0 net/core/dev.c:4955 tun_get_user+0x261e/0x42d0 drivers/net/tun.c:1920 tun_chr_write_iter+0x10c/0x1f0 drivers/net/tun.c:2044 call_write_iter include/linux/fs.h:2265 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x857/0xbc0 fs/read_write.c:584 ksys_write+0x19c/0x2c0 fs/read_write.c:637 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:0x7ff8e59847cf Code: 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 f9 92 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 4c 93 02 00 48 RSP: 002b:00007ff8e671f000 EFLAGS: 00000293 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007ff8e5b75fa0 RCX: 00007ff8e59847cf RDX: 0000000000000d86 RSI: 0000000020002340 RDI: 00000000000000c8 RBP: 00007ff8e5a01a20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000d86 R11: 0000000000000293 R12: 0000000000000000 R13: 0000000000000000 R14: 00007ff8e5b75fa0 R15: 00007ffc07c4e038 Allocated by task 19874: 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+0x97/0xb0 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slab_common.c:936 [inline] __kmalloc+0xb2/0x230 mm/slab_common.c:949 kmalloc include/linux/slab.h:568 [inline] kzalloc include/linux/slab.h:699 [inline] __register_sysctl_table+0xdc/0x11e0 fs/proc/proc_sysctl.c:1341 setup_mq_sysctls+0x513/0x590 ipc/mq_sysctl.c:147 create_ipc_ns ipc/namespace.c:63 [inline] copy_ipcs+0x321/0x530 ipc/namespace.c:99 create_new_namespaces+0x221/0x7a0 kernel/nsproxy.c:90 unshare_nsproxy_namespaces+0x11e/0x170 kernel/nsproxy.c:226 ksys_unshare+0x531/0xa40 kernel/fork.c:3201 __do_sys_unshare kernel/fork.c:3272 [inline] __se_sys_unshare kernel/fork.c:3270 [inline] __x64_sys_unshare+0x34/0x40 kernel/fork.c:3270 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 4294: 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:516 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook mm/slub.c:1750 [inline] slab_free mm/slub.c:3661 [inline] kmem_cache_free_bulk+0x4fa/0x750 mm/slub.c:3779 kfree_bulk include/linux/slab.h:475 [inline] kfree_rcu_work+0x343/0x890 kernel/rcu/tree.c:3087 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439 kthread+0x28d/0x320 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 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:486 kvfree_call_rcu+0x116/0x8c0 kernel/rcu/tree.c:3401 drop_sysctl_table+0x317/0x460 fs/proc/proc_sysctl.c:1727 unregister_sysctl_table+0x86/0x130 fs/proc/proc_sysctl.c:1765 retire_mq_sysctls+0x5a/0x80 ipc/mq_sysctl.c:163 free_ipc_ns ipc/namespace.c:143 [inline] free_ipc+0x8c/0x1d0 ipc/namespace.c:159 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439 kthread+0x28d/0x320 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 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:486 kvfree_call_rcu+0x116/0x8c0 kernel/rcu/tree.c:3401 drop_sysctl_table+0x317/0x460 fs/proc/proc_sysctl.c:1727 unregister_sysctl_table+0x86/0x130 fs/proc/proc_sysctl.c:1765 retire_mq_sysctls+0x5a/0x80 ipc/mq_sysctl.c:163 free_ipc_ns ipc/namespace.c:143 [inline] free_ipc+0x8c/0x1d0 ipc/namespace.c:159 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439 kthread+0x28d/0x320 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 The buggy address belongs to the object at ffff88802765c000 which belongs to the cache kmalloc-cg-256 of size 256 The buggy address is located 24 bytes inside of 256-byte region [ffff88802765c000, ffff88802765c100) The buggy address belongs to the physical page: page:ffffea00009d9700 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2765c head:ffffea00009d9700 order:1 compound_mapcount:0 compound_pincount:0 memcg:ffff8880794e2c01 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0000a72c80 dead000000000007 ffff888017c42c80 raw: 0000000000000000 0000000080100010 00000001ffffffff ffff8880794e2c01 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4259, tgid 4259 (syz-executor), ts 70270701780, free_ts 70099899752 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2532 prep_new_page mm/page_alloc.c:2539 [inline] get_page_from_freelist+0x3731/0x38d0 mm/page_alloc.c:4328 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5605 alloc_slab_page+0x6a/0x150 mm/slub.c:1794 allocate_slab mm/slub.c:1939 [inline] new_slab+0x84/0x2d0 mm/slub.c:1992 ___slab_alloc+0xc20/0x1270 mm/slub.c:3180 __slab_alloc mm/slub.c:3279 [inline] slab_alloc_node mm/slub.c:3364 [inline] __kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437 __do_kmalloc_node mm/slab_common.c:935 [inline] __kmalloc+0xa1/0x230 mm/slab_common.c:949 kmalloc include/linux/slab.h:568 [inline] kzalloc include/linux/slab.h:699 [inline] fib_default_rule_add+0x4a/0x3a0 net/core/fib_rules.c:60 fib6_rules_net_init+0x40/0x100 net/ipv6/fib6_rules.c:488 ops_init+0x35d/0x610 net/core/net_namespace.c:138 setup_net+0x4b5/0xb90 net/core/net_namespace.c:335 copy_net_ns+0x392/0x5d0 net/core/net_namespace.c:481 create_new_namespaces+0x425/0x7a0 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0x11e/0x170 kernel/nsproxy.c:226 ksys_unshare+0x531/0xa40 kernel/fork.c:3201 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1459 [inline] free_pcp_prepare mm/page_alloc.c:1509 [inline] free_unref_page_prepare+0x12a6/0x15b0 mm/page_alloc.c:3384 free_unref_page+0x33/0x3e0 mm/page_alloc.c:3479 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x156/0x170 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737 slab_alloc_node mm/slub.c:3398 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x10c/0x2d0 mm/slub.c:3422 skb_clone+0x1e5/0x360 net/core/skbuff.c:1660 hci_event_packet+0x221/0x1510 net/bluetooth/hci_event.c:7391 hci_rx_work+0x3a6/0xd10 net/bluetooth/hci_core.c:4090 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439 kthread+0x28d/0x320 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Memory state around the buggy address: ffff88802765bf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88802765bf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88802765c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802765c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802765c100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================