================================================================== 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 ffff88801ef91240 by task syz-executor.3/26832 CPU: 0 PID: 26832 Comm: syz-executor.3 Not tainted 6.8.0-rc3-syzkaller-00047-g047371968ffc #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:console_flush_all+0x9cc/0xec0 kernel/printk/printk.c:2973 Code: 48 21 c3 0f 85 fa 01 00 00 e8 90 67 1e 00 48 8b 5c 24 38 4d 85 f6 75 07 e8 81 67 1e 00 eb 06 e8 7a 67 1e 00 fb 48 8b 44 24 58 <42> 0f b6 04 28 84 c0 0f 85 4a 02 00 00 0f b6 1b 31 ff 89 de e8 5b RSP: 0018:ffffc90005006cc0 EFLAGS: 00000246 RAX: 1ffff92000a00de4 RBX: ffffc90005006f20 RCX: 0000000000040000 RDX: ffffc90017a6e000 RSI: 000000000003ffff RDI: 0000000000040000 RBP: ffffc90005006e70 R08: ffffffff8174ff8d R09: 1ffffffff2591284 R10: dffffc0000000000 R11: fffffbfff2591285 R12: ffffffff8e8e9480 R13: dffffc0000000000 R14: 0000000000000200 R15: ffffffff8e8e94d8 console_unlock+0x13b/0x4d0 kernel/printk/printk.c:3036 vprintk_emit+0x508/0x720 kernel/printk/printk.c:2303 _printk+0xd5/0x120 kernel/printk/printk.c:2328 set_capacity_and_notify+0x220/0x2c0 block/genhd.c:86 loop_set_size+0x44/0xb0 drivers/block/loop.c:235 loop_configure+0xd08/0x1250 drivers/block/loop.c:1096 lo_ioctl+0x8f5/0x2080 blkdev_ioctl+0x5e7/0x740 block/ioctl.c:634 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:871 [inline] __se_sys_ioctl+0xfe/0x170 fs/ioctl.c:857 do_syscall_64+0xfb/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77 RIP: 0033:0x7f1c95e7db0b Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 ff ff 77 1c 48 8b 44 24 18 64 48 2b 04 25 28 00 00 RSP: 002b:00007f1c96c93e50 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007f1c95e7db0b RDX: 0000000000000003 RSI: 0000000000004c00 RDI: 0000000000000004 RBP: 0000000000000000 R08: 0000000000000000 R09: 00000000000011ee R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000003 R13: 00007f1c96c93f80 R14: 00007f1c96c93f40 R15: 00007f1c8c400000 Allocated by task 9418: 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 6304: 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 ffff88801ef91240 which belongs to the cache kmalloc-8 of size 8 The buggy address is located 0 bytes inside of freed 8-byte region [ffff88801ef91240, ffff88801ef91248) The buggy address belongs to the physical page: page:ffffea00007be440 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1ef91 flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000800 ffff888014c41280 ffffea000059d3c0 dead000000000002 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 5105, tgid 5105 (syz-executor.5), ts 296088191091, free_ts 295576601605 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+0x2d6/0x4e0 mm/slub.c:3988 kmalloc_node include/linux/slab.h:610 [inline] __vmalloc_area_node mm/vmalloc.c:3125 [inline] __vmalloc_node_range+0x5f9/0x14a0 mm/vmalloc.c:3320 __vmalloc_node mm/vmalloc.c:3385 [inline] vzalloc+0x79/0x90 mm/vmalloc.c:3458 alloc_counters+0xd7/0x770 net/ipv4/netfilter/arp_tables.c:660 copy_entries_to_user net/ipv4/netfilter/arp_tables.c:681 [inline] get_entries net/ipv4/netfilter/arp_tables.c:867 [inline] do_arpt_get_ctl+0xe75/0x16a0 net/ipv4/netfilter/arp_tables.c:1453 nf_getsockopt+0x29b/0x2c0 net/netfilter/nf_sockopt.c:116 ip_getsockopt+0x222/0x2e0 net/ipv4/ip_sockglue.c:1770 tcp_getsockopt+0x165/0x1c0 net/ipv4/tcp.c:4372 do_sock_getsockopt+0x375/0x850 net/socket.c:2373 __sys_getsockopt+0x270/0x330 net/socket.c:2402 page last free pid 7082 tgid 7082 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_list+0x5a3/0x850 mm/page_alloc.c:2532 release_pages+0x2744/0x2a80 mm/swap.c:1042 tlb_batch_pages_flush mm/mmu_gather.c:98 [inline] tlb_flush_mmu_free mm/mmu_gather.c:293 [inline] tlb_flush_mmu+0x34c/0x4e0 mm/mmu_gather.c:300 tlb_finish_mmu+0xd4/0x200 mm/mmu_gather.c:392 exit_mmap+0x4b6/0xd40 mm/mmap.c:3292 __mmput+0x115/0x3c0 kernel/fork.c:1343 exit_mm+0x21f/0x310 kernel/exit.c:569 do_exit+0x9af/0x2740 kernel/exit.c:858 do_group_exit+0x206/0x2c0 kernel/exit.c:1020 __do_sys_exit_group kernel/exit.c:1031 [inline] __se_sys_exit_group kernel/exit.c:1029 [inline] __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1029 do_syscall_64+0xfb/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77 Memory state around the buggy address: ffff88801ef91100: fc fc fc fc 05 fc fc fc fc fc fc fc fc fc fc fc ffff88801ef91180: fa fc fc fc fc fc fc fc fc fc fc fc fa fc fc fc >ffff88801ef91200: fc fc fc fc fc fc fc fc fa fc fc fc fc fc fc fc ^ ffff88801ef91280: fc fc fc fc 05 fc fc fc fc fc fc fc fc fc fc fc ffff88801ef91300: 05 fc fc fc fc fc fc fc fc fc fc fc fa fc fc fc ================================================================== ---------------- Code disassembly (best guess): 0: 48 21 c3 and %rax,%rbx 3: 0f 85 fa 01 00 00 jne 0x203 9: e8 90 67 1e 00 call 0x1e679e e: 48 8b 5c 24 38 mov 0x38(%rsp),%rbx 13: 4d 85 f6 test %r14,%r14 16: 75 07 jne 0x1f 18: e8 81 67 1e 00 call 0x1e679e 1d: eb 06 jmp 0x25 1f: e8 7a 67 1e 00 call 0x1e679e 24: fb sti 25: 48 8b 44 24 58 mov 0x58(%rsp),%rax * 2a: 42 0f b6 04 28 movzbl (%rax,%r13,1),%eax <-- trapping instruction 2f: 84 c0 test %al,%al 31: 0f 85 4a 02 00 00 jne 0x281 37: 0f b6 1b movzbl (%rbx),%ebx 3a: 31 ff xor %edi,%edi 3c: 89 de mov %ebx,%esi 3e: e8 .byte 0xe8 3f: 5b pop %rbx