================================================================== BUG: KASAN: slab-use-after-free in v9fs_stat2inode_dotl+0x9dd/0xb80 fs/9p/vfs_inode_dotl.c:569 Read of size 8 at addr ffff8881169d1770 by task syz-executor.0/1866 CPU: 0 PID: 1866 Comm: syz-executor.0 Not tainted 6.8.0-rc1-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x3d/0x70 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc4/0x620 mm/kasan/report.c:488 kasan_report+0xda/0x110 mm/kasan/report.c:601 v9fs_stat2inode_dotl+0x9dd/0xb80 fs/9p/vfs_inode_dotl.c:569 v9fs_fid_iget_dotl+0x184/0x200 fs/9p/vfs_inode_dotl.c:85 v9fs_get_inode_from_fid fs/9p/v9fs.h:230 [inline] v9fs_mount+0x3ec/0x7d0 fs/9p/vfs_super.c:142 legacy_get_tree+0x102/0x200 fs/fs_context.c:662 vfs_get_tree+0x85/0x230 fs/super.c:1784 do_new_mount fs/namespace.c:3352 [inline] path_mount+0x8ec/0x1a70 fs/namespace.c:3679 do_mount fs/namespace.c:3692 [inline] __do_sys_mount fs/namespace.c:3898 [inline] __se_sys_mount fs/namespace.c:3875 [inline] __x64_sys_mount+0x20c/0x280 fs/namespace.c:3875 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x73/0x180 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6f/0x77 RIP: 0033:0x7f7c6ef02da9 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:00007f7c6ea850c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f7c6f031f80 RCX: 00007f7c6ef02da9 RDX: 0000000020004500 RSI: 00000000200002c0 RDI: 0000000000000000 RBP: 00007f7c6ef4f47a R08: 0000000020000300 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000006 R14: 00007f7c6f031f80 R15: 00007ffc63ea09a8 Allocated by task 1866: 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:372 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:389 kmalloc include/linux/slab.h:590 [inline] p9_client_getattr_dotl+0x49/0x260 net/9p/client.c:1726 v9fs_fid_iget_dotl+0xc2/0x200 fs/9p/vfs_inode_dotl.c:73 v9fs_get_inode_from_fid fs/9p/v9fs.h:230 [inline] v9fs_mount+0x3ec/0x7d0 fs/9p/vfs_super.c:142 legacy_get_tree+0x102/0x200 fs/fs_context.c:662 vfs_get_tree+0x85/0x230 fs/super.c:1784 do_new_mount fs/namespace.c:3352 [inline] path_mount+0x8ec/0x1a70 fs/namespace.c:3679 do_mount fs/namespace.c:3692 [inline] __do_sys_mount fs/namespace.c:3898 [inline] __se_sys_mount fs/namespace.c:3875 [inline] __x64_sys_mount+0x20c/0x280 fs/namespace.c:3875 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x73/0x180 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6f/0x77 Freed by task 1866: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3f/0x60 mm/kasan/generic.c:640 poison_slab_object mm/kasan/common.c:241 [inline] __kasan_slab_free+0x121/0x1c0 mm/kasan/common.c:257 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2121 [inline] slab_free mm/slub.c:4299 [inline] kfree+0x11b/0x340 mm/slub.c:4409 v9fs_fid_iget_dotl+0x156/0x200 fs/9p/vfs_inode_dotl.c:81 v9fs_get_inode_from_fid fs/9p/v9fs.h:230 [inline] v9fs_mount+0x3ec/0x7d0 fs/9p/vfs_super.c:142 legacy_get_tree+0x102/0x200 fs/fs_context.c:662 vfs_get_tree+0x85/0x230 fs/super.c:1784 do_new_mount fs/namespace.c:3352 [inline] path_mount+0x8ec/0x1a70 fs/namespace.c:3679 do_mount fs/namespace.c:3692 [inline] __do_sys_mount fs/namespace.c:3898 [inline] __se_sys_mount fs/namespace.c:3875 [inline] __x64_sys_mount+0x20c/0x280 fs/namespace.c:3875 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x73/0x180 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6f/0x77 The buggy address belongs to the object at ffff8881169d1770 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 0 bytes inside of freed 192-byte region [ffff8881169d1770, ffff8881169d1830) The buggy address belongs to the physical page: page:ffffea00045a7440 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1169d1 flags: 0x200000000000800(slab|node=0|zone=2) page_type: 0xffffffff() raw: 0200000000000800 ffff888100041a00 dead000000000122 0000000000000000 raw: 0000000000000000 00000000800f000f 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 1411, tgid 1411 (syz-executor.0), ts 51147176492, free_ts 51146933134 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x283/0x300 mm/page_alloc.c:1533 prep_new_page mm/page_alloc.c:1540 [inline] get_page_from_freelist+0xeb8/0x3700 mm/page_alloc.c:3311 __alloc_pages+0x346/0x5e0 mm/page_alloc.c:4567 __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+0xa3/0x340 mm/slub.c:2354 new_slab mm/slub.c:2407 [inline] ___slab_alloc+0x853/0x13e0 mm/slub.c:3540 __slab_alloc.constprop.0+0x4d/0x90 mm/slub.c:3625 __slab_alloc_node mm/slub.c:3678 [inline] slab_alloc_node mm/slub.c:3850 [inline] __do_kmalloc_node mm/slub.c:3980 [inline] __kmalloc_node+0x39e/0x4c0 mm/slub.c:3988 kmalloc_array_node include/linux/slab.h:688 [inline] kcalloc_node include/linux/slab.h:693 [inline] memcg_alloc_slab_cgroups+0xa9/0x180 mm/memcontrol.c:2988 __memcg_slab_post_alloc_hook+0xa4/0x2b0 mm/slub.c:1970 memcg_slab_post_alloc_hook mm/slub.c:1993 [inline] slab_post_alloc_hook mm/slub.c:3822 [inline] slab_alloc_node mm/slub.c:3860 [inline] kmem_cache_alloc+0x37d/0x390 mm/slub.c:3867 dup_fd+0x7b/0xab0 fs/file.c:324 copy_files kernel/fork.c:1788 [inline] copy_process+0x1ee5/0x93a0 kernel/fork.c:2484 kernel_clone+0xcb/0x7e0 kernel/fork.c:2901 __do_sys_clone+0xa1/0xe0 kernel/fork.c:3044 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x73/0x180 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6f/0x77 page last free pid 1411 tgid 1411 stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1140 [inline] free_unref_page_prepare+0x543/0xb10 mm/page_alloc.c:2346 free_unref_page+0x33/0x2a0 mm/page_alloc.c:2486 vfree mm/vmalloc.c:2842 [inline] vfree+0x27c/0x9c0 mm/vmalloc.c:2807 copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:882 [inline] get_entries net/ipv6/netfilter/ip6_tables.c:1039 [inline] do_ip6t_get_ctl+0x98a/0xd10 net/ipv6/netfilter/ip6_tables.c:1669 nf_getsockopt+0x5e/0xc0 net/netfilter/nf_sockopt.c:116 ipv6_getsockopt+0x178/0x1d0 net/ipv6/ipv6_sockglue.c:1488 do_sock_getsockopt+0x1fc/0x2f0 net/socket.c:2373 __sys_getsockopt+0xf6/0x1b0 net/socket.c:2402 __do_sys_getsockopt net/socket.c:2412 [inline] __se_sys_getsockopt net/socket.c:2409 [inline] __x64_sys_getsockopt+0xb8/0x150 net/socket.c:2409 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x73/0x180 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6f/0x77 Memory state around the buggy address: ffff8881169d1600: 00 fc fc fc fc fc fc fc fc fc fc fc 00 00 00 00 ffff8881169d1680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff8881169d1700: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fa fb ^ ffff8881169d1780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881169d1800: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc ==================================================================