================================================================== BUG: KASAN: slab-use-after-free in bpf_link_free+0x28d/0x320 kernel/bpf/syscall.c:3078 Read of size 8 at addr ffff88801bbdb410 by task syz-executor.2/17804 CPU: 0 PID: 17804 Comm: syz-executor.2 Not tainted 6.9.0-syzkaller-05151-g1b294a1f3561 #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+0x273/0xb80 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:0x7f31ed67cee9 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:00007f31ee3160c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000003 RAX: ffffffffffffffda RBX: 00007f31ed7abf80 RCX: 00007f31ed67cee9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004 RBP: 00007f31ed6c949e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f31ed7abf80 R15: 00007ffcb70b3a08 Allocated by task 17804: 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] kzalloc include/linux/slab.h:749 [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+0x3a7/0x4b80 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 16: 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:2121 [inline] slab_free mm/slub.c:4353 [inline] kfree+0x129/0x3a0 mm/slub.c:4463 rcu_do_batch kernel/rcu/tree.c:2535 [inline] rcu_core+0x82b/0x16b0 kernel/rcu/tree.c:2809 handle_softirqs+0x219/0x8f0 kernel/softirq.c:554 run_ksoftirqd kernel/softirq.c:928 [inline] run_ksoftirqd+0x3a/0x60 kernel/softirq.c:920 smpboot_thread_fn+0x664/0xa10 kernel/smpboot.c:164 kthread+0x2c4/0x3a0 kernel/kthread.c:389 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 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+0x273/0xb80 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 ffff88801bbdb400 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 16 bytes inside of freed 128-byte region [ffff88801bbdb400, ffff88801bbdb480) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1bbdb flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000800 ffff888015441a00 ffffea000175f900 dead000000000004 raw: 0000000000000000 0000000080100010 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 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 4555, tgid 4555 (udevadm), ts 50786753055, free_ts 50782857383 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:2190 [inline] allocate_slab mm/slub.c:2353 [inline] new_slab+0xcc/0x3a0 mm/slub.c:2406 ___slab_alloc+0xd28/0x1810 mm/slub.c:3592 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3682 __slab_alloc_node mm/slub.c:3735 [inline] slab_alloc_node mm/slub.c:3908 [inline] kmalloc_trace+0x306/0x340 mm/slub.c:4065 kmalloc include/linux/slab.h:628 [inline] kzalloc include/linux/slab.h:749 [inline] kernfs_get_open_node fs/kernfs/file.c:525 [inline] kernfs_fop_open+0xa8e/0xdb0 fs/kernfs/file.c:700 do_dentry_open+0x8dd/0x18c0 fs/open.c:955 do_open fs/namei.c:3650 [inline] path_openat+0x1dfb/0x2990 fs/namei.c:3807 do_filp_open+0x1dc/0x430 fs/namei.c:3834 do_sys_openat2+0x17a/0x1e0 fs/open.c:1406 do_sys_open fs/open.c:1421 [inline] __do_sys_openat fs/open.c:1437 [inline] __se_sys_openat fs/open.c:1432 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1432 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 page last free pid 4555 tgid 4555 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:2920 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:3871 [inline] slab_alloc_node mm/slub.c:3918 [inline] __do_kmalloc_node mm/slub.c:4038 [inline] __kmalloc+0x1bd/0x440 mm/slub.c:4052 kmalloc include/linux/slab.h:632 [inline] kernfs_fop_write_iter+0x229/0x500 fs/kernfs/file.c:311 call_write_iter include/linux/fs.h:2120 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0x6b9/0x1120 fs/read_write.c:590 ksys_write+0x12f/0x260 fs/read_write.c:643 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: ffff88801bbdb300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06 ffff88801bbdb380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88801bbdb400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88801bbdb480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88801bbdb500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================