================================================================== BUG: KASAN: slab-use-after-free in nilfs_load_inode_block+0x114/0x250 fs/nilfs2/inode.c:1012 Read of size 8 at addr ffff8880728d0c30 by task syz-executor.2/2218 CPU: 0 PID: 2218 Comm: syz-executor.2 Not tainted 6.3.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xf8/0x260 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:351 [inline] print_report+0x163/0x540 mm/kasan/report.c:462 kasan_report+0x176/0x1b0 mm/kasan/report.c:572 nilfs_load_inode_block+0x114/0x250 fs/nilfs2/inode.c:1012 __nilfs_mark_inode_dirty+0xa0/0x220 fs/nilfs2/inode.c:1089 nilfs_dirty_inode+0x140/0x1d0 fs/nilfs2/inode.c:1130 __mark_inode_dirty+0x1b0/0x740 fs/fs-writeback.c:2424 mark_inode_dirty_sync include/linux/fs.h:2149 [inline] iput+0xb6/0x5e0 fs/inode.c:1770 nilfs_dispose_list+0x494/0x510 fs/nilfs2/segment.c:816 nilfs_detach_log_writer+0x8f3/0x990 fs/nilfs2/segment.c:2852 nilfs_put_super+0x49/0x130 fs/nilfs2/super.c:477 generic_shutdown_super+0x10b/0x2d0 fs/super.c:500 kill_block_super+0x7f/0xc0 fs/super.c:1407 deactivate_locked_super+0x75/0xd0 fs/super.c:331 cleanup_mnt+0x2a6/0x320 fs/namespace.c:1177 task_work_run+0x20a/0x280 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xa4/0xb0 kernel/entry/common.c:171 exit_to_user_mode_prepare+0x64/0xb0 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x2b/0x1d0 kernel/entry/common.c:297 do_syscall_64+0x4d/0x90 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fa7d6a7de57 Code: b0 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 b0 ff ff ff f7 d8 64 89 02 b8 RSP: 002b:00007ffe1bbe8b58 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007fa7d6a7de57 RDX: 0000000000000000 RSI: 000000000000000a RDI: 00007ffe1bbe8c10 RBP: 00007ffe1bbe8c10 R08: 0000000000000000 R09: 0000000000000000 R10: 00000000ffffffff R11: 0000000000000246 R12: 00007ffe1bbe9cd0 R13: 00007fa7d6ac73b9 R14: 0000000000012054 R15: 0000000000000007 Allocated by task 4644: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4f/0x70 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:559 [inline] kzalloc include/linux/slab.h:680 [inline] nilfs_find_or_create_root+0xea/0x3b0 fs/nilfs2/the_nilfs.c:810 nilfs_attach_checkpoint+0x11c/0x4b0 fs/nilfs2/super.c:529 nilfs_fill_super+0x2f3/0x590 fs/nilfs2/super.c:1074 nilfs_mount+0x5ce/0x840 fs/nilfs2/super.c:1326 legacy_get_tree+0xe9/0x170 fs/fs_context.c:610 vfs_get_tree+0x7e/0x180 fs/super.c:1510 do_new_mount+0x1e5/0x8f0 fs/namespace.c:3039 do_mount fs/namespace.c:3382 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount+0x242/0x2d0 fs/namespace.c:3568 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 2218: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4f/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:521 ____kasan_slab_free+0x122/0x1e0 mm/kasan/common.c:236 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook mm/slub.c:1807 [inline] slab_free mm/slub.c:3786 [inline] __kmem_cache_free+0x28b/0x450 mm/slub.c:3799 nilfs_segctor_destroy fs/nilfs2/segment.c:2775 [inline] nilfs_detach_log_writer+0x709/0x990 fs/nilfs2/segment.c:2838 nilfs_put_super+0x49/0x130 fs/nilfs2/super.c:477 generic_shutdown_super+0x10b/0x2d0 fs/super.c:500 kill_block_super+0x7f/0xc0 fs/super.c:1407 deactivate_locked_super+0x75/0xd0 fs/super.c:331 cleanup_mnt+0x2a6/0x320 fs/namespace.c:1177 task_work_run+0x20a/0x280 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xa4/0xb0 kernel/entry/common.c:171 exit_to_user_mode_prepare+0x64/0xb0 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x2b/0x1d0 kernel/entry/common.c:297 do_syscall_64+0x4d/0x90 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff8880728d0c00 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 48 bytes inside of freed 256-byte region [ffff8880728d0c00, ffff8880728d0d00) The buggy address belongs to the physical page: page:ffffea0001ca3400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x728d0 head:ffffea0001ca3400 order:1 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000010200 ffff888008c41b40 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0x1d2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 1549, tgid 1549 (udevd), ts 73877713067, free_ts 73606886323 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x26e/0x290 mm/page_alloc.c:1731 prep_new_page mm/page_alloc.c:1738 [inline] get_page_from_freelist+0x3197/0x3320 mm/page_alloc.c:3502 __alloc_pages+0x255/0x650 mm/page_alloc.c:4768 alloc_slab_page+0x6a/0x160 mm/slub.c:1851 allocate_slab mm/slub.c:1998 [inline] new_slab+0x70/0x260 mm/slub.c:2051 ___slab_alloc+0x8df/0xd60 mm/slub.c:3192 __slab_alloc mm/slub.c:3291 [inline] __slab_alloc_node mm/slub.c:3344 [inline] slab_alloc_node mm/slub.c:3441 [inline] __kmem_cache_alloc_node+0x1ae/0x270 mm/slub.c:3490 kmalloc_trace+0x2a/0xc0 mm/slab_common.c:1057 kmalloc include/linux/slab.h:559 [inline] kzalloc include/linux/slab.h:680 [inline] smk_fetch+0x79/0xf0 security/smack/smack_lsm.c:291 smack_d_instantiate+0x461/0x850 security/smack/smack_lsm.c:3475 security_d_instantiate+0x6b/0xb0 security/security.c:3760 d_instantiate+0x4b/0x80 fs/dcache.c:2034 shmem_mknod+0x147/0x170 mm/shmem.c:2957 lookup_open fs/namei.c:3492 [inline] open_last_lookups fs/namei.c:3560 [inline] path_openat+0xe9c/0x2810 fs/namei.c:3788 do_filp_open+0x22a/0x440 fs/namei.c:3818 do_sys_openat2+0x10f/0x430 fs/open.c:1356 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1302 [inline] free_unref_page_prepare+0x817/0x940 mm/page_alloc.c:2564 free_unref_page+0x37/0x3c0 mm/page_alloc.c:2659 qlist_free_all+0x22/0x60 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x157/0x180 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x23/0x70 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook+0x66/0x3c0 mm/slab.h:711 slab_alloc_node mm/slub.c:3451 [inline] __kmem_cache_alloc_node+0x14c/0x270 mm/slub.c:3490 __do_kmalloc_node mm/slab_common.c:965 [inline] __kmalloc+0x99/0x1d0 mm/slab_common.c:979 kmalloc include/linux/slab.h:563 [inline] tomoyo_realpath_from_path+0xe0/0x4e0 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x248/0x830 security/tomoyo/file.c:822 security_inode_getattr+0x7f/0xf0 security/security.c:2114 vfs_getattr fs/stat.c:167 [inline] vfs_statx+0x134/0x3f0 fs/stat.c:242 vfs_fstatat fs/stat.c:276 [inline] __do_sys_newfstatat fs/stat.c:446 [inline] __se_sys_newfstatat+0xfa/0x780 fs/stat.c:440 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff8880728d0b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880728d0b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880728d0c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880728d0c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880728d0d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================