syzbot


KASAN: use-after-free Read in ext4_inode_block_valid (3)

Status: auto-obsoleted due to no activity on 2023/03/12 01:03
Reported-by: syzbot+22807e38ecf2233aa7f5@syzkaller.appspotmail.com
First crash: 566d, last: 558d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in ext4_inode_block_valid 3 1103d 1142d 0/1 auto-closed as invalid on 2021/09/13 02:10
linux-4.14 KASAN: use-after-free Read in ext4_inode_block_valid (2) 1 801d 801d 0/1 auto-closed as invalid on 2022/07/12 03:24

Sample crash report:
BTRFS error (device loop3): open_ctree failed
BTRFS error (device loop3): unsupported checksum algorithm 1
BTRFS error (device loop3): superblock checksum mismatch
BTRFS error (device loop3): open_ctree failed
==================================================================
BUG: KASAN: use-after-free in ext4_inode_block_valid+0x33b/0x3b0 fs/ext4/block_validity.c:255
Read of size 8 at addr ffff8880a423f248 by task syz-executor.4/10203

CPU: 1 PID: 10203 Comm: syz-executor.4 Not tainted 4.14.299-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
F2FS-fs (loop1): Invalid blocksize (65536), supports only 4KB

Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
 kasan_report mm/kasan/report.c:409 [inline]
 __asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430
F2FS-fs (loop1): Can't find valid F2FS filesystem in 1th superblock
 ext4_inode_block_valid+0x33b/0x3b0 fs/ext4/block_validity.c:255
 __check_block_validity.constprop.0+0x17a/0x2c0 fs/ext4/inode.c:423
 ext4_map_blocks+0xc40/0x1730 fs/ext4/inode.c:612
F2FS-fs (loop1): invalid crc value
 _ext4_get_block+0x187/0x480 fs/ext4/inode.c:809
F2FS-fs (loop1): Failed to initialize F2FS segment manager
 ext4_dio_get_block+0x93/0xb0 fs/ext4/inode.c:886
 get_more_blocks fs/direct-io.c:718 [inline]
 do_direct_IO fs/direct-io.c:1004 [inline]
 do_blockdev_direct_IO fs/direct-io.c:1337 [inline]
 __blockdev_direct_IO+0x3f74/0xdcb0 fs/direct-io.c:1423
 ext4_direct_IO_read fs/ext4/inode.c:3866 [inline]
 ext4_direct_IO+0x549/0x1b80 fs/ext4/inode.c:3902
 generic_file_read_iter+0x234/0x21c0 mm/filemap.c:2252
 ext4_file_read_iter+0x14b/0x330 fs/ext4/file.c:76
 call_read_iter include/linux/fs.h:1774 [inline]
 generic_file_splice_read+0x3a7/0x5c0 fs/splice.c:307
 do_splice_to+0xfb/0x140 fs/splice.c:880
 splice_direct_to_actor+0x207/0x730 fs/splice.c:952
 do_splice_direct+0x164/0x210 fs/splice.c:1061
 do_sendfile+0x47f/0xb30 fs/read_write.c:1441
 SYSC_sendfile64 fs/read_write.c:1502 [inline]
 SyS_sendfile64+0xff/0x110 fs/read_write.c:1488
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x5e/0xd3

Allocated by task 1:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
 kmem_cache_alloc+0x124/0x3c0 mm/slab.c:3552
 add_system_zone+0x108/0x650 fs/ext4/block_validity.c:78
 ext4_setup_system_zone+0x325/0x8c0 fs/ext4/block_validity.c:197
 ext4_fill_super+0x63a9/0xb3c0 fs/ext4/super.c:4407
 mount_bdev+0x2b3/0x360 fs/super.c:1134
 mount_fs+0x92/0x2a0 fs/super.c:1237
 vfs_kern_mount.part.0+0x5b/0x470 fs/namespace.c:1046
 vfs_kern_mount fs/namespace.c:1036 [inline]
 do_new_mount fs/namespace.c:2572 [inline]
 do_mount+0xe65/0x2a30 fs/namespace.c:2905
 SYSC_mount fs/namespace.c:3121 [inline]
 SyS_mount+0xa8/0x120 fs/namespace.c:3098
 do_mount_root+0x30/0x1b0 init/do_mounts.c:366
 mount_block_root+0x2bc/0x5a3 init/do_mounts.c:395
 mount_root+0x1c4/0x1f3 init/do_mounts.c:540
 prepare_namespace+0x1d6/0x212 init/do_mounts.c:599
 kernel_init_freeable+0x609/0x626 init/main.c:1099
 kernel_init+0xd/0x164 init/main.c:1006
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:406

Freed by task 10207:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kmem_cache_free+0x7c/0x2b0 mm/slab.c:3758
 ext4_release_system_zone+0x79/0x110 fs/ext4/block_validity.c:230
 ext4_setup_system_zone+0x3a9/0x8c0 fs/ext4/block_validity.c:188
 ext4_remount+0xfa2/0x1df0 fs/ext4/super.c:5387
 do_remount_sb+0x150/0x530 fs/super.c:868
 do_remount fs/namespace.c:2393 [inline]
 do_mount+0x15f3/0x2a30 fs/namespace.c:2896
 SYSC_mount fs/namespace.c:3121 [inline]
 SyS_mount+0xa8/0x120 fs/namespace.c:3098
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x5e/0xd3

The buggy address belongs to the object at ffff8880a423f230
 which belongs to the cache ext4_system_zone of size 40
The buggy address is located 24 bytes inside of
 40-byte region [ffff8880a423f230, ffff8880a423f258)
The buggy address belongs to the page:
page:ffffea0002908fc0 count:1 mapcount:0 mapping:ffff8880a423f000 index:0xffff8880a423ffb9
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880a423f000 ffff8880a423ffb9 0000000100000003
raw: ffff8880b11caa38 ffff8880b11caa38 ffff88823933be00 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a423f100: fb fc fc fb fb fb fb fb fc fc fb fb fb fb fb fc
 ffff8880a423f180: fc fb fb fb fb fb fc fc fb fb fb fb fb fc fc fb
>ffff8880a423f200: fb fb fb fb fc fc fb fb fb fb fb fc fc fb fb fb
                                              ^
 ffff8880a423f280: fb fb fc fc fb fb fb fb fb fc fc fb fb fb fb fb
 ffff8880a423f300: fc fc fb fb fb fb fb fc fc fb fb fb fb fb fc fc
==================================================================
EXT4-fs (sda1): re-mounted. Opts: noinit_itable,bsdgroups,noblock_validity,sysvgroups,,errors=continue

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/11/12 01:03 linux-4.14.y e911713e40ca f42ee5d8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 KASAN: use-after-free Read in ext4_inode_block_valid
2022/11/03 06:15 linux-4.14.y a85772d7ba90 7a2ebf95 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 KASAN: use-after-free Read in ext4_inode_block_valid
* Struck through repros no longer work on HEAD.