R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000009 R13: 00007fff40739c40 R14: 00007fff40739c80 R15: 0000000000000000 ---[ end trace 04543ff737ed8a94 ]--- ================================================================== BUG: KASAN: use-after-free in prog_list_prog kernel/bpf/cgroup.c:174 [inline] BUG: KASAN: use-after-free in prog_list_length kernel/bpf/cgroup.c:187 [inline] BUG: KASAN: use-after-free in compute_effective_progs+0x1d3/0x6e0 kernel/bpf/cgroup.c:240 Read of size 8 at addr ffff888117e23c18 by task syz-executor260/367 CPU: 0 PID: 367 Comm: syz-executor260 Tainted: G W 5.10.109-syzkaller-00693-g414e6c8e941c #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x8d/0x3d0 mm/kasan/report.c:233 __kasan_report+0x142/0x220 mm/kasan/report.c:419 kasan_report+0x51/0x70 mm/kasan/report.c:436 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309 prog_list_prog kernel/bpf/cgroup.c:174 [inline] prog_list_length kernel/bpf/cgroup.c:187 [inline] compute_effective_progs+0x1d3/0x6e0 kernel/bpf/cgroup.c:240 update_effective_progs+0x79/0x310 kernel/bpf/cgroup.c:343 __cgroup_bpf_detach+0x312/0x570 kernel/bpf/cgroup.c:689 bpf_cgroup_link_release+0x94/0x260 kernel/bpf/cgroup.c:833 bpf_link_free kernel/bpf/syscall.c:2350 [inline] bpf_link_put+0x1e9/0x270 kernel/bpf/syscall.c:2376 bpf_link_release+0x3b/0x40 kernel/bpf/syscall.c:2384 __fput+0x348/0x7d0 fs/file_table.c:281 ____fput+0x15/0x20 fs/file_table.c:314 task_work_run+0x147/0x1b0 kernel/task_work.c:154 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop kernel/entry/common.c:164 [inline] exit_to_user_mode_prepare+0xc3/0xe0 kernel/entry/common.c:191 syscall_exit_to_user_mode+0x24/0x40 kernel/entry/common.c:266 do_syscall_64+0x3d/0x70 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f6c5fef0263 Code: c7 c2 c0 ff ff ff f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb ba 0f 1f 00 64 8b 04 25 18 00 00 00 85 c0 75 14 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 RSP: 002b:00007fff40739bf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000009 RCX: 00007f6c5fef0263 RDX: 0000000000000c20 RSI: 0000000000000005 RDI: 0000000000000008 RBP: 00007fff40739c20 R08: 0000000000000001 R09: 00007fff40739c30 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000009 R13: 00007fff40739c40 R14: 00007fff40739c80 R15: 0000000000000000 Allocated by task 367: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:428 [inline] ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:507 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:516 kasan_kmalloc include/linux/kasan.h:269 [inline] kmem_cache_alloc_trace+0x210/0x3a0 mm/slub.c:2983 kmalloc include/linux/slab.h:552 [inline] kzalloc include/linux/slab.h:664 [inline] cgroup_bpf_link_attach+0x12e/0x4a0 kernel/bpf/cgroup.c:918 link_create kernel/bpf/syscall.c:4092 [inline] __do_sys_bpf+0xab8e/0x116b0 kernel/bpf/syscall.c:4497 __se_sys_bpf kernel/bpf/syscall.c:4383 [inline] __x64_sys_bpf+0x7a/0x90 kernel/bpf/syscall.c:4383 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 367: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:357 ____kasan_slab_free+0x133/0x170 mm/kasan/common.c:360 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1604 [inline] slab_free_freelist_hook+0xcc/0x1a0 mm/slub.c:1630 slab_free mm/slub.c:3212 [inline] kfree+0xd5/0x320 mm/slub.c:4200 bpf_cgroup_link_dealloc+0x15/0x20 kernel/bpf/cgroup.c:849 bpf_link_free kernel/bpf/syscall.c:2354 [inline] bpf_link_put+0x243/0x270 kernel/bpf/syscall.c:2376 bpf_link_release+0x3b/0x40 kernel/bpf/syscall.c:2384 __fput+0x348/0x7d0 fs/file_table.c:281 ____fput+0x15/0x20 fs/file_table.c:314 task_work_run+0x147/0x1b0 kernel/task_work.c:154 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop kernel/entry/common.c:164 [inline] exit_to_user_mode_prepare+0xc3/0xe0 kernel/entry/common.c:191 syscall_exit_to_user_mode+0x24/0x40 kernel/entry/common.c:266 do_syscall_64+0x3d/0x70 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff888117e23c00 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 24 bytes inside of 96-byte region [ffff888117e23c00, ffff888117e23c60) The buggy address belongs to the page: page:ffffea00045f88c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x117e23 flags: 0x8000000000000200(slab) raw: 8000000000000200 dead000000000100 dead000000000122 ffff888100043680 raw: 0000000000000000 0000000080200020 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 367, ts 34827930642, free_ts 34827874093 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2385 [inline] prep_new_page mm/page_alloc.c:2391 [inline] get_page_from_freelist+0xa74/0xa90 mm/page_alloc.c:4063 __alloc_pages_nodemask+0x3c8/0x820 mm/page_alloc.c:5113 alloc_slab_page mm/slub.c:1815 [inline] allocate_slab+0x6b/0x350 mm/slub.c:1817 new_slab mm/slub.c:1878 [inline] new_slab_objects mm/slub.c:2637 [inline] ___slab_alloc+0x143/0x2f0 mm/slub.c:2800 __slab_alloc mm/slub.c:2840 [inline] slab_alloc_node mm/slub.c:2922 [inline] slab_alloc mm/slub.c:2964 [inline] kmem_cache_alloc_trace+0x278/0x3a0 mm/slub.c:2981 kmem_cache_alloc_node_trace include/linux/slab.h:440 [inline] kmalloc_node include/linux/slab.h:570 [inline] kzalloc_node include/linux/slab.h:675 [inline] __get_vm_area_node+0x134/0x200 mm/vmalloc.c:2077 __vmalloc_node_range+0xd8/0x750 mm/vmalloc.c:2560 module_alloc+0x81/0x90 arch/x86/kernel/module.c:75 bpf_jit_alloc_exec+0x15/0x20 kernel/bpf/core.c:854 bpf_jit_binary_alloc+0x12e/0x260 kernel/bpf/core.c:882 bpf_int_jit_compile+0x8f37/0x9fd0 arch/x86/net/bpf_jit_comp.c:2137 bpf_prog_select_runtime+0x745/0xa10 kernel/bpf/core.c:1871 bpf_prog_load kernel/bpf/syscall.c:2237 [inline] __do_sys_bpf+0x10451/0x116b0 kernel/bpf/syscall.c:4427 __se_sys_bpf kernel/bpf/syscall.c:4383 [inline] __x64_sys_bpf+0x7a/0x90 kernel/bpf/syscall.c:4383 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 page last free stack trace: reset_page_owner include/linux/page_owner.h:28 [inline] free_pages_prepare mm/page_alloc.c:1331 [inline] free_pcp_prepare+0x18f/0x1c0 mm/page_alloc.c:1405 free_unref_page_prepare mm/page_alloc.c:3291 [inline] free_unref_page mm/page_alloc.c:3341 [inline] free_the_page mm/page_alloc.c:5172 [inline] __free_pages+0x2e3/0x4a0 mm/page_alloc.c:5180 __vunmap+0x856/0x980 mm/vmalloc.c:2275 __vfree mm/vmalloc.c:2323 [inline] vfree+0x62/0xf0 mm/vmalloc.c:2354 bpf_check+0xdf4b/0x139a0 kernel/bpf/verifier.c:12528 bpf_prog_load kernel/bpf/syscall.c:2233 [inline] __do_sys_bpf+0x103e6/0x116b0 kernel/bpf/syscall.c:4427 __se_sys_bpf kernel/bpf/syscall.c:4383 [inline] __x64_sys_bpf+0x7a/0x90 kernel/bpf/syscall.c:4383 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Memory state around the buggy address: ffff888117e23b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888117e23b80: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc >ffff888117e23c00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff888117e23c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888117e23d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================