================================================================== BUG: KASAN: slab-use-after-free in consumer_filter kernel/events/uprobes.c:869 [inline] BUG: KASAN: slab-use-after-free in filter_chain kernel/events/uprobes.c:880 [inline] BUG: KASAN: slab-use-after-free in uprobe_mmap+0xb9a/0x11a0 kernel/events/uprobes.c:1387 Read of size 8 at addr ffff88802ea79ab0 by task syz.2.1838/9642 CPU: 0 UID: 0 PID: 9642 Comm: syz.2.1838 Not tainted 6.11.0-rc6-syzkaller-00048-gc7fb1692dc01 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call Trace: __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 consumer_filter kernel/events/uprobes.c:869 [inline] filter_chain kernel/events/uprobes.c:880 [inline] uprobe_mmap+0xb9a/0x11a0 kernel/events/uprobes.c:1387 mmap_region+0x1891/0x2090 mm/mmap.c:3058 do_mmap+0x8f9/0x1010 mm/mmap.c:1468 vm_mmap_pgoff+0x1dd/0x3d0 mm/util.c:588 ksys_mmap_pgoff+0x4f1/0x720 mm/mmap.c:1514 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f539597cef9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f53967ed038 EFLAGS: 00000246 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 00007f5395b35f80 RCX: 00007f539597cef9 RDX: 0000000000000000 RSI: 0000000000002000 RDI: 0000000020000000 RBP: 00007f53959ef01e R08: 0000000000000006 R09: 0000000000000000 R10: 0000000000010012 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f5395b35f80 R15: 00007ffe696f1198 Allocated by task 9201: 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:370 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slub.c:4162 [inline] __kmalloc_node_noprof+0x22a/0x440 mm/slub.c:4168 __kvmalloc_node_noprof+0x72/0x190 mm/util.c:650 kvmalloc_array_node_noprof include/linux/slab.h:833 [inline] bpf_uprobe_multi_link_attach+0x44b/0xb70 kernel/trace/bpf_trace.c:3439 link_create+0x727/0x8b0 kernel/bpf/syscall.c:5319 __sys_bpf+0x4bc/0x810 kernel/bpf/syscall.c:5780 __do_sys_bpf kernel/bpf/syscall.c:5817 [inline] __se_sys_bpf kernel/bpf/syscall.c:5815 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5815 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 9201: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579 poison_slab_object+0xe0/0x150 mm/kasan/common.c:240 __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2256 [inline] slab_free mm/slub.c:4477 [inline] kfree+0x149/0x360 mm/slub.c:4598 bpf_uprobe_multi_link_attach+0x9fe/0xb70 kernel/trace/bpf_trace.c:3500 link_create+0x727/0x8b0 kernel/bpf/syscall.c:5319 __sys_bpf+0x4bc/0x810 kernel/bpf/syscall.c:5780 __do_sys_bpf kernel/bpf/syscall.c:5817 [inline] __se_sys_bpf kernel/bpf/syscall.c:5815 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5815 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88802ea79a80 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 48 bytes inside of freed 64-byte region [ffff88802ea79a80, ffff88802ea79ac0) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88802ea79a80 pfn:0x2ea79 flags: 0xfff00000000200(workingset|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xfdffffff(slab) raw: 00fff00000000200 ffff88801a8418c0 ffffea00009064d0 ffffea0000cbc090 raw: ffff88802ea79a80 0000000000200017 00000001fdffffff 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 0x52c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 4675, tgid 4675 (S02sysctl), ts 30633300992, free_ts 28560617580 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1500 prep_new_page mm/page_alloc.c:1508 [inline] get_page_from_freelist+0x2e4c/0x2f10 mm/page_alloc.c:3446 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4702 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] alloc_slab_page+0x5f/0x120 mm/slub.c:2325 allocate_slab+0x5a/0x2f0 mm/slub.c:2488 new_slab mm/slub.c:2541 [inline] ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3727 __slab_alloc+0x58/0xa0 mm/slub.c:3817 __slab_alloc_node mm/slub.c:3870 [inline] slab_alloc_node mm/slub.c:4029 [inline] __do_kmalloc_node mm/slub.c:4161 [inline] __kmalloc_noprof+0x25a/0x400 mm/slub.c:4174 kmalloc_noprof include/linux/slab.h:685 [inline] kzalloc_noprof include/linux/slab.h:807 [inline] ima_alloc_init_template+0x8b/0x6e0 security/integrity/ima/ima_api.c:50 ima_store_measurement+0x28c/0x700 security/integrity/ima/ima_api.c:376 process_measurement+0x1511/0x1fb0 security/integrity/ima/ima_main.c:380 ima_bprm_check+0x129/0x2b0 security/integrity/ima/ima_main.c:547 security_bprm_check+0x65/0x90 security/security.c:1191 search_binary_handler fs/exec.c:1815 [inline] exec_binprm fs/exec.c:1869 [inline] bprm_execve+0xa56/0x1770 fs/exec.c:1920 do_execveat_common+0x55f/0x6f0 fs/exec.c:2027 do_execve fs/exec.c:2101 [inline] __do_sys_execve fs/exec.c:2177 [inline] __se_sys_execve fs/exec.c:2172 [inline] __x64_sys_execve+0x92/0xb0 fs/exec.c:2172 page last free pid 1 tgid 1 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1101 [inline] free_unref_page+0xd19/0xea0 mm/page_alloc.c:2619 kasan_depopulate_vmalloc_pte+0x74/0x90 mm/kasan/shadow.c:408 apply_to_pte_range mm/memory.c:2797 [inline] apply_to_pmd_range mm/memory.c:2841 [inline] apply_to_pud_range mm/memory.c:2877 [inline] apply_to_p4d_range mm/memory.c:2913 [inline] __apply_to_page_range+0x8a8/0xe50 mm/memory.c:2947 kasan_release_vmalloc+0x9a/0xb0 mm/kasan/shadow.c:525 purge_vmap_node+0x417/0x810 mm/vmalloc.c:2209 __purge_vmap_area_lazy+0x708/0xae0 mm/vmalloc.c:2293 _vm_unmap_aliases+0x79d/0x840 mm/vmalloc.c:2888 change_page_attr_set_clr+0x2fe/0xdb0 arch/x86/mm/pat/set_memory.c:1881 change_page_attr_set arch/x86/mm/pat/set_memory.c:1922 [inline] set_memory_nx+0xf2/0x130 arch/x86/mm/pat/set_memory.c:2110 free_init_pages arch/x86/mm/init.c:924 [inline] free_kernel_image_pages arch/x86/mm/init.c:943 [inline] free_initmem+0x79/0x110 arch/x86/mm/init.c:970 kernel_init+0x31/0x2b0 init/main.c:1476 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Memory state around the buggy address: ffff88802ea79980: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc ffff88802ea79a00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff88802ea79a80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff88802ea79b00: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc ffff88802ea79b80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ==================================================================