[v6.6] KASAN: use-after-free Read in ext4_find_extent

0 views
Skip to first unread message

syzbot

unread,
2:30 PM (7 hours ago) 2:30 PM
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 5fa4793a2d2d Linux 6.6.119
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=145db09a580000
kernel config: https://syzkaller.appspot.com/x/.config?x=691a6769a86ac817
dashboard link: https://syzkaller.appspot.com/bug?extid=754d2fe5fcb2b2f41715
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/63699875f1dd/disk-5fa4793a.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/8506652fcb6f/vmlinux-5fa4793a.xz
kernel image: https://storage.googleapis.com/syzbot-assets/1b30ceed1710/bzImage-5fa4793a.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+754d2f...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:837 [inline]
BUG: KASAN: use-after-free in ext4_find_extent+0xbd0/0xe00 fs/ext4/extents.c:953
Read of size 4 at addr ffff888074e7a018 by task syz.3.150/6691

CPU: 1 PID: 6691 Comm: syz.3.150 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
Call Trace:
<TASK>
dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:364 [inline]
print_report+0xac/0x220 mm/kasan/report.c:468
kasan_report+0x117/0x150 mm/kasan/report.c:581
ext4_ext_binsearch fs/ext4/extents.c:837 [inline]
ext4_find_extent+0xbd0/0xe00 fs/ext4/extents.c:953
ext4_ext_map_blocks+0x260/0x6450 fs/ext4/extents.c:4163
ext4_map_blocks+0x9d5/0x1b70 fs/ext4/inode.c:652
ext4_iomap_alloc fs/ext4/inode.c:3360 [inline]
ext4_iomap_begin+0x7be/0xad0 fs/ext4/inode.c:3410
iomap_iter+0x6b1/0xec0 fs/iomap/iter.c:91
__iomap_dio_rw+0xb9c/0x1c40 fs/iomap/direct-io.c:658
iomap_dio_rw+0x45/0xa0 fs/iomap/direct-io.c:748
ext4_dio_write_iter fs/ext4/file.c:577 [inline]
ext4_file_write_iter+0x13ff/0x1870 fs/ext4/file.c:696
do_iter_readv_writev fs/read_write.c:-1 [inline]
do_iter_write+0x79a/0xc70 fs/read_write.c:860
iter_file_splice_write+0x66f/0xc50 fs/splice.c:736
do_splice_from fs/splice.c:933 [inline]
direct_splice_actor+0xe8/0x130 fs/splice.c:1142
splice_direct_to_actor+0x2f0/0x870 fs/splice.c:1088
do_splice_direct+0x1b7/0x2c0 fs/splice.c:1194
do_sendfile+0x5dc/0xf70 fs/read_write.c:1254
__do_sys_sendfile64 fs/read_write.c:1322 [inline]
__se_sys_sendfile64+0x13f/0x190 fs/read_write.c:1308
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f48e658f749
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f48e47f6038 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00007f48e67e5fa0 RCX: 00007f48e658f749
RDX: 0000000000000000 RSI: 0000000000000007 RDI: 0000000000000006
RBP: 00007f48e6613f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000020fffe82 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f48e67e6038 R14: 00007f48e67e5fa0 R15: 00007ffe86e57dd8
</TASK>

