syzbot


KASAN: use-after-free Read in ext4_inode_block_valid

Status: auto-closed as invalid on 2021/09/13 02:10
Reported-by: syzbot+1108049ff575bcb7df07@syzkaller.appspotmail.com
First crash: 456d, last: 417d
similar bugs (1):
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 (2) 1 115d 115d 0/1 upstream: reported on 2022/03/14 03:24

Sample crash report:
pci 0000:00:05.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=io+mem:owns=io+mem
EXT4-fs (sda1): Remounting file system with no journal so ignoring journalled data option
==================================================================
EXT4-fs (sda1): re-mounted. Opts: noblock_validity,data=writeback,errors=continue
BUG: KASAN: use-after-free in ext4_inode_block_valid+0x33b/0x3b0 fs/ext4/block_validity.c:255
Read of size 8 at addr ffff8880a44b7d38 by task syz-executor.1/21825

CPU: 1 PID: 21825 Comm: syz-executor.1 Not tainted 4.14.232-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/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
 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
 ext4_getblk+0x314/0x3f0 fs/ext4/inode.c:992
 ext4_bread+0x6c/0x1a0 fs/ext4/inode.c:1042
 __ext4_read_dirblock+0x33/0x810 fs/ext4/namei.c:110
 htree_dirblock_to_tree+0x96/0x520 fs/ext4/namei.c:994
 ext4_htree_fill_tree+0x202/0xa50 fs/ext4/namei.c:1113
 ext4_dx_readdir fs/ext4/dir.c:579 [inline]
 ext4_readdir+0x11d5/0x27e0 fs/ext4/dir.c:124
 iterate_dir+0x1a0/0x5e0 fs/readdir.c:52
 SYSC_getdents64 fs/readdir.c:358 [inline]
 SyS_getdents64+0x125/0x230 fs/readdir.c:339
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x48a887
RSP: 002b:00007ffcba08f358 EFLAGS: 00000293 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 00000000032d5810 RCX: 000000000048a887
RDX: 0000000000008000 RSI: 00000000032d5840 RDI: 0000000000000003
RBP: 00000000032d5840 R08: 0000000000000030 R09: 0000000000547620
R10: 0000000000000231 R11: 0000000000000293 R12: ffffffffffffffbc
R13: 00000000032d5814 R14: 0000000000000016 R15: 00007ffcba090560

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+0x231/0x8c0 fs/ext4/block_validity.c:206
 ext4_fill_super+0x62cc/0xb280 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/0x470 fs/namespace.c:1046
 vfs_kern_mount fs/namespace.c:1036 [inline]
 do_new_mount fs/namespace.c:2549 [inline]
 do_mount+0xe53/0x2a00 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+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+0x5f7/0x614 init/main.c:1093
 kernel_init+0xd/0x165 init/main.c:1000
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Freed by task 26098:
 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:5367
 do_remount_sb+0x150/0x530 fs/super.c:868
 do_remount fs/namespace.c:2370 [inline]
 do_mount+0x1632/0x2a00 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 ffff8880a44b7d20
 which belongs to the cache ext4_system_zone of size 40
The buggy address is located 24 bytes inside of
 40-byte region [ffff8880a44b7d20, ffff8880a44b7d48)
The buggy address belongs to the page:
page:ffffea0002912dc0 count:1 mapcount:0 mapping:ffff8880a44b7000 index:0xffff8880a44b7fb9
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880a44b7000 ffff8880a44b7fb9 0000000100000013
raw: ffff8880b10f0438 ffff8880b10f0438 ffff8880b10ec380 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a44b7c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880a44b7c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880a44b7d00: fc fc fc fc fb fb fb fb fb fc fc fb fb fb fb fb
                                        ^
 ffff8880a44b7d80: fc fc fb fb fb fb fb fc fc fb fb fb fb fb fc fc
 ffff8880a44b7e00: fb fb fb fb fb fc fc fb fb fb fb fb fc fc fb fb
==================================================================
pci 0000:00:05.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=io+mem:owns=io+mem

Crashes (3):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2021/05/16 02:09 linux-4.14.y 7d7d1c0ab3eb f54a5c09 .config log report info KASAN: use-after-free Read in ext4_inode_block_valid
ci2-linux-4-14 2021/05/15 10:21 linux-4.14.y 7d7d1c0ab3eb 93f844de .config log report info KASAN: use-after-free Read in ext4_inode_block_valid
ci2-linux-4-14 2021/04/06 19:40 linux-4.14.y bd634aa64163 6a81331a .config log report info KASAN: use-after-free Read in ext4_inode_block_valid