loop0: detected capacity change from 0 to 2048 syz.0.0: attempt to access beyond end of device loop0: rw=8388608, sector=19791209300050, nr_sectors = 2 limit=2048 NILFS (loop0): I/O error reading meta-data file (ino=5, block-offset=0) NILFS (loop0): error -5 while loading super root loop0: detected capacity change from 0 to 1024 ======================================================= WARNING: The mand mount option has been deprecated and and is ignored by this kernel. Remove the mand option from the mount to silence this warning. ======================================================= EXT4-fs: Ignoring removed oldalloc option EXT4-fs: Ignoring removed orlov option EXT4-fs (loop0): stripe (2) is not aligned with cluster size (16), stripe is disabled EXT4-fs (loop0): mounted filesystem 00000000-0000-0000-0000-000000000000 r/w without journal. Quota mode: writeback. ================================================================== BUG: KASAN: use-after-free in ext4_ext_rm_leaf fs/ext4/extents.c:2630 [inline] BUG: KASAN: use-after-free in ext4_ext_remove_space+0x3170/0x4280 fs/ext4/extents.c:2964 Read of size 4 at addr ffff888013068334 by task syz.0.0/5324 CPU: 0 UID: 0 PID: 5324 Comm: syz.0.0 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xba/0x230 mm/kasan/report.c:482 kasan_report+0x117/0x150 mm/kasan/report.c:595 ext4_ext_rm_leaf fs/ext4/extents.c:2630 [inline] ext4_ext_remove_space+0x3170/0x4280 fs/ext4/extents.c:2964 ext4_ext_truncate+0x17e/0x2f0 fs/ext4/extents.c:4537 ext4_truncate+0xb63/0x13b0 fs/ext4/inode.c:4564 ext4_setattr+0x106e/0x1c60 fs/ext4/inode.c:5956 notify_change+0xc1a/0xf40 fs/attr.c:556 do_truncate+0x1c2/0x250 fs/open.c:68 vfs_truncate+0x4b4/0x540 fs/open.c:118 do_sys_truncate+0xf3/0x1c0 fs/open.c:142 __do_sys_truncate fs/open.c:154 [inline] __se_sys_truncate fs/open.c:152 [inline] __x64_sys_truncate+0x5b/0x70 fs/open.c:152 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fb52679c799 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fb5275c0fe8 EFLAGS: 00000246 ORIG_RAX: 000000000000004c RAX: ffffffffffffffda RBX: 00007fb526a15fa0 RCX: 00007fb52679c799 RDX: 0000000000000000 RSI: 0000000000000006 RDI: 0000200000000180 RBP: 00007fb526832bd9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fb526a16038 R14: 00007fb526a15fa0 R15: 00007ffd80d482d8 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x5 pfn:0x13068 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f0(buddy) raw: 00fff00000000000 ffffea00004c7d08 ffffea00004c2808 0000000000000000 raw: 0000000000000005 0000000000000002 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 5324, tgid 5322 (syz.0.0), ts 85483463277, free_ts 85579001897 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x231/0x280 mm/page_alloc.c:1889 prep_new_page mm/page_alloc.c:1897 [inline] get_page_from_freelist+0x24dc/0x2580 mm/page_alloc.c:3962 __alloc_frozen_pages_noprof+0x18d/0x380 mm/page_alloc.c:5250 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2484 folio_alloc_mpol_noprof+0x39/0x70 mm/mempolicy.c:2503 shmem_alloc_folio mm/shmem.c:1930 [inline] shmem_alloc_and_add_folio+0x445/0xf80 mm/shmem.c:1972 shmem_get_folio_gfp+0x5a9/0x1670 mm/shmem.c:2567 shmem_get_folio mm/shmem.c:2673 [inline] shmem_write_begin+0x16c/0x330 mm/shmem.c:3327 generic_perform_write+0x2e2/0x8f0 mm/filemap.c:4314 shmem_file_write_iter+0xf8/0x120 mm/shmem.c:3502 new_sync_write fs/read_write.c:595 [inline] vfs_write+0x61d/0xb90 fs/read_write.c:688 ksys_write+0x150/0x270 fs/read_write.c:740 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 77 tgid 77 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] __free_pages_prepare mm/page_alloc.c:1433 [inline] free_unref_folios+0xed5/0x16d0 mm/page_alloc.c:3040 shrink_folio_list+0x4a6b/0x5290 mm/vmscan.c:1610 evict_folios+0x4795/0x5880 mm/vmscan.c:4718 try_to_shrink_lruvec+0xb62/0xfa0 mm/vmscan.c:4881 shrink_one+0x25c/0x710 mm/vmscan.c:4926 shrink_many mm/vmscan.c:4989 [inline] lru_gen_shrink_node mm/vmscan.c:5067 [inline] shrink_node+0x3197/0x3a90 mm/vmscan.c:6047 kswapd_shrink_node mm/vmscan.c:6894 [inline] balance_pgdat mm/vmscan.c:7070 [inline] kswapd+0x1742/0x2e10 mm/vmscan.c:7343 kthread+0x388/0x470 kernel/kthread.c:467 ret_from_fork+0x51e/0xb90 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Memory state around the buggy address: ffff888013068200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888013068280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888013068300: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888013068380: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888013068400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================