================================================================== BUG: KASAN: slab-use-after-free in dev_map_enqueue+0x40/0x3e0 kernel/bpf/devmap.c:539 Read of size 8 at addr ffff88806c4a6b00 by task syz.1.3751/16828 CPU: 0 PID: 16828 Comm: syz.1.3751 Not tainted 6.10.0-rc6-syzkaller-00158-g0005b2dc43f9 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 dev_map_enqueue+0x40/0x3e0 kernel/bpf/devmap.c:539 __xdp_do_redirect_frame net/core/filter.c:4402 [inline] xdp_do_redirect_frame+0x2a6/0x660 net/core/filter.c:4456 xdp_test_run_batch net/bpf/test_run.c:336 [inline] bpf_test_run_xdp_live+0xe60/0x1e60 net/bpf/test_run.c:384 bpf_prog_test_run_xdp+0x80e/0x11b0 net/bpf/test_run.c:1281 bpf_prog_test_run+0x33a/0x3b0 kernel/bpf/syscall.c:4292 __sys_bpf+0x48d/0x810 kernel/bpf/syscall.c:5706 __do_sys_bpf kernel/bpf/syscall.c:5795 [inline] __se_sys_bpf kernel/bpf/syscall.c:5793 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5793 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f19c9375bd9 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:00007f19ca181048 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f19c9503f60 RCX: 00007f19c9375bd9 RDX: 0000000000000050 RSI: 0000000020000240 RDI: 000000000000000a RBP: 00007f19c93e4aa1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f19c9503f60 R15: 00007fff769bde18 Allocated by task 15403: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slub.c:4123 [inline] __kmalloc_node_noprof+0x22a/0x440 mm/slub.c:4130 kmalloc_node_noprof include/linux/slab.h:681 [inline] kvmalloc_node_noprof+0x72/0x190 mm/util.c:634 allocate_hook_entries_size net/netfilter/core.c:61 [inline] nf_hook_entries_grow+0x288/0x720 net/netfilter/core.c:140 __nf_register_net_hook+0x278/0x8d0 net/netfilter/core.c:435 nf_register_net_hook+0xb0/0x190 net/netfilter/core.c:578 nf_register_net_hooks+0x41/0x1a0 net/netfilter/core.c:594 brnf_device_event+0x13a/0x1e0 net/bridge/br_netfilter_hooks.c:1114 notifier_call_chain+0x19f/0x3e0 kernel/notifier.c:93 call_netdevice_notifiers_extack net/core/dev.c:2030 [inline] call_netdevice_notifiers net/core/dev.c:2044 [inline] register_netdevice+0x1570/0x19e0 net/core/dev.c:10408 br_dev_newlink+0x27/0x100 net/bridge/br_netlink.c:1563 rtnl_newlink_create net/core/rtnetlink.c:3510 [inline] __rtnl_newlink net/core/rtnetlink.c:3730 [inline] rtnl_newlink+0x158f/0x20a0 net/core/rtnetlink.c:3743 rtnetlink_rcv_msg+0x89b/0x1180 net/core/rtnetlink.c:6635 netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2564 netlink_unicast_kernel net/netlink/af_netlink.c:1335 [inline] netlink_unicast+0x7ea/0x980 net/netlink/af_netlink.c:1361 netlink_sendmsg+0x8db/0xcb0 net/netlink/af_netlink.c:1905 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x221/0x270 net/socket.c:745 __sys_sendto+0x3a4/0x4f0 net/socket.c:2192 __do_sys_sendto net/socket.c:2204 [inline] __se_sys_sendto net/socket.c:2200 [inline] __x64_sys_sendto+0xde/0x100 net/socket.c:2200 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 15925: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579 poison_slab_object+0xe0/0x150 mm/kasan/common.c:240 __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2196 [inline] slab_free mm/slub.c:4438 [inline] kfree+0x149/0x360 mm/slub.c:4559 rcu_do_batch kernel/rcu/tree.c:2535 [inline] rcu_core+0xafd/0x1830 kernel/rcu/tree.c:2809 handle_softirqs+0x2c4/0x970 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637 irq_exit_rcu+0x9/0x30 kernel/softirq.c:649 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline] sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1043 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 Last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47 __kasan_record_aux_stack+0xac/0xc0 mm/kasan/generic.c:541 __call_rcu_common kernel/rcu/tree.c:3072 [inline] call_rcu+0x167/0xa70 kernel/rcu/tree.c:3176 nf_unregister_net_hooks+0xd0/0x140 net/netfilter/core.c:613 brnf_exit_net+0x6c/0x130 net/bridge/br_netfilter_hooks.c:1296 ops_exit_list net/core/net_namespace.c:173 [inline] cleanup_net+0x802/0xcc0 net/core/net_namespace.c:640 process_one_work kernel/workqueue.c:3248 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3329 worker_thread+0x86d/0xd50 kernel/workqueue.c:3409 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 The buggy address belongs to the object at ffff88806c4a6b00 which belongs to the cache kmalloc-cg-64 of size 64 The buggy address is located 0 bytes inside of freed 64-byte region [ffff88806c4a6b00, ffff88806c4a6b40) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88806c4a6f00 pfn:0x6c4a6 memcg:ffff888069ed9e01 anon flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffefff(slab) raw: 00fff00000000000 ffff88801504dc80 0000000000000000 dead000000000001 raw: ffff88806c4a6f00 0000000000200007 00000001ffffefff ffff888069ed9e01 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x152cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 5630, tgid 5630 (syz-executor), ts 107769606972, free_ts 107769196907 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1473 prep_new_page mm/page_alloc.c:1481 [inline] get_page_from_freelist+0x2e4c/0x2f10 mm/page_alloc.c:3425 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4683 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] alloc_slab_page+0x5f/0x120 mm/slub.c:2265 allocate_slab+0x5a/0x2f0 mm/slub.c:2428 new_slab mm/slub.c:2481 [inline] ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3667 __slab_alloc+0x58/0xa0 mm/slub.c:3757 __slab_alloc_node mm/slub.c:3810 [inline] slab_alloc_node mm/slub.c:3990 [inline] kmalloc_trace_noprof+0x1d5/0x2c0 mm/slub.c:4149 kmalloc_noprof include/linux/slab.h:660 [inline] alloc_fdtable+0xa1/0x280 fs/file.c:132 dup_fd+0x893/0xce0 fs/file.c:359 copy_files+0x150/0x2a0 kernel/fork.c:1792 copy_process+0x171b/0x3dc0 kernel/fork.c:2378 kernel_clone+0x226/0x8f0 kernel/fork.c:2797 __do_sys_clone kernel/fork.c:2940 [inline] __se_sys_clone kernel/fork.c:2924 [inline] __x64_sys_clone+0x258/0x2a0 kernel/fork.c:2924 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 5630 tgid 5630 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1093 [inline] free_unref_page+0xd22/0xea0 mm/page_alloc.c:2588 vfree+0x186/0x2e0 mm/vmalloc.c:3355 copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:882 [inline] get_entries net/ipv6/netfilter/ip6_tables.c:1039 [inline] do_ip6t_get_ctl+0x11eb/0x1820 net/ipv6/netfilter/ip6_tables.c:1677 nf_getsockopt+0x299/0x2c0 net/netfilter/nf_sockopt.c:116 ipv6_getsockopt+0x263/0x380 net/ipv6/ipv6_sockglue.c:1494 tcp_getsockopt+0x163/0x1c0 net/ipv4/tcp.c:4406 do_sock_getsockopt+0x373/0x850 net/socket.c:2374 __sys_getsockopt+0x271/0x330 net/socket.c:2403 __do_sys_getsockopt net/socket.c:2413 [inline] __se_sys_getsockopt net/socket.c:2410 [inline] __x64_sys_getsockopt+0xb5/0xd0 net/socket.c:2410 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88806c4a6a00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88806c4a6a80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff88806c4a6b00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff88806c4a6b80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88806c4a6c00: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc ==================================================================