================================================================== BUG: KASAN: use-after-free in init_inode fs/reiserfs/inode.c:1314 [inline] BUG: KASAN: use-after-free in reiserfs_read_locked_inode+0x20ec/0x2170 fs/reiserfs/inode.c:1560 Read of size 4 at addr ffff888059dc0000 by task syz.5.49/5526 CPU: 0 UID: 0 PID: 5526 Comm: syz.5.49 Not tainted 6.12.0-rc1-syzkaller-00381-g2a130b7e1fcd #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 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 init_inode fs/reiserfs/inode.c:1314 [inline] reiserfs_read_locked_inode+0x20ec/0x2170 fs/reiserfs/inode.c:1560 reiserfs_fill_super+0x135e/0x31a0 fs/reiserfs/super.c:2070 mount_bdev+0x1e6/0x2d0 fs/super.c:1679 legacy_get_tree+0x10c/0x220 fs/fs_context.c:662 vfs_get_tree+0x92/0x380 fs/super.c:1800 do_new_mount fs/namespace.c:3507 [inline] path_mount+0x14e6/0x1f20 fs/namespace.c:3834 do_mount fs/namespace.c:3847 [inline] __do_sys_mount fs/namespace.c:4055 [inline] __se_sys_mount fs/namespace.c:4032 [inline] __x64_sys_mount+0x294/0x320 fs/namespace.c:4032 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:0x7fb67e57f79a Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 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:00007fb67f2e0e68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007fb67f2e0ef0 RCX: 00007fb67e57f79a RDX: 0000000020001100 RSI: 0000000020001140 RDI: 00007fb67f2e0eb0 RBP: 0000000020001100 R08: 00007fb67f2e0ef0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000020001140 R13: 00007fb67f2e0eb0 R14: 00000000000010e8 R15: 0000000020001180 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x81f pfn:0x59dc0 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f0(buddy) raw: 00fff00000000000 ffffea00016ed008 ffffea000167e008 0000000000000000 raw: 000000000000081f 0000000000000006 00000000f0000000 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Movable, gfp_mask 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 5509, tgid 5508 (syz.3.47), ts 98828263272, free_ts 99762610715 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25c0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265 folio_alloc_mpol_noprof+0x36/0xd0 mm/mempolicy.c:2283 shmem_alloc_folio+0x135/0x160 mm/shmem.c:1774 shmem_alloc_and_add_folio+0x48b/0xc00 mm/shmem.c:1813 shmem_get_folio_gfp+0x689/0x1530 mm/shmem.c:2335 shmem_fault+0x200/0xae0 mm/shmem.c:2536 __do_fault+0x10d/0x490 mm/memory.c:4876 do_read_fault mm/memory.c:5282 [inline] do_fault mm/memory.c:5416 [inline] do_pte_missing+0xea8/0x3e50 mm/memory.c:3965 handle_pte_fault mm/memory.c:5751 [inline] __handle_mm_fault+0x100a/0x2a10 mm/memory.c:5894 handle_mm_fault+0x3fa/0xaa0 mm/memory.c:6062 faultin_page mm/gup.c:1187 [inline] __get_user_pages+0x90f/0x3b90 mm/gup.c:1485 populate_vma_page_range+0x27f/0x3a0 mm/gup.c:1923 __mm_populate+0x1d6/0x380 mm/gup.c:2026 page last free pid 5512 tgid 5508 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_folios+0x956/0x1310 mm/page_alloc.c:2686 folios_put_refs+0x551/0x750 mm/swap.c:1007 folio_batch_release include/linux/pagevec.h:101 [inline] shmem_undo_range+0x586/0x1170 mm/shmem.c:1032 shmem_truncate_range mm/shmem.c:1144 [inline] shmem_evict_inode+0x3a3/0xba0 mm/shmem.c:1272 evict+0x40c/0x970 fs/inode.c:723 iput_final fs/inode.c:1875 [inline] iput fs/inode.c:1901 [inline] iput+0x530/0x890 fs/inode.c:1887 dentry_unlink_inode+0x29c/0x480 fs/dcache.c:412 __dentry_kill+0x1d0/0x600 fs/dcache.c:615 dput.part.0+0x4b1/0x9b0 fs/dcache.c:857 dput+0x1f/0x30 fs/dcache.c:847 __fput+0x513/0xb60 fs/file_table.c:439 task_work_run+0x151/0x250 kernel/task_work.c:228 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0xadd/0x2d70 kernel/exit.c:939 do_group_exit+0xd3/0x2a0 kernel/exit.c:1088 get_signal+0x25fb/0x2770 kernel/signal.c:2917 arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:337 Memory state around the buggy address: ffff888059dbff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888059dbff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888059dc0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888059dc0080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888059dc0100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== ================================================================== BUG: KASAN: use-after-free in init_inode fs/reiserfs/inode.c:1315 [inline] BUG: KASAN: use-after-free in reiserfs_read_locked_inode+0x20fb/0x2170 fs/reiserfs/inode.c:1560 Read of size 4 at addr ffff888059dc0004 by task syz.5.49/5526 CPU: 0 UID: 0 PID: 5526 Comm: syz.5.49 Tainted: G B 6.12.0-rc1-syzkaller-00381-g2a130b7e1fcd #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 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 init_inode fs/reiserfs/inode.c:1315 [inline] reiserfs_read_locked_inode+0x20fb/0x2170 fs/reiserfs/inode.c:1560 reiserfs_fill_super+0x135e/0x31a0 fs/reiserfs/super.c:2070 mount_bdev+0x1e6/0x2d0 fs/super.c:1679 legacy_get_tree+0x10c/0x220 fs/fs_context.c:662 vfs_get_tree+0x92/0x380 fs/super.c:1800 do_new_mount fs/namespace.c:3507 [inline] path_mount+0x14e6/0x1f20 fs/namespace.c:3834 do_mount fs/namespace.c:3847 [inline] __do_sys_mount fs/namespace.c:4055 [inline] __se_sys_mount fs/namespace.c:4032 [inline] __x64_sys_mount+0x294/0x320 fs/namespace.c:4032 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:0x7fb67e57f79a Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 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:00007fb67f2e0e68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007fb67f2e0ef0 RCX: 00007fb67e57f79a RDX: 0000000020001100 RSI: 0000000020001140 RDI: 00007fb67f2e0eb0 RBP: 0000000020001100 R08: 00007fb67f2e0ef0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000020001140 R13: 00007fb67f2e0eb0 R14: 00000000000010e8 R15: 0000000020001180 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x81f pfn:0x59dc0 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f0(buddy) raw: 00fff00000000000 ffffea00016ed008 ffffea000167e008 0000000000000000 raw: 000000000000081f 0000000000000006 00000000f0000000 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Movable, gfp_mask 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 5509, tgid 5508 (syz.3.47), ts 98828263272, free_ts 99762610715 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25c0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265 folio_alloc_mpol_noprof+0x36/0xd0 mm/mempolicy.c:2283 shmem_alloc_folio+0x135/0x160 mm/shmem.c:1774 shmem_alloc_and_add_folio+0x48b/0xc00 mm/shmem.c:1813 shmem_get_folio_gfp+0x689/0x1530 mm/shmem.c:2335 shmem_fault+0x200/0xae0 mm/shmem.c:2536 __do_fault+0x10d/0x490 mm/memory.c:4876 do_read_fault mm/memory.c:5282 [inline] do_fault mm/memory.c:5416 [inline] do_pte_missing+0xea8/0x3e50 mm/memory.c:3965 handle_pte_fault mm/memory.c:5751 [inline] __handle_mm_fault+0x100a/0x2a10 mm/memory.c:5894 handle_mm_fault+0x3fa/0xaa0 mm/memory.c:6062 faultin_page mm/gup.c:1187 [inline] __get_user_pages+0x90f/0x3b90 mm/gup.c:1485 populate_vma_page_range+0x27f/0x3a0 mm/gup.c:1923 __mm_populate+0x1d6/0x380 mm/gup.c:2026 page last free pid 5512 tgid 5508 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_folios+0x956/0x1310 mm/page_alloc.c:2686 folios_put_refs+0x551/0x750 mm/swap.c:1007 folio_batch_release include/linux/pagevec.h:101 [inline] shmem_undo_range+0x586/0x1170 mm/shmem.c:1032 shmem_truncate_range mm/shmem.c:1144 [inline] shmem_evict_inode+0x3a3/0xba0 mm/shmem.c:1272 evict+0x40c/0x970 fs/inode.c:723 iput_final fs/inode.c:1875 [inline] iput fs/inode.c:1901 [inline] iput+0x530/0x890 fs/inode.c:1887 dentry_unlink_inode+0x29c/0x480 fs/dcache.c:412 __dentry_kill+0x1d0/0x600 fs/dcache.c:615 dput.part.0+0x4b1/0x9b0 fs/dcache.c:857 dput+0x1f/0x30 fs/dcache.c:847 __fput+0x513/0xb60 fs/file_table.c:439 task_work_run+0x151/0x250 kernel/task_work.c:228 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0xadd/0x2d70 kernel/exit.c:939 do_group_exit+0xd3/0x2a0 kernel/exit.c:1088 get_signal+0x25fb/0x2770 kernel/signal.c:2917 arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:337 Memory state around the buggy address: ffff888059dbff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888059dbff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888059dc0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888059dc0080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888059dc0100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== ================================================================== BUG: KASAN: use-after-free in init_inode fs/reiserfs/inode.c:1316 [inline] BUG: KASAN: use-after-free in reiserfs_read_locked_inode+0x2114/0x2170 fs/reiserfs/inode.c:1560 Read of size 4 at addr ffff888059dc0008 by task syz.5.49/5526 CPU: 0 UID: 0 PID: 5526 Comm: syz.5.49 Tainted: G B 6.12.0-rc1-syzkaller-00381-g2a130b7e1fcd #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 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 init_inode fs/reiserfs/inode.c:1316 [inline] reiserfs_read_locked_inode+0x2114/0x2170 fs/reiserfs/inode.c:1560 reiserfs_fill_super+0x135e/0x31a0 fs/reiserfs/super.c:2070 mount_bdev+0x1e6/0x2d0 fs/super.c:1679 legacy_get_tree+0x10c/0x220 fs/fs_context.c:662 vfs_get_tree+0x92/0x380 fs/super.c:1800 do_new_mount fs/namespace.c:3507 [inline] path_mount+0x14e6/0x1f20 fs/namespace.c:3834 do_mount fs/namespace.c:3847 [inline] __do_sys_mount fs/namespace.c:4055 [inline] __se_sys_mount fs/namespace.c:4032 [inline] __x64_sys_mount+0x294/0x320 fs/namespace.c:4032 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:0x7fb67e57f79a Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 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:00007fb67f2e0e68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007fb67f2e0ef0 RCX: 00007fb67e57f79a RDX: 0000000020001100 RSI: 0000000020001140 RDI: 00007fb67f2e0eb0 RBP: 0000000020001100 R08: 00007fb67f2e0ef0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000020001140 R13: 00007fb67f2e0eb0 R14: 00000000000010e8 R15: 0000000020001180 The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:ffff88805d0c6598 index:0x535 pfn:0x59dc0 memcg:ffff888027fd8000 aops:shmem_aops ino:407 dentry name(?):"memfd:syzkaller" flags: 0xfff6000002003c(referenced|uptodate|dirty|lru|swapbacked|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff6000002003c ffffea000167efc8 ffffea0001677048 ffff88805d0c6598 raw: 0000000000000535 0000000000000000 00000001ffffffff ffff888027fd8000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Movable, gfp_mask 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 5528, tgid 5527 (syz.0.43), ts 102559184477, free_ts 99762610715 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25c0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265 folio_alloc_mpol_noprof+0x36/0xd0 mm/mempolicy.c:2283 shmem_alloc_folio+0x135/0x160 mm/shmem.c:1774 shmem_alloc_and_add_folio+0x48b/0xc00 mm/shmem.c:1813 shmem_get_folio_gfp+0x689/0x1530 mm/shmem.c:2335 shmem_get_folio mm/shmem.c:2441 [inline] shmem_write_begin+0x161/0x300 mm/shmem.c:3046 generic_perform_write+0x2bd/0x920 mm/filemap.c:4054 shmem_file_write_iter+0x10e/0x140 mm/shmem.c:3221 new_sync_write fs/read_write.c:590 [inline] vfs_write+0x6b8/0x1140 fs/read_write.c:683 ksys_write+0x12f/0x260 fs/read_write.c:736 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 page last free pid 5512 tgid 5508 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_folios+0x956/0x1310 mm/page_alloc.c:2686 folios_put_refs+0x551/0x750 mm/swap.c:1007 folio_batch_release include/linux/pagevec.h:101 [inline] shmem_undo_range+0x586/0x1170 mm/shmem.c:1032 shmem_truncate_range mm/shmem.c:1144 [inline] shmem_evict_inode+0x3a3/0xba0 mm/shmem.c:1272 evict+0x40c/0x970 fs/inode.c:723 iput_final fs/inode.c:1875 [inline] iput fs/inode.c:1901 [inline] iput+0x530/0x890 fs/inode.c:1887 dentry_unlink_inode+0x29c/0x480 fs/dcache.c:412 __dentry_kill+0x1d0/0x600 fs/dcache.c:615 dput.part.0+0x4b1/0x9b0 fs/dcache.c:857 dput+0x1f/0x30 fs/dcache.c:847 __fput+0x513/0xb60 fs/file_table.c:439 task_work_run+0x151/0x250 kernel/task_work.c:228 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0xadd/0x2d70 kernel/exit.c:939 do_group_exit+0xd3/0x2a0 kernel/exit.c:1088 get_signal+0x25fb/0x2770 kernel/signal.c:2917 arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:337 Memory state around the buggy address: ffff888059dbff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888059dbff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888059dc0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffff888059dc0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888059dc0100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== REISERFS warning (device loop5): vs-13075 reiserfs_read_locked_inode: dead inode read from disk [1 2 0x0 SD]. This is likely to be race with knfsd. Ignore REISERFS warning (device loop5): reiserfs_fill_super: corrupt root inode, run fsck