================================================================== BUG: KASAN: slab-use-after-free in dev_map_enqueue+0x3c9/0x3e0 kernel/bpf/devmap.c:539 Read of size 8 at addr ffff88801a880900 by task syz-executor.2/13972 CPU: 1 PID: 13972 Comm: syz-executor.2 Not tainted 6.9.0-rc6-syzkaller-00022-g98369dccd2f8 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 dev_map_enqueue+0x3c9/0x3e0 kernel/bpf/devmap.c:539 __xdp_do_redirect_frame net/core/filter.c:4384 [inline] xdp_do_redirect_frame+0x18b/0x560 net/core/filter.c:4438 xdp_test_run_batch net/bpf/test_run.c:336 [inline] bpf_test_run_xdp_live+0x4ab/0x1af0 net/bpf/test_run.c:384 bpf_prog_test_run_xdp+0x82d/0x1530 net/bpf/test_run.c:1267 bpf_prog_test_run kernel/bpf/syscall.c:4269 [inline] __sys_bpf+0xd56/0x4b40 kernel/bpf/syscall.c:5678 __do_sys_bpf kernel/bpf/syscall.c:5767 [inline] __se_sys_bpf kernel/bpf/syscall.c:5765 [inline] __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5765 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f03db47dea9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f03dc1310c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f03db5abf80 RCX: 00007f03db47dea9 RDX: 0000000000000050 RSI: 0000000020000240 RDI: 000000000000000a RBP: 00007f03db4ca4a4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f03db5abf80 R15: 00007ffcbd3e0918 Allocated by task 13138: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:387 kmalloc include/linux/slab.h:628 [inline] alloc_fdtable+0xa0/0x290 fs/file.c:132 dup_fd+0x77d/0xc70 fs/file.c:354 copy_files kernel/fork.c:1792 [inline] copy_process+0x28bd/0x9090 kernel/fork.c:2378 kernel_clone+0xfd/0x980 kernel/fork.c:2797 __do_sys_clone+0xba/0x100 kernel/fork.c:2940 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 13800: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579 poison_slab_object mm/kasan/common.c:240 [inline] __kasan_slab_free+0x11d/0x1a0 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2106 [inline] slab_free mm/slub.c:4280 [inline] kfree+0x129/0x390 mm/slub.c:4390 __free_fdtable fs/file.c:38 [inline] put_files_struct fs/file.c:451 [inline] put_files_struct+0x2b6/0x360 fs/file.c:444 exit_files+0x82/0xb0 fs/file.c:464 do_exit+0xa49/0x2c10 kernel/exit.c:873 do_group_exit+0xd3/0x2a0 kernel/exit.c:1027 __do_sys_exit_group kernel/exit.c:1038 [inline] __se_sys_exit_group kernel/exit.c:1036 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1036 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88801a880900 which belongs to the cache kmalloc-cg-64 of size 64 The buggy address is located 0 bytes inside of freed 64-byte region [ffff88801a880900, ffff88801a880940) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88801a880e80 pfn:0x1a880 memcg:ffff88801e6d5801 flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000800 ffff88801504d7c0 ffffea000083cbc0 0000000000000006 raw: ffff88801a880e80 0000000080200011 00000001ffffffff ffff88801e6d5801 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, tgid 373367771 (swapper/0), ts 1, free_ts 21612471753 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d4/0x350 mm/page_alloc.c:1534 prep_new_page mm/page_alloc.c:1541 [inline] get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3317 __alloc_pages+0x22b/0x2460 mm/page_alloc.c:4575 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page mm/slub.c:2175 [inline] allocate_slab mm/slub.c:2338 [inline] new_slab+0xcc/0x3a0 mm/slub.c:2391 ___slab_alloc+0x66d/0x1790 mm/slub.c:3525 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3610 __slab_alloc_node mm/slub.c:3663 [inline] slab_alloc_node mm/slub.c:3835 [inline] __do_kmalloc_node mm/slub.c:3965 [inline] __kmalloc_node+0x36e/0x480 mm/slub.c:3973 kmalloc_node include/linux/slab.h:648 [inline] kvmalloc_node+0x9d/0x1a0 mm/util.c:634 kvmalloc include/linux/slab.h:766 [inline] kvzalloc include/linux/slab.h:774 [inline] allocate_hook_entries_size net/netfilter/core.c:61 [inline] nf_hook_entries_grow+0x228/0x810 net/netfilter/core.c:140 __nf_register_net_hook+0x1cd/0x730 net/netfilter/core.c:435 nf_register_net_hook+0x109/0x160 net/netfilter/core.c:578 nf_register_net_hooks+0x5d/0xd0 net/netfilter/core.c:594 nf_defrag_ipv4_enable+0xb8/0x120 net/ipv4/netfilter/nf_defrag_ipv4.c:160 nf_ct_netns_do_get+0x31f/0x620 net/netfilter/nf_conntrack_proto.c:451 nf_ct_netns_inet_get net/netfilter/nf_conntrack_proto.c:566 [inline] nf_ct_netns_get+0x5b/0x150 net/netfilter/nf_conntrack_proto.c:588 nf_conncount_init net/netfilter/nf_conncount.c:544 [inline] nf_conncount_init+0x114/0x410 net/netfilter/nf_conncount.c:527 page last free pid 1 tgid 1 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1141 [inline] free_unref_page_prepare+0x527/0xb10 mm/page_alloc.c:2347 free_unref_page+0x33/0x3c0 mm/page_alloc.c:2487 __put_partials+0x14c/0x170 mm/slub.c:2906 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4e/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3798 [inline] slab_alloc_node mm/slub.c:3845 [inline] kmem_cache_alloc+0x136/0x320 mm/slub.c:3852 kmem_cache_zalloc include/linux/slab.h:739 [inline] __proc_create+0x2c0/0x8b0 fs/proc/generic.c:425 proc_create_reg+0x7d/0x180 fs/proc/generic.c:552 proc_create_seq_private+0x8f/0x180 fs/proc/generic.c:621 bt_procfs_init+0x76/0xa0 net/bluetooth/af_bluetooth.c:736 cmtp_init_sockets+0x6d/0xf0 net/bluetooth/cmtp/sock.c:250 do_one_initcall+0x128/0x700 init/main.c:1245 do_initcall_level init/main.c:1307 [inline] do_initcalls init/main.c:1323 [inline] do_basic_setup init/main.c:1342 [inline] kernel_init_freeable+0x69d/0xca0 init/main.c:1555 kernel_init+0x1c/0x2b0 init/main.c:1444 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 Memory state around the buggy address: ffff88801a880800: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88801a880880: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff88801a880900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff88801a880980: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88801a880a00: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc ==================================================================