================================================================== BUG: KASAN: slab-use-after-free in instrument_atomic_read include/linux/instrumented.h:68 [inline] BUG: KASAN: slab-use-after-free in _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline] BUG: KASAN: slab-use-after-free in bitmap_port_gc_test net/netfilter/ipset/ip_set_bitmap_port.c:67 [inline] BUG: KASAN: slab-use-after-free in bitmap_port_gc+0x146/0x4c0 net/netfilter/ipset/ip_set_bitmap_gen.h:277 Read of size 8 at addr ffff88802e2e0ae0 by task syz-executor.1/27596 CPU: 0 PID: 27596 Comm: syz-executor.1 Not tainted 6.8.0-rc3-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2e0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0x167/0x540 mm/kasan/report.c:488 kasan_report+0x142/0x180 mm/kasan/report.c:601 kasan_check_range+0x282/0x290 mm/kasan/generic.c:189 instrument_atomic_read include/linux/instrumented.h:68 [inline] _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline] bitmap_port_gc_test net/netfilter/ipset/ip_set_bitmap_port.c:67 [inline] bitmap_port_gc+0x146/0x4c0 net/netfilter/ipset/ip_set_bitmap_gen.h:277 call_timer_fn+0x180/0x600 kernel/time/timer.c:1700 expire_timers kernel/time/timer.c:1751 [inline] __run_timers+0x621/0x830 kernel/time/timer.c:2038 run_timer_softirq+0x67/0xf0 kernel/time/timer.c:2051 __do_softirq+0x2bd/0x942 kernel/softirq.c:553 invoke_softirq kernel/softirq.c:427 [inline] __irq_exit_rcu+0xf1/0x1c0 kernel/softirq.c:632 irq_exit_rcu+0x9/0x30 kernel/softirq.c:644 sysvec_apic_timer_interrupt+0x97/0xb0 arch/x86/kernel/apic/apic.c:1076 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:649 RIP: 0010:check_preemption_disabled+0x19/0x120 lib/smp_processor_id.c:14 Code: 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 41 57 41 56 41 54 53 48 83 ec 10 65 48 8b 04 25 28 00 00 00 48 89 44 24 08 <65> 8b 1d 7c 53 9d 74 65 8b 05 71 53 9d 74 a9 ff ff ff 7f 74 26 65 RSP: 0018:ffffc90013ee7260 EFLAGS: 00000286 RAX: 98ad546621bd5400 RBX: 0000000000000001 RCX: ffff888025b3d940 RDX: ffff888025b3d940 RSI: ffffffff8bfe6700 RDI: ffffffff8bfe66c0 RBP: 0000000000000001 R08: ffffffff82014d38 R09: 1ffffffff2591284 R10: dffffc0000000000 R11: fffffbfff2591285 R12: dffffc0000000000 R13: 0000000000033c06 R14: ffffffff82014b76 R15: ffff88813fff90c0 rcu_dynticks_curr_cpu_in_eqs include/linux/context_tracking.h:122 [inline] rcu_is_watching+0x15/0xb0 kernel/rcu/tree.c:700 rcu_read_unlock_sched include/linux/rcupdate.h:861 [inline] pfn_valid+0x2c1/0x440 include/linux/mmzone.h:2026 page_table_check_set+0x25/0x700 mm/page_table_check.c:105 __page_table_check_ptes_set+0x220/0x280 mm/page_table_check.c:196 page_table_check_ptes_set include/linux/page_table_check.h:74 [inline] set_ptes include/linux/pgtable.h:241 [inline] copy_present_pte mm/memory.c:993 [inline] copy_pte_range mm/memory.c:1102 [inline] copy_pmd_range mm/memory.c:1187 [inline] copy_pud_range mm/memory.c:1224 [inline] copy_p4d_range mm/memory.c:1248 [inline] copy_page_range+0x2c7e/0x4240 mm/memory.c:1346 dup_mmap kernel/fork.c:745 [inline] dup_mm kernel/fork.c:1685 [inline] copy_mm+0x12f4/0x21b0 kernel/fork.c:1734 copy_process+0x1d73/0x3fc0 kernel/fork.c:2497 kernel_clone+0x21d/0x8d0 kernel/fork.c:2902 __do_sys_clone kernel/fork.c:3045 [inline] __se_sys_clone kernel/fork.c:3029 [inline] __x64_sys_clone+0x258/0x2a0 kernel/fork.c:3029 do_syscall_64+0xfb/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77 RIP: 0033:0x7f62c447add3 Code: 1f 84 00 00 00 00 00 64 48 8b 04 25 10 00 00 00 45 31 c0 31 d2 31 f6 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 89 c2 85 c0 75 2c 64 48 8b 04 25 10 00 00 RSP: 002b:00007fff230e3b08 EFLAGS: 00000246 ORIG_RAX: 0000000000000038 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f62c447add3 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011 RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000 R10: 0000555556176750 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000001 R15: 0000000000000001 Allocated by task 2186: 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:372 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:389 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slub.c:3981 [inline] __kmalloc+0x22e/0x490 mm/slub.c:3994 init_map_port net/netfilter/ipset/ip_set_bitmap_port.c:234 [inline] bitmap_port_create+0x324/0x7c0 net/netfilter/ipset/ip_set_bitmap_port.c:276 ip_set_create+0xa5e/0x1780 net/netfilter/ipset/ip_set_core.c:1103 nfnetlink_rcv_msg+0xbee/0x1190 net/netfilter/nfnetlink.c:302 netlink_rcv_skb+0x1e5/0x430 net/netlink/af_netlink.c:2543 nfnetlink_rcv+0x294/0x2650 net/netfilter/nfnetlink.c:659 netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline] netlink_unicast+0x7ec/0x980 net/netlink/af_netlink.c:1367 netlink_sendmsg+0xa3b/0xd70 net/netlink/af_netlink.c:1908 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x223/0x270 net/socket.c:745 ____sys_sendmsg+0x525/0x7d0 net/socket.c:2584 ___sys_sendmsg net/socket.c:2638 [inline] __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2667 do_syscall_64+0xfb/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77 Freed by task 22329: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x4e/0x60 mm/kasan/generic.c:640 poison_slab_object+0xa6/0xe0 mm/kasan/common.c:241 __kasan_slab_free+0x34/0x70 mm/kasan/common.c:257 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2121 [inline] slab_free mm/slub.c:4299 [inline] kfree+0x14a/0x380 mm/slub.c:4409 bitmap_port_destroy+0x300/0x390 net/netfilter/ipset/ip_set_bitmap_gen.h:65 ip_set_destroy_set net/netfilter/ipset/ip_set_core.c:1180 [inline] ip_set_net_exit+0x252/0x470 net/netfilter/ipset/ip_set_core.c:2381 ops_exit_list net/core/net_namespace.c:170 [inline] cleanup_net+0x6dc/0xb90 net/core/net_namespace.c:618 process_one_work kernel/workqueue.c:2633 [inline] process_scheduled_works+0x915/0x1420 kernel/workqueue.c:2706 worker_thread+0xa5f/0x1000 kernel/workqueue.c:2787 kthread+0x2f1/0x390 kernel/kthread.c:388 ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:242 The buggy address belongs to the object at ffff88802e2e0ae0 which belongs to the cache kmalloc-8 of size 8 The buggy address is located 0 bytes inside of freed 8-byte region [ffff88802e2e0ae0, ffff88802e2e0ae8) The buggy address belongs to the physical page: page:ffffea0000b8b800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2e2e0 flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000800 ffff888014c41280 ffffea0002177fc0 dead000000000006 raw: 0000000000000000 00000000002a002a 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 32330, tgid 32330 (syz-executor.2), ts 2411372001560, free_ts 2411295968596 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1533 prep_new_page mm/page_alloc.c:1540 [inline] get_page_from_freelist+0x33ea/0x3580 mm/page_alloc.c:3311 __alloc_pages+0x255/0x680 mm/page_alloc.c:4567 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page+0x5f/0x160 mm/slub.c:2190 allocate_slab mm/slub.c:2354 [inline] new_slab+0x84/0x2f0 mm/slub.c:2407 ___slab_alloc+0xd17/0x13e0 mm/slub.c:3540 __slab_alloc mm/slub.c:3625 [inline] __slab_alloc_node mm/slub.c:3678 [inline] slab_alloc_node mm/slub.c:3850 [inline] __do_kmalloc_node mm/slub.c:3980 [inline] __kmalloc_node_track_caller+0x2d1/0x4e0 mm/slub.c:4001 kstrdup+0x3a/0x80 mm/util.c:62 __kernfs_new_node+0x9d/0x880 fs/kernfs/dir.c:611 kernfs_new_node+0x13a/0x240 fs/kernfs/dir.c:691 kernfs_create_dir_ns+0x43/0x120 fs/kernfs/dir.c:1052 sysfs_create_dir_ns+0x189/0x3a0 fs/sysfs/dir.c:59 create_dir lib/kobject.c:73 [inline] kobject_add_internal+0x40d/0x8a0 lib/kobject.c:238 kobject_add_varg lib/kobject.c:372 [inline] kobject_init_and_add+0x124/0x190 lib/kobject.c:455 netdev_queue_add_kobject net/core/net-sysfs.c:1706 [inline] netdev_queue_update_kobjects+0x1f3/0x480 net/core/net-sysfs.c:1758 register_queue_kobjects net/core/net-sysfs.c:1819 [inline] netdev_register_kobject+0x265/0x310 net/core/net-sysfs.c:2059 page last free pid 32330 tgid 32330 stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1140 [inline] free_unref_page_prepare+0x968/0xa90 mm/page_alloc.c:2346 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2486 discard_slab mm/slub.c:2453 [inline] __put_partials+0xeb/0x130 mm/slub.c:2922 put_cpu_partial+0x17b/0x250 mm/slub.c:2997 __slab_free+0x302/0x410 mm/slub.c:4166 qlink_free mm/kasan/quarantine.c:160 [inline] qlist_free_all+0x6d/0xd0 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:324 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3813 [inline] slab_alloc_node mm/slub.c:3860 [inline] __do_kmalloc_node mm/slub.c:3980 [inline] __kmalloc_node+0x1fd/0x4e0 mm/slub.c:3988 kmalloc_node include/linux/slab.h:610 [inline] kvmalloc_node+0x72/0x190 mm/util.c:617 kvmalloc include/linux/slab.h:728 [inline] kvmalloc_array include/linux/slab.h:746 [inline] __ptr_ring_init_queue_alloc include/linux/ptr_ring.h:471 [inline] ptr_ring_init include/linux/ptr_ring.h:489 [inline] wg_packet_queue_init+0x92/0x2f0 drivers/net/wireguard/queueing.c:32 wg_newlink+0x3f2/0x720 drivers/net/wireguard/device.c:353 rtnl_newlink_create net/core/rtnetlink.c:3515 [inline] __rtnl_newlink net/core/rtnetlink.c:3735 [inline] rtnl_newlink+0x1591/0x20a0 net/core/rtnetlink.c:3748 rtnetlink_rcv_msg+0x887/0x1040 net/core/rtnetlink.c:6615 netlink_rcv_skb+0x1e5/0x430 net/netlink/af_netlink.c:2543 netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline] netlink_unicast+0x7ec/0x980 net/netlink/af_netlink.c:1367 Memory state around the buggy address: ffff88802e2e0980: fc fc fc fc fc fc fc fc 05 fc fc fc fc fc fc fc ffff88802e2e0a00: fc fc fc fc fa fc fc fc fc fc fc fc fc fc fc fc >ffff88802e2e0a80: fa fc fc fc fc fc fc fc fc fc fc fc fa fc fc fc ^ ffff88802e2e0b00: fc fc fc fc fc fc fc fc 03 fc fc fc fc fc fc fc ffff88802e2e0b80: fc fc fc fc fa fc fc fc fc fc fc fc fc fc fc fc ================================================================== ---------------- Code disassembly (best guess): 0: 90 nop 1: 90 nop 2: 90 nop 3: 90 nop 4: 90 nop 5: 90 nop 6: 90 nop 7: 90 nop 8: 90 nop 9: 90 nop a: 90 nop b: 90 nop c: 90 nop d: 90 nop e: 90 nop f: 90 nop 10: 90 nop 11: 41 57 push %r15 13: 41 56 push %r14 15: 41 54 push %r12 17: 53 push %rbx 18: 48 83 ec 10 sub $0x10,%rsp 1c: 65 48 8b 04 25 28 00 mov %gs:0x28,%rax 23: 00 00 25: 48 89 44 24 08 mov %rax,0x8(%rsp) * 2a: 65 8b 1d 7c 53 9d 74 mov %gs:0x749d537c(%rip),%ebx # 0x749d53ad <-- trapping instruction 31: 65 8b 05 71 53 9d 74 mov %gs:0x749d5371(%rip),%eax # 0x749d53a9 38: a9 ff ff ff 7f test $0x7fffffff,%eax 3d: 74 26 je 0x65 3f: 65 gs