syzbot


KASAN: use-after-free Read in do_split

Status: upstream: reported on 2024/11/07 19:28
Reported-by: syzbot+232819123659561f765c@syzkaller.appspotmail.com
First crash: 14d, last: 14d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 BUG: unable to handle kernel paging request in do_split C error 8 1d05h 104d 0/2 upstream: reported C repro on 2024/08/09 00:52
upstream BUG: unable to handle kernel paging request in do_split ext4 C inconclusive 17 132d 145d 27/28 fixed on 2024/08/14 03:44

Sample crash report:
EXT4-fs error (device loop2): ext4_xattr_ibody_find:2186: inode #15: comm syz.2.69: corrupted in-inode xattr
EXT4-fs error (device loop2): ext4_orphan_get:1405: comm syz.2.69: couldn't read orphan inode 15 (err -117)
EXT4-fs (loop2): mounted filesystem without journal. Quota mode: writeback.
==================================================================
BUG: KASAN: use-after-free in dx_insert_block fs/ext4/namei.c:1387 [inline]
BUG: KASAN: use-after-free in do_split+0x1f3d/0x24f0 fs/ext4/namei.c:2080
Read of size 106000 at addr ffff888075192428 by task syz.2.69/4649

CPU: 0 PID: 4649 Comm: syz.2.69 Not tainted 6.1.115-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:395
 kasan_report+0x136/0x160 mm/kasan/report.c:495
 kasan_check_range+0x27f/0x290 mm/kasan/generic.c:189
 memmove+0x25/0x60 mm/kasan/shadow.c:54
 dx_insert_block fs/ext4/namei.c:1387 [inline]
 do_split+0x1f3d/0x24f0 fs/ext4/namei.c:2080
 make_indexed_dir+0xeaf/0x1590 fs/ext4/namei.c:2392
 ext4_add_entry+0xd5d/0x1010 fs/ext4/namei.c:2504
 ext4_rename fs/ext4/namei.c:3976 [inline]
 ext4_rename2+0x26bc/0x4420 fs/ext4/namei.c:4258
 vfs_rename+0xd32/0x10f0 fs/namei.c:4874
 do_renameat2+0xde0/0x1440 fs/namei.c:5027
 __do_sys_rename fs/namei.c:5073 [inline]
 __se_sys_rename fs/namei.c:5071 [inline]
 __x64_sys_rename+0x82/0x90 fs/namei.c:5071
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f710897e719
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:00007f71097e3038 EFLAGS: 00000246 ORIG_RAX: 0000000000000052
RAX: ffffffffffffffda RBX: 00007f7108b35f80 RCX: 00007f710897e719
RDX: 0000000000000000 RSI: 0000000020001c40 RDI: 0000000020000f40
RBP: 00007f71089f139e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f7108b35f80 R15: 00007ffda7991378
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0001d46480 refcount:3 mapcount:1 mapping:ffff8880180828f8 index:0x3 pfn:0x75192
memcg:ffff888029424000
aops:def_blk_aops ino:700002
flags: 0xfff5800002205e(referenced|uptodate|dirty|lru|workingset|private|mappedtodisk|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff5800002205e ffffea000173a348 ffffea0001fe0b48 ffff8880180828f8
raw: 0000000000000003 ffff888058dcdcb0 0000000300000000 ffff888029424000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x148c40(GFP_NOFS|__GFP_NOFAIL|__GFP_COMP|__GFP_HARDWALL), pid 4649, tgid 4647 (syz.2.69), ts 99882669151, free_ts 99570180601
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2517
 prep_new_page mm/page_alloc.c:2524 [inline]
 get_page_from_freelist+0x322e/0x33b0 mm/page_alloc.c:4290
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5558
 folio_alloc+0x1a/0x50 mm/mempolicy.c:2292
 filemap_alloc_folio+0xda/0x4f0 mm/filemap.c:999
 __filemap_get_folio+0x749/0xe80 mm/filemap.c:1993
 pagecache_get_page+0x28/0x250 mm/folio-compat.c:110
 find_or_create_page include/linux/pagemap.h:646 [inline]
 grow_dev_page fs/buffer.c:946 [inline]
 grow_buffers fs/buffer.c:1011 [inline]
 __getblk_slow fs/buffer.c:1038 [inline]
 __getblk_gfp+0x211/0xa20 fs/buffer.c:1333
 sb_getblk_gfp include/linux/buffer_head.h:363 [inline]
 ext4_sb_breadahead_unmovable+0x63/0xe0 fs/ext4/super.c:257
 __ext4_get_inode_loc+0xbbb/0xe40 fs/ext4/inode.c:4594
 __ext4_get_inode_loc_noinmem fs/ext4/inode.c:4624 [inline]
 __ext4_iget+0x4ff/0x3ee0 fs/ext4/inode.c:4846
 __ext4_fill_super fs/ext4/super.c:5400 [inline]
 ext4_fill_super+0x6cb9/0x8b50 fs/ext4/super.c:5665
 get_tree_bdev+0x3fe/0x620 fs/super.c:1366
 vfs_get_tree+0x88/0x270 fs/super.c:1573
 do_new_mount+0x2ba/0xb40 fs/namespace.c:3056
 do_mount fs/namespace.c:3399 [inline]
 __do_sys_mount fs/namespace.c:3607 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3584
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1444 [inline]
 free_pcp_prepare mm/page_alloc.c:1494 [inline]
 free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3369
 free_unref_page+0x33/0x3e0 mm/page_alloc.c:3464
 __vunmap+0x834/0x9a0 mm/vmalloc.c:2717
 free_work+0x57/0x80 mm/vmalloc.c:97
 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
 kthread+0x28d/0x320 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Memory state around the buggy address:
 ffff888075192f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888075192f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888075193000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff888075193080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc
 ffff888075193100: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/07 19:28 linux-6.1.y 7c15117f9468 867e44df .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in do_split
* Struck through repros no longer work on HEAD.