The buggy address belongs to the physical page:
page:ffffea0001d39e80 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x74e7a
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000000 dead000000000100 dead000000000122 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 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 6680, tgid 6680 (syz.1.145), ts 152814564203, free_ts 155549099203
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x1cd/0x210 mm/page_alloc.c:1554
prep_new_page mm/page_alloc.c:1561 [inline]
get_page_from_freelist+0x195c/0x19f0 mm/page_alloc.c:3191
__alloc_pages+0x1e3/0x460 mm/page_alloc.c:4457
__folio_alloc+0x10/0x20 mm/page_alloc.c:4489
vma_alloc_folio+0x47a/0x8f0 mm/mempolicy.c:2242
shmem_alloc_folio+0x179/0x230 mm/shmem.c:1679
shmem_alloc_and_acct_folio+0x189/0x630 mm/shmem.c:1704
shmem_get_folio_gfp+0xcde/0x2ac0 mm/shmem.c:2041
shmem_get_folio mm/shmem.c:2164 [inline]
shmem_write_begin+0xf2/0x420 mm/shmem.c:2706
generic_perform_write+0x2fb/0x5b0 mm/filemap.c:4031
shmem_file_write_iter+0xfb/0x120 mm/shmem.c:2883
__kernel_write_iter+0x274/0x670 fs/read_write.c:517
dump_emit_page fs/coredump.c:957 [inline]
dump_user_range+0x3f6/0x800 fs/coredump.c:984
elf_core_dump+0x3114/0x36e0 fs/binfmt_elf.c:2184
do_coredump+0x1755/0x2480 fs/coredump.c:833
get_signal+0x1133/0x1400 kernel/signal.c:2888
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1154 [inline]
free_unref_page_prepare+0x7ce/0x8e0 mm/page_alloc.c:2336
free_unref_page_list+0xbe/0x860 mm/page_alloc.c:2475
release_pages+0x1fa0/0x2220 mm/swap.c:1022
__folio_batch_release+0x71/0xe0 mm/swap.c:1042
folio_batch_release include/linux/pagevec.h:83 [inline]
shmem_undo_range+0x5d0/0x1a40 mm/shmem.c:1026
shmem_truncate_range mm/shmem.c:1135 [inline]
shmem_evict_inode+0x273/0xa70 mm/shmem.c:1264
evict+0x486/0x870 fs/inode.c:705
do_unlinkat+0x37b/0x570 fs/namei.c:4406
__do_sys_unlink fs/namei.c:4447 [inline]
__se_sys_unlink fs/namei.c:4445 [inline]
__x64_sys_unlink+0x49/0x50 fs/namei.c:4445
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
ffff888074e79f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888074e79f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888074e7a000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff888074e7a080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888074e7a100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
5:16 PM (4 hours ago) 5:16 PM
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 5fa4793a2d2d Linux 6.6.119
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=178bab92580000
kernel config: https://syzkaller.appspot.com/x/.config?x=691a6769a86ac817
dashboard link: https://syzkaller.appspot.com/bug?extid=754d2fe5fcb2b2f41715
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=10ffabb4580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=104bab92580000
mounted in repro: https://storage.googleapis.com/syzbot-assets/cefcacf8afbe/mount_0.gz
fsck result: failed (log: https://syzkaller.appspot.com/x/fsck.log?x=14bfb09a580000)

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+754d2f...@syzkaller.appspotmail.com

EXT4-fs (loop1): mounted filesystem 00000000-0000-0000-0000-000000000000 r/w without journal. Quota mode: writeback.
==================================================================
BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:837 [inline]
BUG: KASAN: use-after-free in ext4_find_extent+0xbd0/0xe00 fs/ext4/extents.c:953
Read of size 4 at addr ffff88805aa0e018 by task syz.1.18/6001

CPU: 1 PID: 6001 Comm: syz.1.18 Not tainted syzkaller #0
RIP: 0033:0x7f778cf8f749
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f778dee3038 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00007f778d1e5fa0 RCX: 00007f778cf8f749
RDX: 0000000000000000 RSI: 0000000000000005 RDI: 0000000000000004
RBP: 00007f778d013f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000020fffe82 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f778d1e6038 R14: 00007f778d1e5fa0 R15: 00007ffc986cff88
</TASK>

The buggy address belongs to the physical page:
page:ffffea00016a8380 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x5aa0e
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000000 dead000000000100 dead000000000122 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 0x8(__GFP_MOVABLE), pid 1, tgid 1 (swapper/0), ts 18095856677, free_ts 18994305662
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x1cd/0x210 mm/page_alloc.c:1554
split_map_pages+0x27b/0x4d0 mm/compaction.c:97
isolate_freepages_range+0x3e0/0x430 mm/compaction.c:775
alloc_contig_range+0x5b2/0x860 mm/page_alloc.c:6244
__alloc_contig_pages mm/page_alloc.c:6267 [inline]
alloc_contig_pages+0x47c/0x580 mm/page_alloc.c:6347
debug_vm_pgtable_alloc_huge_page+0xbf/0x110 mm/debug_vm_pgtable.c:1087
init_args+0x724/0x9b0 mm/debug_vm_pgtable.c:1269
debug_vm_pgtable+0xc1/0x410 mm/debug_vm_pgtable.c:1307
do_one_initcall+0x1fd/0x750 init/main.c:1250
do_initcall_level+0x137/0x1f0 init/main.c:1312
do_initcalls+0x69/0xd0 init/main.c:1328
kernel_init_freeable+0x3d2/0x570 init/main.c:1565
kernel_init+0x1d/0x1c0 init/main.c:1455
ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:152
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:293
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1154 [inline]
free_unref_page_prepare+0x7ce/0x8e0 mm/page_alloc.c:2336
free_unref_page+0x32/0x2e0 mm/page_alloc.c:2429
free_contig_range+0xa1/0x160 mm/page_alloc.c:6369
destroy_args+0x80/0x850 mm/debug_vm_pgtable.c:1015
debug_vm_pgtable+0x3cc/0x410 mm/debug_vm_pgtable.c:1400
do_one_initcall+0x1fd/0x750 init/main.c:1250
do_initcall_level+0x137/0x1f0 init/main.c:1312
do_initcalls+0x69/0xd0 init/main.c:1328
kernel_init_freeable+0x3d2/0x570 init/main.c:1565
kernel_init+0x1d/0x1c0 init/main.c:1455
ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:152
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:293

Memory state around the buggy address:
ffff88805aa0df00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88805aa0df80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88805aa0e000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff88805aa0e080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88805aa0e100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
Reply all
Reply to author
Forward
0 new messages