KASAN: use-after-free Read in ext4_data_block_valid

6 views
Skip to first unread message

syzbot

unread,
Aug 15, 2019, 11:07:07 AM8/15/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 3ffe1e79 Linux 4.14.138
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10c74d3c600000
kernel config: https://syzkaller.appspot.com/x/.config?x=978e269523a888e8
dashboard link: https://syzkaller.appspot.com/bug?extid=8e2729dc9b40f5871aee
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+8e2729...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in ext4_data_block_valid+0x293/0x2e0
fs/ext4/block_validity.c:211
Read of size 8 at addr ffff88809acddd38 by task blkid/10995

CPU: 0 PID: 10995 Comm: blkid Not tainted 4.14.138 #34
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+0x138/0x19c lib/dump_stack.c:53
print_address_description.cold+0x7c/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/0x2af mm/kasan/report.c:393
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
ext4_data_block_valid+0x293/0x2e0 fs/ext4/block_validity.c:211
__check_block_validity.constprop.0+0xc1/0x200 fs/ext4/inode.c:401
ext4_map_blocks+0xe74/0x17c0 fs/ext4/inode.c:591
ext4_getblk+0x346/0x450 fs/ext4/inode.c:971
ext4_bread_batch+0x6f/0x370 fs/ext4/inode.c:1041
ext4_find_entry+0x466/0xd70 fs/ext4/namei.c:1441
ext4_lookup fs/ext4/namei.c:1583 [inline]
ext4_lookup+0x111/0x550 fs/ext4/namei.c:1559
lookup_slow+0x226/0x440 fs/namei.c:1695
walk_component+0x698/0x1d00 fs/namei.c:1824
link_path_walk+0x81f/0x10a0 fs/namei.c:2153
path_lookupat.isra.0+0xcb/0x7b0 fs/namei.c:2341
filename_lookup+0x18e/0x380 fs/namei.c:2376
user_path_at_empty+0x43/0x50 fs/namei.c:2630
user_path_at include/linux/namei.h:57 [inline]
SYSC_faccessat fs/open.c:403 [inline]
SyS_faccessat fs/open.c:353 [inline]
SYSC_access fs/open.c:450 [inline]
SyS_access+0x222/0x6b0 fs/open.c:448
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x7fc6bdf2f267
RSP: 002b:00007ffccdf2a0a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000015
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fc6bdf2f267
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00007fc6bdf332e6
RBP: 00007ffccdf2a140 R08: 000000000000003c R09: 0000000000000000
R10: 00007ffccdfd8120 R11: 0000000000000246 R12: 0000000000000001
R13: 0000000000000004 R14: 00007fc6be13a758 R15: 00007fc6bdf33931

Allocated by task 1:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:489
kmem_cache_alloc+0x12e/0x780 mm/slab.c:3552
add_system_zone+0x2b3/0x610 fs/ext4/block_validity.c:85
ext4_setup_system_zone+0x303/0x480 fs/ext4/block_validity.c:169
ext4_fill_super+0x71a0/0xb470 fs/ext4/super.c:4358
mount_bdev+0x2be/0x370 fs/super.c:1134
ext4_mount+0x35/0x40 fs/ext4/super.c:5860
mount_fs+0x97/0x2a1 fs/super.c:1237
vfs_kern_mount.part.0+0x5e/0x3d0 fs/namespace.c:1046
vfs_kern_mount fs/namespace.c:1036 [inline]
do_new_mount fs/namespace.c:2549 [inline]
do_mount+0x417/0x27d0 fs/namespace.c:2879
SYSC_mount fs/namespace.c:3095 [inline]
SyS_mount+0xab/0x120 fs/namespace.c:3072
do_mount_root+0x35/0x1b8 init/do_mounts.c:366
mount_block_root+0x301/0x544 init/do_mounts.c:395
mount_root+0x1dd/0x210 init/do_mounts.c:540
prepare_namespace+0x1de/0x21d init/do_mounts.c:599
kernel_init_freeable+0x514/0x532 init/main.c:1092
kernel_init+0x12/0x162 init/main.c:999
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Freed by task 10990:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kmem_cache_free+0x83/0x2b0 mm/slab.c:3758
ext4_release_system_zone+0x6f/0xf0 fs/ext4/block_validity.c:187
ext4_setup_system_zone+0x3c3/0x480 fs/ext4/block_validity.c:151
ext4_remount+0xf32/0x1f80 fs/ext4/super.c:5309
do_remount_sb+0x15e/0x560 fs/super.c:868
do_remount fs/namespace.c:2370 [inline]
do_mount+0x13c9/0x27d0 fs/namespace.c:2870
SYSC_mount fs/namespace.c:3095 [inline]
SyS_mount+0xab/0x120 fs/namespace.c:3072
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff88809acddd20
which belongs to the cache ext4_system_zone of size 40
The buggy address is located 24 bytes inside of
40-byte region [ffff88809acddd20, ffff88809acddd48)
The buggy address belongs to the page:
page:ffffea00026b3740 count:1 mapcount:0 mapping:ffff88809acdd000
index:0xffff88809acddfb9
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffff88809acdd000 ffff88809acddfb9 0000000100000003
raw: ffff8880a689ba38 ffff8880a689ba38 ffff8880a689cd80 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88809acddc00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88809acddc80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff88809acddd00: fc fc fc fc fb fb fb fb fb fc fc fb fb fb fb fb
^
ffff88809acddd80: fc fc fb fb fb fb fb fc fc fb fb fb fb fb fc fc
ffff88809acdde00: fb fb fb fb fb fc fc fb fb fb fb fb fc fc fb fb
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Sep 26, 2020, 4:10:11 PM9/26/20
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages