syzbot


KASAN: use-after-free Read in ext4_data_block_valid

Status: auto-closed as invalid on 2020/09/26 20:10
Reported-by: syzbot+8e2729dc9b40f5871aee@syzkaller.appspotmail.com
First crash: 1057d, last: 768d
similar bugs (6):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-414 KASAN: use-after-free Read in ext4_data_block_valid (2) 6 957d 1019d 0/1 auto-closed as invalid on 2020/03/21 21:05
upstream KASAN: use-after-free Read in ext4_data_block_valid 108 1079d 1526d 14/22 fixed on 2019/10/15 23:40
android-414 KASAN: use-after-free Read in ext4_data_block_valid 12 1210d 1181d 0/1 auto-closed as invalid on 2019/09/11 10:38
linux-4.19 KASAN: use-after-free Read in ext4_data_block_valid 2 1015d 1078d 0/1 auto-closed as invalid on 2020/01/24 00:27
android-49 KASAN: use-after-free Read in ext4_data_block_valid 21 1283d 1180d 0/3 auto-closed as invalid on 2019/06/29 18:27
android-49 KASAN: use-after-free Read in ext4_data_block_valid (2) 1 955d 955d 0/3 auto-closed as invalid on 2020/03/24 07:08

Sample crash report:
ptrace attach of "/root/syz-executor.3"[25712] was attempted by "/root/syz-executor.3"[25715]
==================================================================
BUG: KASAN: use-after-free in ext4_data_block_valid+0x279/0x2d0 fs/ext4/block_validity.c:261
ptrace attach of "/root/syz-executor.4"[25711] was attempted by "/root/syz-executor.4"[25716]
Read of size 8 at addr ffff888215f8f088 by task systemd/1

CPU: 0 PID: 1 Comm: systemd Not tainted 4.14.182-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x283 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1dc mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report mm/kasan/report.c:409 [inline]
 kasan_report.cold+0xa9/0x2b9 mm/kasan/report.c:393
 ext4_data_block_valid+0x279/0x2d0 fs/ext4/block_validity.c:261
 __check_block_validity.constprop.0+0x17a/0x2c0 fs/ext4/inode.c:414
 ext4_map_blocks+0xdba/0x1600 fs/ext4/inode.c:604
 ext4_getblk+0x314/0x3f0 fs/ext4/inode.c:984
 ext4_bread+0x6c/0x1a0 fs/ext4/inode.c:1034
 __ext4_read_dirblock+0x33/0x800 fs/ext4/namei.c:110
 dx_probe+0x4e/0x10a0 fs/ext4/namei.c:758
 ext4_dx_find_entry+0xae/0x380 fs/ext4/namei.c:1520
 ext4_find_entry+0x9a5/0xca0 fs/ext4/namei.c:1407
 ext4_lookup fs/ext4/namei.c:1584 [inline]
 ext4_lookup+0x10c/0x570 fs/ext4/namei.c:1560
 lookup_open+0x5aa/0x1700 fs/namei.c:3220
 do_last fs/namei.c:3334 [inline]
 path_openat+0x14ac/0x2aa0 fs/namei.c:3569
 do_filp_open+0x18e/0x250 fs/namei.c:3603
 do_sys_open+0x292/0x3e0 fs/open.c:1081
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x7f2be55f485d
RSP: 002b:00007fffd6257b60 EFLAGS: 00000293 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 00007fffd6257bf0 RCX: 00007f2be55f485d
RDX: 0000000000000001 RSI: 00000000000a0100 RDI: 000055e048316640
RBP: 0000000000000008 R08: 000055e0482b3559 R09: 0000000000000020
R10: 0000000000000000 R11: 0000000000000293 R12: 000055e048316654
R13: 000055e04820f020 R14: 00007fffd6257b80 R15: 000055e0482b3530

Allocated by task 1:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc.part.0+0x4f/0xd0 mm/kasan/kasan.c:551
 kmem_cache_alloc+0x124/0x3c0 mm/slab.c:3552
 add_system_zone+0x29b/0x530 fs/ext4/block_validity.c:85
 ext4_setup_system_zone+0x31e/0x8b0 fs/ext4/block_validity.c:204
 ext4_fill_super+0x7325/0xbba0 fs/ext4/super.c:4389
 mount_bdev+0x2b3/0x360 fs/super.c:1134
 mount_fs+0x92/0x2a0 fs/super.c:1237
 vfs_kern_mount.part.0+0x5b/0x3c0 fs/namespace.c:1046
 vfs_kern_mount fs/namespace.c:1036 [inline]
 do_new_mount fs/namespace.c:2549 [inline]
 do_mount+0x3c9/0x25e0 fs/namespace.c:2879
 SYSC_mount fs/namespace.c:3095 [inline]
 SyS_mount+0xa8/0x120 fs/namespace.c:3072
 do_mount_root+0x30/0x1b0 init/do_mounts.c:366
 mount_block_root+0x2c0/0x59d 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+0x5f8/0x615 init/main.c:1093
 kernel_init+0xd/0x15b init/main.c:1000
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Freed by task 25707:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xaf/0x190 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+0x68/0xe0 fs/ext4/block_validity.c:237
 ext4_setup_system_zone+0x3a0/0x8b0 fs/ext4/block_validity.c:195
 ext4_remount+0xf6c/0x1d50 fs/ext4/super.c:5347
 do_remount_sb+0x150/0x530 fs/super.c:868
 do_remount fs/namespace.c:2370 [inline]
 do_mount+0x12d2/0x25e0 fs/namespace.c:2870
 SYSC_mount fs/namespace.c:3095 [inline]
 SyS_mount+0xa8/0x120 fs/namespace.c:3072
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff888215f8f070
 which belongs to the cache ext4_system_zone of size 40
The buggy address is located 24 bytes inside of
 40-byte region [ffff888215f8f070, ffff888215f8f098)
The buggy address belongs to the page:
page:ffffea000857e3c0 count:1 mapcount:0 mapping:ffff888215f8f000 index:0xffff888215f8ffb9
flags: 0x57ffe0000000100(slab)
raw: 057ffe0000000100 ffff888215f8f000 ffff888215f8ffb9 000000010000001b
raw: ffff8882194d1c38 ffff8882194d1c38 ffff8882194cce00 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888215f8ef80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888215f8f000: fb fb fb fb fb fc fc fb fb fb fb fb fc fc fb fb
>ffff888215f8f080: fb fb fb fc fc fb fb fb fb fb fc fc fb fb fb fb
                      ^
 ffff888215f8f100: fb fc fc fb fb fb fb fb fc fc fb fb fb fb fb fc
 ffff888215f8f180: fc fb fb fb fb fb fc fc fb fb fb fb fb fc fc fb
==================================================================
EXT4-fs (sda1): re-mounted. Opts: noblock_validity,
EXT4-fs (sda1): re-mounted. Opts: noblock_validity,

Crashes (5):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2020/05/29 20:09 linux-4.14.y 4f68020fef1c bed08304 .config log report
ci2-linux-4-14 2020/04/24 16:32 linux-4.14.y 050272a0423e 03d97a1b .config log report
ci2-linux-4-14 2020/02/29 16:22 linux-4.14.y 78d697fc93f9 c88c7b75 .config log report
ci2-linux-4-14 2019/11/20 16:27 linux-4.14.y 775d01b65b5d 432c7650 .config log report
ci2-linux-4-14 2019/08/15 14:06 linux-4.14.y 3ffe1e79c174 0d298d6b .config log report