syzbot


KASAN: out-of-bounds Read in ext4_ext_remove_space

Status: upstream: reported C repro on 2023/09/02 13:17
Reported-by: syzbot+346920c4ba6752340f29@syzkaller.appspotmail.com
First crash: 294d, last: 2h51m
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 KASAN: out-of-bounds Read in ext4_ext_remove_space origin:upstream missing-backport C error error 5 4d15h 323d 0/2 upstream: reported C repro on 2023/08/04 22:38
upstream KASAN: out-of-bounds Read in ext4_ext_remove_space ext4 C error done 8 170d 345d 26/27 fixed on 2024/02/16 19:40
android-6-1 KASAN: out-of-bounds Read in ext4_ext_remove_space origin:upstream missing-backport C error error 4 56d 313d 0/2 upstream: reported C repro on 2023/08/14 17:29
linux-5.15 KASAN: out-of-bounds Read in ext4_ext_remove_space origin:upstream missing-backport C error 3 27d 153d 0/3 upstream: reported C repro on 2024/01/21 16:07
linux-6.1 KASAN: out-of-bounds Read in ext4_ext_remove_space origin:upstream missing-backport C 2 17d 171d 0/3 upstream: reported C repro on 2024/01/03 15:27
Last patch testing requests (2)
Created Duration User Patch Repo Result
2024/06/23 08:48 14m retest repro android13-5.10-lts report log
2023/09/16 13:27 15m retest repro android13-5.10-lts report log
Fix bisection attempts (8)
Created Duration User Patch Repo Result
2024/05/29 16:16 37m bisect fix android13-5.10-lts job log (0) log
2024/04/24 01:12 1h43m bisect fix android13-5.10-lts job log (0) log
2024/03/24 10:22 36m bisect fix android13-5.10-lts job log (0) log
2024/02/23 07:48 1h47m bisect fix android13-5.10-lts job log (0) log
2024/01/20 07:40 40m bisect fix android13-5.10-lts job log (0) log
2023/12/19 08:27 45m bisect fix android13-5.10-lts job log (0) log
2023/11/19 03:02 39m bisect fix android13-5.10-lts job log (0) log
2023/10/18 11:52 35m bisect fix android13-5.10-lts job log (0) log

Sample crash report:
EXT4-fs (loop0): Remounting filesystem read-only
EXT4-fs error (device loop0) in ext4_mb_clear_bb:5614: Corrupt filesystem
==================================================================
BUG: KASAN: out-of-bounds in ext4_ext_rm_leaf fs/ext4/extents.c:2730 [inline]
BUG: KASAN: out-of-bounds in ext4_ext_remove_space+0x1fbc/0x4e10 fs/ext4/extents.c:2952
Read of size 18446744073709551544 at addr ffff88811baa3054 by task syz-executor226/292

CPU: 1 PID: 292 Comm: syz-executor226 Not tainted 5.10.192-syzkaller-00409-gc8ca447a86a2 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x81/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:452
 kasan_check_range+0x293/0x2a0 mm/kasan/generic.c:189
 memmove+0x2d/0x70 mm/kasan/shadow.c:54
 ext4_ext_rm_leaf fs/ext4/extents.c:2730 [inline]
 ext4_ext_remove_space+0x1fbc/0x4e10 fs/ext4/extents.c:2952
 ext4_punch_hole+0x720/0xb10 fs/ext4/inode.c:4205
 ext4_fallocate+0x2e8/0x1ca0 fs/ext4/extents.c:4704
 vfs_fallocate+0x492/0x570 fs/open.c:310
 do_vfs_ioctl+0x1686/0x1a30 fs/ioctl.c:732
 __do_sys_ioctl fs/ioctl.c:751 [inline]
 __se_sys_ioctl+0x99/0x190 fs/ioctl.c:739
 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:739
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xc6
RIP: 0033:0x7fbe6877e729
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 18 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fbe6035a218 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fbe688066d8 RCX: 00007fbe6877e729
RDX: 0000000020000080 RSI: 000000004030582b RDI: 0000000000000004
RBP: 00007fbe688066d0 R08: 00007fffa8dac757 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fbe687d3678
R13: 0000000000000002 R14: 00007fffa8dac670 R15: 6f6f6c2f7665642f

