syzbot


KASAN: use-after-free Read in ext4_ext_insert_extent

Status: auto-obsoleted due to no activity on 2024/08/13 04:16
Reported-by: syzbot+95b762fccf1ba1748155@syzkaller.appspotmail.com
First crash: 200d, last: 200d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Read in ext4_ext_insert_extent ext4 1 376d 372d 0/28 auto-obsoleted due to no activity on 2024/02/09 07:34

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ext4_ext_insert_extent+0x2b8b/0x4e60 fs/ext4/extents.c:2153
Read of size 40104 at addr ffff88804fd18008 by task kworker/u4:4/681

CPU: 0 PID: 681 Comm: kworker/u4:4 Not tainted 5.15.158-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Workqueue: writeback wb_workfn (flush-7:4)
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 kasan_check_range+0x27e/0x290 mm/kasan/generic.c:189
 memmove+0x25/0x60 mm/kasan/shadow.c:54
 ext4_ext_insert_extent+0x2b8b/0x4e60 fs/ext4/extents.c:2153
 ext4_split_extent_at+0x80e/0x10f0 fs/ext4/extents.c:3229
 ext4_split_extent+0x1c0/0x4e0 fs/ext4/extents.c:3330
 ext4_split_convert_extents fs/ext4/extents.c:3690 [inline]
 ext4_ext_handle_unwritten_extents fs/ext4/extents.c:3852 [inline]
 ext4_ext_map_blocks+0x2477/0x7690 fs/ext4/extents.c:4207
 ext4_map_blocks+0xaad/0x1e00 fs/ext4/inode.c:645
 mpage_map_one_extent fs/ext4/inode.c:2396 [inline]
 mpage_map_and_submit_extent fs/ext4/inode.c:2449 [inline]
 ext4_writepages+0x160e/0x3d10 fs/ext4/inode.c:2817
 do_writepages+0x481/0x730 mm/page-writeback.c:2364
 __writeback_single_inode+0x15b/0xe30 fs/fs-writeback.c:1647
 writeback_sb_inodes+0xbce/0x1a40 fs/fs-writeback.c:1930
 wb_writeback+0x451/0xc50 fs/fs-writeback.c:2104
 wb_do_writeback fs/fs-writeback.c:2247 [inline]
 wb_workfn+0x46c/0x1130 fs/fs-writeback.c:2288
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:300
 </TASK>

The buggy address belongs to the page:
page:ffffea00013f4600 refcount:2 mapcount:0 mapping:ffff88805e5b2ca8 index:0xb pfn:0x4fd18
memcg:ffff88805e9e0000
aops:ext4_da_aops ino:13
flags: 0xfff0000000201d(locked|uptodate|dirty|lru|private|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff0000000201d ffffea00013f45c8 ffffea00013f4648 ffff88805e5b2ca8
raw: 000000000000000b ffff88805ecab2b8 00000002ffffffff ffff88805e9e0000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Movable, gfp_mask 0x1101cca(GFP_HIGHUSER_MOVABLE|__GFP_WRITE), pid 6997, ts 227896070299, free_ts 227863749491
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5423
 __page_cache_alloc+0xd4/0x4a0 mm/filemap.c:1022
 pagecache_get_page+0xa91/0x1010 mm/filemap.c:1940
 grab_cache_page_write_begin+0x57/0x90 mm/filemap.c:3739
 ext4_write_begin+0x2e4/0x15f0 fs/ext4/inode.c:1173
 ext4_da_write_begin+0x342/0xb60 fs/ext4/inode.c:2963
 generic_perform_write+0x2bf/0x5b0 mm/filemap.c:3785
 ext4_buffered_write_iter+0x227/0x360 fs/ext4/file.c:268
 ext4_file_write_iter+0x87c/0x1990
 call_write_iter include/linux/fs.h:2172 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0xacf/0xe50 fs/read_write.c:594
 ksys_write+0x1a2/0x2c0 fs/read_write.c:647
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page_list+0x1f7/0x8e0 mm/page_alloc.c:3433
 release_pages+0x1bb9/0x1f40 mm/swap.c:963
 __pagevec_release+0x80/0xf0 mm/swap.c:983
 pagevec_release include/linux/pagevec.h:81 [inline]
 shmem_undo_range+0x67a/0x1b50 mm/shmem.c:964
 shmem_truncate_range mm/shmem.c:1063 [inline]
 shmem_evict_inode+0x21b/0xa00 mm/shmem.c:1145
 evict+0x2a4/0x620 fs/inode.c:587
 __dentry_kill+0x436/0x650 fs/dcache.c:582
 dentry_kill+0xbb/0x290
 dput+0xd8/0x1a0 fs/dcache.c:889
 __fput+0x5ec/0x890 fs/file_table.c:288
 task_work_run+0x129/0x1a0 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:181
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214
 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
 syscall_exit_to_user_mode+0x5d/0x240 kernel/entry/common.c:307
 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86

Memory state around the buggy address:
 ffff88804fd1ff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88804fd1ff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88804fd20000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff88804fd20080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88804fd20100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/05/05 04:15 linux-5.15.y 284087d4f7d5 610f2a54 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in ext4_ext_insert_extent
* Struck through repros no longer work on HEAD.