delete_channel: no stack ================================================================== BUG: KASAN: slab-use-after-free in bpf_link_free+0x28d/0x320 kernel/bpf/syscall.c:3078 Read of size 8 at addr ffff88807d897b10 by task syz-executor.1/5290 CPU: 1 PID: 5290 Comm: syz-executor.1 Not tainted 6.9.0-syzkaller-10323-g8f6a15f095a6 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 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 bpf_link_free+0x28d/0x320 kernel/bpf/syscall.c:3078 bpf_link_put_direct kernel/bpf/syscall.c:3106 [inline] bpf_link_release+0x63/0x80 kernel/bpf/syscall.c:3113 __fput+0x408/0xbb0 fs/file_table.c:422 __fput_sync+0x47/0x50 fs/file_table.c:507 __do_sys_close fs/open.c:1556 [inline] __se_sys_close fs/open.c:1541 [inline] __x64_sys_close+0x86/0x100 fs/open.c:1541 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:0x7fdf0547bdda Code: 48 3d 00 f0 ff ff 77 48 c3 0f 1f 80 00 00 00 00 48 83 ec 18 89 7c 24 0c e8 03 7f 02 00 8b 7c 24 0c 89 c2 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 36 89 d7 89 44 24 0c e8 63 7f 02 00 8b 44 24 RSP: 002b:00007ffde2cd59e0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: ffffffffffffffda RBX: 000000000000000a RCX: 00007fdf0547bdda RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000009 RBP: 00007fdf055ad980 R08: 0000001b32920000 R09: 0000000000001c96 R10: 0000000081d10614 R11: 0000000000000293 R12: 0000000000019663 R13: 00007fdf055ac12c R14: 00007fdf055ac120 R15: 0000000000000032 Allocated by task 5291: 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_noprof include/linux/slab.h:660 [inline] kzalloc_noprof include/linux/slab.h:778 [inline] bpf_raw_tp_link_attach+0x18b/0x640 kernel/bpf/syscall.c:3858 bpf_raw_tracepoint_open kernel/bpf/syscall.c:3905 [inline] __sys_bpf+0x3a5/0x49a0 kernel/bpf/syscall.c:5729 __do_sys_bpf kernel/bpf/syscall.c:5794 [inline] __se_sys_bpf kernel/bpf/syscall.c:5792 [inline] __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5792 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 25: 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+0xf7/0x160 mm/kasan/common.c:240 __kasan_slab_free+0x32/0x50 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2195 [inline] slab_free mm/slub.c:4436 [inline] kfree+0x12a/0x3b0 mm/slub.c:4557 rcu_do_batch kernel/rcu/tree.c:2535 [inline] rcu_core+0x828/0x16b0 kernel/rcu/tree.c:2809 handle_softirqs+0x216/0x8f0 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu kernel/softirq.c:637 [inline] irq_exit_rcu+0xbb/0x120 kernel/softirq.c:649 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline] sysvec_apic_timer_interrupt+0x95/0xb0 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+0x33/0x60 mm/kasan/common.c:47 __kasan_record_aux_stack+0xba/0xd0 mm/kasan/generic.c:541 __call_rcu_common.constprop.0+0x9a/0x790 kernel/rcu/tree.c:3072 bpf_link_free+0x26a/0x320 kernel/bpf/syscall.c:3076 bpf_link_put_direct kernel/bpf/syscall.c:3106 [inline] bpf_link_release+0x63/0x80 kernel/bpf/syscall.c:3113 __fput+0x408/0xbb0 fs/file_table.c:422 __fput_sync+0x47/0x50 fs/file_table.c:507 __do_sys_close fs/open.c:1556 [inline] __se_sys_close fs/open.c:1541 [inline] __x64_sys_close+0x86/0x100 fs/open.c:1541 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 ffff88807d897b00 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 16 bytes inside of freed 128-byte region [ffff88807d897b00, ffff88807d897b80) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7d897 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffefff(slab) raw: 00fff00000000000 ffff888015441a00 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000100010 00000001ffffefff 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 0x352800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL|__GFP_THISNODE), pid 5105, tgid 5105 (syz-executor.1), ts 101121729292, free_ts 101120649946 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1468 prep_new_page mm/page_alloc.c:1476 [inline] get_page_from_freelist+0x136a/0x2df0 mm/page_alloc.c:3402 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4660 __alloc_pages_node_noprof include/linux/gfp.h:244 [inline] alloc_pages_node_noprof include/linux/gfp.h:271 [inline] alloc_slab_page+0x56/0x110 mm/slub.c:2264 allocate_slab mm/slub.c:2427 [inline] new_slab+0x84/0x260 mm/slub.c:2480 ___slab_alloc+0xdac/0x1870 mm/slub.c:3666 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3756 __slab_alloc_node mm/slub.c:3809 [inline] slab_alloc_node mm/slub.c:3988 [inline] __do_kmalloc_node mm/slub.c:4120 [inline] __kmalloc_node_noprof+0x36c/0x450 mm/slub.c:4128 kmalloc_array_node_noprof include/linux/slab.h:759 [inline] alloc_slab_obj_exts+0x41/0xa0 mm/slub.c:1941 __memcg_slab_post_alloc_hook+0x267/0x890 mm/memcontrol.c:3775 memcg_slab_post_alloc_hook mm/slub.c:2103 [inline] slab_post_alloc_hook mm/slub.c:3961 [inline] slab_alloc_node mm/slub.c:4000 [inline] kmem_cache_alloc_noprof+0x2cd/0x2f0 mm/slub.c:4007 vm_area_dup+0x21/0x2f0 kernel/fork.c:482 dup_mmap kernel/fork.c:697 [inline] dup_mm kernel/fork.c:1688 [inline] copy_mm kernel/fork.c:1737 [inline] copy_process+0x7e88/0x8f10 kernel/fork.c:2390 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 page last free pid 5105 tgid 5105 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1088 [inline] free_unref_page+0x64a/0xe40 mm/page_alloc.c:2565 vfree+0x181/0x7a0 mm/vmalloc.c:3346 __do_replace+0x7c3/0x9c0 net/ipv4/netfilter/arp_tables.c:937 do_replace net/ipv6/netfilter/ip6_tables.c:1158 [inline] do_ip6t_set_ctl+0x94b/0xc40 net/ipv6/netfilter/ip6_tables.c:1644 nf_setsockopt+0x8a/0xf0 net/netfilter/nf_sockopt.c:101 ipv6_setsockopt+0x133/0x1a0 net/ipv6/ipv6_sockglue.c:999 tcp_setsockopt+0xa4/0x100 net/ipv4/tcp.c:3758 do_sock_setsockopt+0x222/0x480 net/socket.c:2312 __sys_setsockopt+0x1a4/0x270 net/socket.c:2335 __do_sys_setsockopt net/socket.c:2344 [inline] __se_sys_setsockopt net/socket.c:2341 [inline] __x64_sys_setsockopt+0xbd/0x160 net/socket.c:2341 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 Memory state around the buggy address: ffff88807d897a00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807d897a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88807d897b00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807d897b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807d897c00: 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc ==================================================================