EXT4-fs error (device loop0): __ext4_get_inode_loc:4347: comm kworker/u4:3: Invalid inode table block 0 in block_group 0
==================================================================
BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:827 [inline]
BUG: KASAN: use-after-free in ext4_find_extent+0xbab/0xdb0 fs/ext4/extents.c:946
Read of size 4 at addr ffff88811e5e9a9c by task kworker/u4:3/336
CPU: 0 PID: 336 Comm: kworker/u4:3 Not tainted 5.15.94-syzkaller-03204-g5448b2fda85f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Workqueue: writeback wb_workfn (flush-7:0)
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
print_address_description+0x87/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:427 [inline]
kasan_report+0x179/0x1c0 mm/kasan/report.c:444
__asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308
ext4_ext_binsearch fs/ext4/extents.c:827 [inline]
ext4_find_extent+0xbab/0xdb0 fs/ext4/extents.c:946
ext4_ext_map_blocks+0x254/0x7250 fs/ext4/extents.c:4103
ext4_map_blocks+0xaa7/0x1e30 fs/ext4/inode.c:646
mpage_map_one_extent fs/ext4/inode.c:2419 [inline]
mpage_map_and_submit_extent fs/ext4/inode.c:2472 [inline]
ext4_writepages+0x162a/0x4010 fs/ext4/inode.c:2840
do_writepages+0x40e/0x670 mm/page-writeback.c:2366
__writeback_single_inode+0xdf/0xa70 fs/fs-writeback.c:1622
writeback_sb_inodes+0xb2e/0x1910 fs/fs-writeback.c:1905
wb_writeback+0x3b9/0x9e0 fs/fs-writeback.c:2079
wb_do_writeback fs/fs-writeback.c:2222 [inline]
wb_workfn+0x3d9/0x1110 fs/fs-writeback.c:2263
process_one_work+0x6bb/0xc10 kernel/workqueue.c:2313
worker_thread+0xad5/0x12a0 kernel/workqueue.c:2460
kthread+0x421/0x510 kernel/kthread.c:319
ret_from_fork+0x1f/0x30 :298
The buggy address belongs to the page:
page:ffffea0004797a40 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x11e5e9
flags: 0x4000000000000000(zone=1)
raw: 4000000000000000 ffffea0004797788 ffffea0004797108 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffffff 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 0x100cca(GFP_HIGHUSER_MOVABLE), pid 343, ts 21209581202, free_ts 21440279794
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2502
prep_new_page mm/page_alloc.c:2508 [inline]
get_page_from_freelist+0x2c14/0x2cf0 mm/page_alloc.c:4291
__alloc_pages+0x386/0x7b0 mm/page_alloc.c:5569
__alloc_pages_node include/linux/gfp.h:591 [inline]
alloc_pages_node include/linux/gfp.h:605 [inline]
alloc_pages include/linux/gfp.h:618 [inline]
shmem_alloc_page mm/shmem.c:1587 [inline]
shmem_alloc_and_acct_page+0x4bd/0xa80 mm/shmem.c:1612
shmem_getpage_gfp+0x1388/0x23c0 mm/shmem.c:1907
shmem_getpage mm/shmem.c:152 [inline]
shmem_write_begin+0xca/0x1b0 mm/shmem.c:2478
generic_perform_write+0x2bc/0x5a0 mm/filemap.c:3830
__generic_file_write_iter+0x25b/0x4b0 mm/filemap.c:3957
generic_file_write_iter+0xaf/0x1c0 mm/filemap.c:3989
call_write_iter include/linux/fs.h:2157 [inline]
new_sync_write fs/read_write.c:507 [inline]
vfs_write+0xd8a/0x1160 fs/read_write.c:594
ksys_write+0x199/0x2c0 fs/read_write.c:647
__do_sys_write fs/read_write.c:659 [inline]
__se_sys_write fs/read_write.c:656 [inline]
__x64_sys_write+0x7b/0x90 fs/read_write.c:656
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
page last free stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
free_pages_prepare mm/page_alloc.c:1370 [inline]
free_pcp_prepare mm/page_alloc.c:1442 [inline]
free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3441
free_unref_page_list+0x15d/0x980 mm/page_alloc.c:3562
release_pages+0x1310/0x1370 mm/swap.c:1009
__pagevec_release+0x84/0x100 mm/swap.c:1029
pagevec_release include/linux/pagevec.h:81 [inline]
shmem_undo_range+0x604/0x1560 mm/shmem.c:965
shmem_truncate_range mm/shmem.c:1064 [inline]
shmem_evict_inode+0x215/0x9d0 mm/shmem.c:1146
evict+0x2a3/0x630 fs/inode.c:587
iput_final fs/inode.c:1663 [inline]
iput+0x63b/0x7e0 fs/inode.c:1689
dentry_unlink_inode+0x34f/0x440 fs/dcache.c:376
__dentry_kill+0x447/0x660 fs/dcache.c:582
dentry_kill+0xc0/0x2a0
dput+0x165/0x320 fs/dcache.c:888
__fput+0x662/0x910 fs/file_table.c:288
____fput+0x15/0x20 fs/file_table.c:308
task_work_run+0x129/0x190 kernel/task_work.c:164
ptrace_notify+0x29e/0x350 kernel/signal.c:2383
Memory state around the buggy address:
ffff88811e5e9980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88811e5e9a00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88811e5e9a80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff88811e5e9b00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88811e5e9b80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================
------------[ cut here ]------------
kernel BUG at fs/ext4/inode.c:2431!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 336 Comm: kworker/u4:3 Tainted: G B 5.15.94-syzkaller-03204-g5448b2fda85f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Workqueue: writeback wb_workfn (flush-7:0)
RIP: 0010:mpage_map_one_extent fs/ext4/inode.c:2431 [inline]
RIP: 0010:mpage_map_and_submit_extent fs/ext4/inode.c:2472 [inline]
RIP: 0010:ext4_writepages+0x3f45/0x4010 fs/ext4/inode.c:2840
Code: 00 74 08 48 89 df e8 2a f8 c9 ff 48 8b 3b 48 8b 74 24 48 48 8b 54 24 28 44 89 e9 45 89 f8 e8 22 45 08 00 eb 60 e8 3b be 88 ff <0f> 0b e8 34 be 88 ff eb 3b e8 2d be 88 ff eb 7a e8 26 be 88 ff 31
RSP: 0018:ffffc900009f7000 EFLAGS: 00010293
RAX: ffffffff81e6b385 RBX: dffffc0000000000 RCX: ffff88811f4b2780
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc900009f7410 R08: ffffffff81e68d4d R09: ffffed1021237b19
R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000
R13: ffffc900009f72e0 R14: 0000000000000000 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020002000 CR3: 000000011ed97000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
do_writepages+0x40e/0x670 mm/page-writeback.c:2366
__writeback_single_inode+0xdf/0xa70 fs/fs-writeback.c:1622
writeback_sb_inodes+0xb2e/0x1910 fs/fs-writeback.c:1905
wb_writeback+0x3b9/0x9e0 fs/fs-writeback.c:2079
wb_do_writeback fs/fs-writeback.c:2222 [inline]
wb_workfn+0x3d9/0x1110 fs/fs-writeback.c:2263
process_one_work+0x6bb/0xc10 kernel/workqueue.c:2313
worker_thread+0xad5/0x12a0 kernel/workqueue.c:2460
kthread+0x421/0x510 kernel/kthread.c:319
ret_from_fork+0x1f/0x30 :298
Modules linked in:
---[ end trace b0137a8fdb9ff54b ]---
RIP: 0010:mpage_map_one_extent fs/ext4/inode.c:2431 [inline]
RIP: 0010:mpage_map_and_submit_extent fs/ext4/inode.c:2472 [inline]
RIP: 0010:ext4_writepages+0x3f45/0x4010 fs/ext4/inode.c:2840
Code: 00 74 08 48 89 df e8 2a f8 c9 ff 48 8b 3b 48 8b 74 24 48 48 8b 54 24 28 44 89 e9 45 89 f8 e8 22 45 08 00 eb 60 e8 3b be 88 ff <0f> 0b e8 34 be 88 ff eb 3b e8 2d be 88 ff eb 7a e8 26 be 88 ff 31
RSP: 0018:ffffc900009f7000 EFLAGS: 00010293
RAX: ffffffff81e6b385 RBX: dffffc0000000000 RCX: ffff88811f4b2780
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc900009f7410 R08: ffffffff81e68d4d R09: ffffed1021237b19
R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000
R13: ffffc900009f72e0 R14: 0000000000000000 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020002000 CR3: 000000011ed97000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400