==================================================================
BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:837 [inline]
BUG: KASAN: use-after-free in ext4_find_extent+0xbab/0xdb0 fs/ext4/extents.c:953
Read of size 4 at addr ffff8881269f54cc by task kworker/u4:0/8
CPU: 1 PID: 8 Comm: kworker/u4:0 Not tainted 6.1.57-syzkaller-1150540-g401a2769d990 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/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 mm/kasan/report.c:316 [inline]
print_report+0x158/0x4e0 mm/kasan/report.c:427
kasan_report+0x13c/0x170 mm/kasan/report.c:531
__asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:350
ext4_ext_binsearch fs/ext4/extents.c:837 [inline]
ext4_find_extent+0xbab/0xdb0 fs/ext4/extents.c:953
ext4_ext_map_blocks+0x255/0x71e0 fs/ext4/extents.c:4103
ext4_map_blocks+0xa36/0x1ca0 fs/ext4/inode.c:651
mpage_map_one_extent fs/ext4/inode.c:2411 [inline]
mpage_map_and_submit_extent fs/ext4/inode.c:2464 [inline]
ext4_writepages+0x17b5/0x3fd0 fs/ext4/inode.c:2832
do_writepages+0x385/0x620 mm/page-writeback.c:2472
__writeback_single_inode+0xdc/0xb80 fs/fs-writeback.c:1590
writeback_sb_inodes+0xb33/0x18f0 fs/fs-writeback.c:1881
wb_writeback+0x3b9/0x9f0 fs/fs-writeback.c:2055
wb_do_writeback fs/fs-writeback.c:2198 [inline]
wb_workfn+0x399/0x1030 fs/fs-writeback.c:2238
process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299
worker_thread+0xa60/0x1260 kernel/workqueue.c:2446
kthread+0x26d/0x300 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
The buggy address belongs to the physical page:
page:ffffea00049a7d40 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x1269f5
flags: 0x4000000000000000(zone=1)
raw: 4000000000000000 ffffea00049a7488 ffffea00049a7448 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 0x148c48(GFP_NOFS|__GFP_NOFAIL|__GFP_COMP|__GFP_HARDWALL|__GFP_MOVABLE), pid 392, tgid 391 (syz-executor.0), ts 44670938267, free_ts 44747165001
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0x213/0x220 mm/page_alloc.c:2566
prep_new_page+0x1b/0x110 mm/page_alloc.c:2573
get_page_from_freelist+0x27ea/0x2870 mm/page_alloc.c:4397
__alloc_pages+0x3a1/0x780 mm/page_alloc.c:5684
__folio_alloc+0x15/0x40 mm/page_alloc.c:5716
__folio_alloc_node include/linux/gfp.h:245 [inline]
folio_alloc include/linux/gfp.h:274 [inline]
filemap_alloc_folio include/linux/pagemap.h:474 [inline]
__filemap_get_folio+0x827/0xae0 mm/filemap.c:1983
pagecache_get_page+0x2f/0x110 mm/folio-compat.c:110
find_or_create_page include/linux/pagemap.h:615 [inline]
grow_dev_page fs/buffer.c:989 [inline]
grow_buffers fs/buffer.c:1054 [inline]
__getblk_slow fs/buffer.c:1081 [inline]
__getblk_gfp+0x205/0x7d0 fs/buffer.c:1376
sb_getblk_gfp include/linux/buffer_head.h:363 [inline]
__ext4_sb_bread_gfp+0x74/0x220 fs/ext4/super.c:230
ext4_sb_bread+0x2a/0x40 fs/ext4/super.c:247
ext4_xattr_block_get fs/ext4/xattr.c:541 [inline]
ext4_xattr_get+0x24a/0x700 fs/ext4/xattr.c:664
ext4_xattr_security_get+0x32/0x40 fs/ext4/xattr_security.c:20
__vfs_getxattr+0x3c3/0x3f0 fs/xattr.c:407
inode_doinit_use_xattr+0xa8/0x3d0 security/selinux/hooks.c:1321
inode_doinit_with_dentry+0x883/0x1070 security/selinux/hooks.c:1443
selinux_d_instantiate+0x27/0x40 security/selinux/hooks.c:6356
page last free stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
free_pages_prepare mm/page_alloc.c:1474 [inline]
free_pcp_prepare mm/page_alloc.c:1548 [inline]
free_unref_page_prepare+0x83d/0x850 mm/page_alloc.c:3470
free_unref_page_list+0xf1/0x7b0 mm/page_alloc.c:3618
release_pages+0xf7f/0xfe0 mm/swap.c:1063
__pagevec_release+0x84/0x100 mm/swap.c:1083
pagevec_release include/linux/pagevec.h:71 [inline]
folio_batch_release include/linux/pagevec.h:135 [inline]
invalidate_mapping_pagevec+0x44a/0x520 mm/truncate.c:552
invalidate_mapping_pages+0x27/0x30 mm/truncate.c:576
invalidate_bdev+0xa6/0x140 block/bdev.c:88
ext4_put_super+0x737/0xd60 fs/ext4/super.c:1282
generic_shutdown_super+0x14f/0x370 fs/super.c:503
kill_block_super+0x7e/0xe0 fs/super.c:1461
deactivate_locked_super+0xad/0x110 fs/super.c:334
deactivate_super+0xbe/0xf0 fs/super.c:365
cleanup_mnt+0x485/0x510 fs/namespace.c:1186
__cleanup_mnt+0x19/0x20 fs/namespace.c:1193
task_work_run+0x24d/0x2e0 kernel/task_work.c:179
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0x94/0xa0 kernel/entry/common.c:171
Memory state around the buggy address:
ffff8881269f5380: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff8881269f5400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8881269f5480: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff8881269f5500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff8881269f5580: 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:2423!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 8 Comm: kworker/u4:0 Tainted: G B 6.1.57-syzkaller-1150540-g401a2769d990 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
Workqueue: writeback wb_workfn (flush-7:0)
RIP: 0010:mpage_map_one_extent fs/ext4/inode.c:2423 [inline]
RIP: 0010:mpage_map_and_submit_extent fs/ext4/inode.c:2464 [inline]
RIP: 0010:ext4_writepages+0x3d6f/0x3fd0 fs/ext4/inode.c:2832
Code: e8 26 a6 81 ff be 00 10 00 00 48 c7 c7 10 05 8c 86 4c 89 f2 e8 f2 91 ab 00 e9 0f fb ff ff e8 08 a6 81 ff 0f 0b e8 01 a6 81 ff <0f> 0b e8 1a 6a 03 03 65 8b 05 33 88 0e 7e 41 89 c7 4c 89 f8 48 c1
RSP: 0018:ffffc90000087000 EFLAGS: 00010293
RAX: ffffffff81f3891f RBX: dffffc0000000000 RCX: ffff888100386540
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90000087410 R08: ffffffff81f3662f R09: ffffed102178ab96
R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000
R13: 0000000000000000 R14: ffff88810bc55ce8 R15: ffffc900000872e0
FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020042000 CR3: 0000000124762000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
do_writepages+0x385/0x620 mm/page-writeback.c:2472
__writeback_single_inode+0xdc/0xb80 fs/fs-writeback.c:1590
writeback_sb_inodes+0xb33/0x18f0 fs/fs-writeback.c:1881
wb_writeback+0x3b9/0x9f0 fs/fs-writeback.c:2055
wb_do_writeback fs/fs-writeback.c:2198 [inline]
wb_workfn+0x399/0x1030 fs/fs-writeback.c:2238
process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299
worker_thread+0xa60/0x1260 kernel/workqueue.c:2446
kthread+0x26d/0x300 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:mpage_map_one_extent fs/ext4/inode.c:2423 [inline]
RIP: 0010:mpage_map_and_submit_extent fs/ext4/inode.c:2464 [inline]
RIP: 0010:ext4_writepages+0x3d6f/0x3fd0 fs/ext4/inode.c:2832
Code: e8 26 a6 81 ff be 00 10 00 00 48 c7 c7 10 05 8c 86 4c 89 f2 e8 f2 91 ab 00 e9 0f fb ff ff e8 08 a6 81 ff 0f 0b e8 01 a6 81 ff <0f> 0b e8 1a 6a 03 03 65 8b 05 33 88 0e 7e 41 89 c7 4c 89 f8 48 c1
RSP: 0018:ffffc90000087000 EFLAGS: 00010293
RAX: ffffffff81f3891f RBX: dffffc0000000000 RCX: ffff888100386540
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90000087410 R08: ffffffff81f3662f R09: ffffed102178ab96
R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000
R13: 0000000000000000 R14: ffff88810bc55ce8 R15: ffffc900000872e0
FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020042000 CR3: 0000000124762000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400