================================================================== BUG: KASAN: slab-use-after-free in consumer_del kernel/events/uprobes.c:772 [inline] BUG: KASAN: slab-use-after-free in __uprobe_unregister+0x85/0x1f0 kernel/events/uprobes.c:1087 Read of size 8 at addr ffff88802ba7a838 by task syz.2.95/6089 CPU: 0 UID: 0 PID: 6089 Comm: syz.2.95 Not tainted 6.11.0-rc4-syzkaller-00268-g48fb4b3d9b43 #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_del kernel/events/uprobes.c:772 [inline] __uprobe_unregister+0x85/0x1f0 kernel/events/uprobes.c:1087 uprobe_unregister+0x49/0x80 kernel/events/uprobes.c:1111 bpf_uprobe_unregister kernel/trace/bpf_trace.c:3187 [inline] bpf_uprobe_multi_link_release+0x13a/0x2f0 kernel/trace/bpf_trace.c:3197 bpf_link_free+0xf5/0x250 kernel/bpf/syscall.c:3067 bpf_link_put_direct kernel/bpf/syscall.c:3107 [inline] bpf_link_release+0x7b/0x90 kernel/bpf/syscall.c:3114 __fput+0x24a/0x8a0 fs/file_table.c:422 task_work_run+0x24f/0x310 kernel/task_work.c:228 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop kernel/entry/common.c:114 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x168/0x370 kernel/entry/common.c:218 do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fb19dd79e79 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:00007ffe95e86d38 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 00007fb19df17a80 RCX: 00007fb19dd79e79 RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003 RBP: 00007fb19df17a80 R08: 0000000000000006 R09: 00007ffe95e8701f R10: 000000000003fdac R11: 0000000000000246 R12: 000000000002c192 R13: 00007ffe95e86e30 R14: 00007ffe95e86e50 R15: ffffffffffffffff Allocated by task 6093: 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:4158 [inline] __kmalloc_node_noprof+0x22a/0x440 mm/slub.c:4164 __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 6093: 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:2252 [inline] slab_free mm/slub.c:4473 [inline] kfree+0x149/0x360 mm/slub.c:4594 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 ffff88802ba7a800 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 56 bytes inside of freed 64-byte region [ffff88802ba7a800, ffff88802ba7a840) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2ba7a anon flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xfdffffff(slab) raw: 00fff00000000000 ffff8880154418c0 ffffea0000b89740 dead000000000005 raw: 0000000000000000 0000000000200020 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 4667, tgid 4667 (udevd), ts 33040996202, free_ts 33033188685 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1493 prep_new_page mm/page_alloc.c:1501 [inline] get_page_from_freelist+0x2e4c/0x2f10 mm/page_alloc.c:3439 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4695 __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:2321 allocate_slab+0x5a/0x2f0 mm/slub.c:2484 new_slab mm/slub.c:2537 [inline] ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3723 __slab_alloc+0x58/0xa0 mm/slub.c:3813 __slab_alloc_node mm/slub.c:3866 [inline] slab_alloc_node mm/slub.c:4025 [inline] __do_kmalloc_node mm/slub.c:4157 [inline] __kmalloc_noprof+0x25a/0x400 mm/slub.c:4170 kmalloc_noprof include/linux/slab.h:685 [inline] kzalloc_noprof include/linux/slab.h:807 [inline] tomoyo_encode2 security/tomoyo/realpath.c:45 [inline] tomoyo_encode+0x26f/0x540 security/tomoyo/realpath.c:80 tomoyo_realpath_from_path+0x59e/0x5e0 security/tomoyo/realpath.c:283 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_check_open_permission+0x255/0x500 security/tomoyo/file.c:771 security_file_open+0x6a/0x750 security/security.c:2988 do_dentry_open+0x38e/0x1440 fs/open.c:946 vfs_open+0x3e/0x330 fs/open.c:1089 do_open fs/namei.c:3727 [inline] path_openat+0x2b3e/0x3470 fs/namei.c:3886 do_filp_open+0x235/0x490 fs/namei.c:3913 page last free pid 4681 tgid 4681 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1094 [inline] free_unref_page+0xd19/0xea0 mm/page_alloc.c:2612 __slab_free+0x31b/0x3d0 mm/slub.c:4384 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x9e/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3988 [inline] slab_alloc_node mm/slub.c:4037 [inline] kmem_cache_alloc_lru_noprof+0x139/0x2b0 mm/slub.c:4056 __d_alloc+0x31/0x700 fs/dcache.c:1631 d_alloc fs/dcache.c:1711 [inline] d_alloc_parallel+0xdf/0x1600 fs/dcache.c:2471 __lookup_slow+0x117/0x3f0 fs/namei.c:1703 lookup_slow+0x53/0x70 fs/namei.c:1735 walk_component fs/namei.c:2039 [inline] link_path_walk+0x99b/0xea0 fs/namei.c:2404 path_lookupat+0xa9/0x450 fs/namei.c:2565 filename_lookup+0x256/0x610 fs/namei.c:2595 vfs_statx+0x103/0x490 fs/stat.c:312 vfs_fstatat+0x145/0x190 fs/stat.c:341 __do_sys_newfstatat fs/stat.c:505 [inline] __se_sys_newfstatat fs/stat.c:499 [inline] __x64_sys_newfstatat+0x11d/0x1a0 fs/stat.c:499 Memory state around the buggy address: ffff88802ba7a700: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88802ba7a780: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff88802ba7a800: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff88802ba7a880: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ffff88802ba7a900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ==================================================================