The buggy address belongs to the page:
page:ffffea00046ea8c0 refcount:2 mapcount:0 mapping:ffff888109191c10 index:0x3a pfn:0x11baa3
aops:def_blk_aops ino:0
flags: 0x4000000000002036(referenced|uptodate|lru|active|private)
raw: 4000000000002036 ffffea0004440248 ffffea0004707c88 ffff888109191c10
raw: 000000000000003a ffff88811c496930 00000002ffffffff ffff888100142000
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff888100142000
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Movable, gfp_mask 0x108c48(GFP_NOFS|__GFP_NOFAIL|__GFP_HARDWALL|__GFP_MOVABLE), pid 287, ts 19953384406, free_ts 19753654753
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2456 [inline]
 prep_new_page+0x166/0x180 mm/page_alloc.c:2462
 get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254
 __alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5346
 __alloc_pages include/linux/gfp.h:544 [inline]
 __alloc_pages_node include/linux/gfp.h:557 [inline]
 alloc_pages_node include/linux/gfp.h:571 [inline]
 alloc_pages include/linux/gfp.h:590 [inline]
 __page_cache_alloc include/linux/pagemap.h:290 [inline]
 pagecache_get_page+0x669/0x950 mm/filemap.c:1848
 find_or_create_page include/linux/pagemap.h:402 [inline]
 grow_dev_page fs/buffer.c:976 [inline]
 grow_buffers fs/buffer.c:1045 [inline]
 __getblk_slow fs/buffer.c:1072 [inline]
 __getblk_gfp+0x221/0x7e0 fs/buffer.c:1370
 sb_getblk_gfp include/linux/buffer_head.h:368 [inline]
 ext4_ext_grow_indepth fs/ext4/extents.c:1325 [inline]
 ext4_ext_create_new_leaf fs/ext4/extents.c:1424 [inline]
 ext4_ext_insert_extent+0xf88/0x4d20 fs/ext4/extents.c:2094
 ext4_ext_map_blocks+0x1b4c/0x6be0 fs/ext4/extents.c:4302
 ext4_map_blocks+0xaa7/0x1ec0 fs/ext4/inode.c:646
 _ext4_get_block+0x21b/0x610 fs/ext4/inode.c:793
 ext4_get_block+0x39/0x50 fs/ext4/inode.c:810
 ext4_block_write_begin+0x61e/0x13b0 fs/ext4/inode.c:1077
 ext4_write_begin+0x6fa/0x1730
 ext4_da_write_begin+0x49d/0xf60 fs/ext4/inode.c:3021
 generic_perform_write+0x2cd/0x570 mm/filemap.c:3506
 ext4_buffered_write_iter+0x482/0x610 fs/ext4/file.c:271
 ext4_file_write_iter+0x193/0x1c80 fs/ext4/file.c:685
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:28 [inline]
 free_pages_prepare mm/page_alloc.c:1349 [inline]
 free_pcp_prepare mm/page_alloc.c:1421 [inline]
 free_unref_page_prepare+0x2ae/0x2d0 mm/page_alloc.c:3336
 free_unref_page_list+0x122/0xb20 mm/page_alloc.c:3443
 release_pages+0xea0/0xef0 mm/swap.c:1103
 free_pages_and_swap_cache+0x8a/0xa0 mm/swap_state.c:356
 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:240 [inline]
 tlb_flush_mmu mm/mmu_gather.c:247 [inline]
 tlb_finish_mmu+0x177/0x320 mm/mmu_gather.c:326
 unmap_region+0x31c/0x370 mm/mmap.c:2807
 __do_munmap+0x699/0x8c0 mm/mmap.c:3036
 __vm_munmap mm/mmap.c:3059 [inline]
 __do_sys_munmap mm/mmap.c:3085 [inline]
 __se_sys_munmap+0x120/0x1a0 mm/mmap.c:3081
 __x64_sys_munmap+0x5b/0x70 mm/mmap.c:3081
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xc6

Memory state around the buggy address:
 ffff88811baa2f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88811baa2f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88811baa3000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                                 ^
 ffff88811baa3080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88811baa3100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
EXT4-fs error (device loop0): __ext4_get_inode_loc:4426: comm syz-executor226: Invalid inode table block 0 in block_group 0
EXT4-fs error (device loop0) in ext4_reserve_inode_write:5886: Corrupt filesystem
EXT4-fs error (device loop0): ext4_punch_hole:4218: inode #16: comm syz-executor226: mark_inode_dirty error

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/09/02 13:14 android13-5.10-lts c8ca447a86a2 696ea0d2 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-10 KASAN: out-of-bounds Read in ext4_ext_remove_space
2024/06/08 18:04 android13-5.10-lts d3c4d815bf09 82c05ab8 .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-10 KASAN: out-of-bounds Read in ext4_ext_remove_space
* Struck through repros no longer work on HEAD.