================================================================== BUG: KASAN: slab-use-after-free in consumer_filter kernel/events/uprobes.c:869 [inline] BUG: KASAN: slab-use-after-free in filter_chain+0xf6/0x110 kernel/events/uprobes.c:880 Read of size 8 at addr ffff88807b7d3430 by task syz.1.3024/15383 CPU: 1 PID: 15383 Comm: syz.1.3024 Not tainted 6.10.0-syzkaller-11185-g2c9b3512402e #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/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 consumer_filter kernel/events/uprobes.c:869 [inline] filter_chain+0xf6/0x110 kernel/events/uprobes.c:880 uprobe_mmap+0x46b/0x1240 kernel/events/uprobes.c:1387 mmap_region+0x1228/0x2760 mm/mmap.c:2987 do_mmap+0xbc7/0xf60 mm/mmap.c:1397 vm_mmap_pgoff+0x1ba/0x360 mm/util.c:588 ksys_mmap_pgoff+0x332/0x5d0 mm/mmap.c:1443 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:86 [inline] __se_sys_mmap arch/x86/kernel/sys_x86_64.c:79 [inline] __x64_sys_mmap+0x125/0x190 arch/x86/kernel/sys_x86_64.c:79 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f32d0d75b59 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:00007f32d1be2048 EFLAGS: 00000246 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 00007f32d0f05f60 RCX: 00007f32d0d75b59 RDX: 0000000000000001 RSI: 0000000000400000 RDI: 0000000020000000 RBP: 00007f32d0de4e5d R08: 000000000000000a R09: 0000000000000000 R10: 0000000000010012 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f32d0f05f60 R15: 00007ffce8c30158 Allocated by task 10083: 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:681 [inline] kzalloc_noprof include/linux/slab.h:807 [inline] netlbl_secattr_alloc_noprof include/net/netlabel.h:384 [inline] selinux_netlbl_sock_genattr+0xb0/0x4b0 security/selinux/netlabel.c:77 selinux_netlbl_socket_post_create+0x79/0x150 security/selinux/netlabel.c:402 selinux_socket_post_create+0x2f0/0x7e0 security/selinux/hooks.c:4662 security_socket_post_create+0x8b/0xd0 security/security.c:4425 __sock_create+0x68d/0x800 net/socket.c:1587 sock_create net/socket.c:1622 [inline] __sys_socket_create net/socket.c:1659 [inline] __sys_socket+0x14f/0x260 net/socket.c:1706 __do_sys_socket net/socket.c:1720 [inline] __se_sys_socket net/socket.c:1718 [inline] __x64_sys_socket+0x72/0xb0 net/socket.c:1718 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 10083: 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:2235 [inline] slab_free mm/slub.c:4464 [inline] kfree+0x12a/0x3b0 mm/slub.c:4585 netlbl_secattr_free include/net/netlabel.h:399 [inline] selinux_netlbl_sk_security_free+0x12c/0x400 security/selinux/netlabel.c:160 selinux_sk_free_security+0x46/0x60 security/selinux/hooks.c:5251 security_sk_free+0x45/0x80 security/security.c:4700 sk_prot_free net/core/sock.c:2128 [inline] __sk_destruct+0x461/0x730 net/core/sock.c:2224 sk_destruct+0xc2/0xf0 net/core/sock.c:2239 __sk_free+0xf4/0x3e0 net/core/sock.c:2250 sk_free+0x7c/0xa0 net/core/sock.c:2261 sock_put include/net/sock.h:1884 [inline] tcp_close+0xe1/0x130 net/ipv4/tcp.c:2966 inet_release+0x13c/0x280 net/ipv4/af_inet.c:437 inet6_release+0x4f/0x70 net/ipv6/af_inet6.c:489 __sock_release+0xb0/0x270 net/socket.c:659 sock_close+0x1c/0x30 net/socket.c:1421 __fput+0x408/0xbb0 fs/file_table.c:422 __fput_sync+0x47/0x50 fs/file_table.c:507 __do_sys_close fs/open.c:1566 [inline] __se_sys_close fs/open.c:1551 [inline] __x64_sys_close+0x86/0x100 fs/open.c:1551 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88807b7d3400 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 48 bytes inside of freed 64-byte region [ffff88807b7d3400, ffff88807b7d3440) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88807b7d3380 pfn:0x7b7d3 flags: 0xfff00000000200(workingset|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffefff(slab) raw: 00fff00000000200 ffff8880154418c0 ffffea0000a36450 ffffea0001ee2a50 raw: ffff88807b7d3380 0000000000200018 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 0x52c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 5142, tgid 5142 (udevd), ts 79165114932, free_ts 78975089659 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1473 prep_new_page mm/page_alloc.c:1481 [inline] get_page_from_freelist+0x1353/0x2e50 mm/page_alloc.c:3425 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4683 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] alloc_slab_page+0x56/0x110 mm/slub.c:2304 allocate_slab mm/slub.c:2467 [inline] new_slab+0x84/0x260 mm/slub.c:2520 ___slab_alloc+0xdac/0x1870 mm/slub.c:3706 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3796 __slab_alloc_node mm/slub.c:3849 [inline] slab_alloc_node mm/slub.c:4016 [inline] __do_kmalloc_node mm/slub.c:4148 [inline] __kmalloc_noprof+0x367/0x400 mm/slub.c:4161 kmalloc_noprof include/linux/slab.h:685 [inline] kzalloc_noprof include/linux/slab.h:807 [inline] tomoyo_encode2+0x100/0x3e0 security/tomoyo/realpath.c:45 tomoyo_encode+0x29/0x50 security/tomoyo/realpath.c:80 tomoyo_realpath_from_path+0x19d/0x720 security/tomoyo/realpath.c:283 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_check_open_permission+0x2a7/0x3b0 security/tomoyo/file.c:771 tomoyo_file_open+0x71/0x90 security/tomoyo/tomoyo.c:334 security_file_open+0x78/0x8b0 security/security.c:2988 do_dentry_open+0x5c7/0x15f0 fs/open.c:946 vfs_open+0x82/0x3f0 fs/open.c:1089 page last free pid 5089 tgid 5089 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1093 [inline] free_unref_page+0x64a/0xe40 mm/page_alloc.c:2588 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:3979 [inline] slab_alloc_node mm/slub.c:4028 [inline] kmem_cache_alloc_lru_noprof+0x121/0x2f0 mm/slub.c:4047 __d_alloc+0x31/0xaa0 fs/dcache.c:1631 d_alloc+0x4a/0x1e0 fs/dcache.c:1711 d_alloc_parallel+0xe9/0x12b0 fs/dcache.c:2471 __lookup_slow+0x194/0x460 fs/namei.c:1703 lookup_one_len+0x181/0x1b0 fs/namei.c:2837 start_creating.part.0+0x12f/0x3a0 fs/debugfs/inode.c:370 start_creating fs/debugfs/inode.c:343 [inline] __debugfs_create_file+0xa5/0x660 fs/debugfs/inode.c:415 nsim_create+0x372/0xb20 drivers/net/netdevsim/netdev.c:756 __nsim_dev_port_add+0x42c/0x7d0 drivers/net/netdevsim/dev.c:1390 nsim_dev_port_add_all drivers/net/netdevsim/dev.c:1446 [inline] nsim_drv_probe+0xdbf/0x1490 drivers/net/netdevsim/dev.c:1604 call_driver_probe drivers/base/dd.c:578 [inline] really_probe+0x23e/0xa90 drivers/base/dd.c:656 Memory state around the buggy address: ffff88807b7d3300: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ffff88807b7d3380: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff88807b7d3400: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff88807b7d3480: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc ffff88807b7d3500: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc ==================================================================