KASAN: use-after-free Read in ext4_data_block_valid

22 views
Skip to first unread message

syzbot

unread,
Apr 12, 2019, 8:01:26 PM4/12/19
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 47350a9f ANDROID: x86_64_cuttlefish_defconfig: Enable lz4 ..
git tree: android-4.14
console output: https://syzkaller.appspot.com/x/log.txt?x=163d8ab6400000
kernel config: https://syzkaller.appspot.com/x/.config?x=10d236078f3378a3
dashboard link: https://syzkaller.appspot.com/bug?extid=6bcc8c972a987a81b623
compiler: gcc (GCC) 8.0.1 20180413 (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+6bcc8c...@syzkaller.appspotmail.com

binder_alloc: 14333: binder_alloc_buf, no vma
binder: 14333:14345 transaction failed 29189/-3, size 0-0 line 3135
EXT4-fs (sda1): Ignoring removed bh option
EXT4-fs (sda1): re-mounted. Opts:
max_batch_time=0x0000000000000003,bh,max_batch_time=0x0000000000000000,noblock_validity,resgid=0x0000000000000000,
==================================================================
BUG: KASAN: use-after-free in ext4_data_block_valid+0x276/0x2d0
fs/ext4/block_validity.c:211
Read of size 8 at addr ffff8801d4c23bb0 by task syz-executor1/2048

CPU: 0 PID: 2048 Comm: syz-executor1 Not tainted 4.14.67+ #1
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0xb9/0x11b lib/dump_stack.c:53
print_address_description+0x60/0x22b mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report.cold.6+0x11b/0x2dd mm/kasan/report.c:409
ext4_data_block_valid+0x276/0x2d0 fs/ext4/block_validity.c:211
__check_block_validity.constprop.27+0xbc/0x200 fs/ext4/inode.c:402
ext4_map_blocks+0xc22/0x1560 fs/ext4/inode.c:592
ext4_getblk+0x31c/0x400 fs/ext4/inode.c:966
ext4_bread_batch+0x78/0x330 fs/ext4/inode.c:1036
ext4_find_entry+0x44c/0xcd0 fs/ext4/namei.c:1423
ext4_lookup+0x133/0x590 fs/ext4/namei.c:1555
lookup_real fs/namei.c:1528 [inline]
__lookup_hash+0x10e/0x190 fs/namei.c:1548
filename_create+0x189/0x450 fs/namei.c:3656
user_path_create fs/namei.c:3713 [inline]
SYSC_mkdirat fs/namei.c:3857 [inline]
SyS_mkdirat+0x9f/0x220 fs/namei.c:3849
do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4564d7
RSP: 002b:00007ffd13ffb978 EFLAGS: 00000206 ORIG_RAX: 0000000000000053
RAX: ffffffffffffffda RBX: 0000000000030a82 RCX: 00000000004564d7
RDX: 00007ffd13ffb995 RSI: 00000000000001ff RDI: 00007ffd13ffb990
RBP: 00000000000003fc R08: 0000000000000000 R09: 0000000000000005
R10: 0000000000000064 R11: 0000000000000206 R12: 0000000000000006
R13: 0000000000030a76 R14: 00000000000000e6 R15: badc0ffeebadface

Allocated by task 1:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc.part.1+0x4f/0xd0 mm/kasan/kasan.c:551
slab_post_alloc_hook mm/slab.h:442 [inline]
slab_alloc_node mm/slub.c:2723 [inline]
slab_alloc mm/slub.c:2731 [inline]
kmem_cache_alloc+0xe4/0x2b0 mm/slub.c:2736
add_system_zone+0x261/0x4d0 fs/ext4/block_validity.c:85
ext4_setup_system_zone+0x2e2/0x470 fs/ext4/block_validity.c:169
ext4_fill_super+0x706c/0xb5e0 fs/ext4/super.c:4289
mount_bdev+0x2ab/0x370 fs/super.c:1149
mount_fs+0x28f/0x31a fs/super.c:1255
vfs_kern_mount.part.9+0xce/0x4a0 fs/namespace.c:1056
vfs_kern_mount fs/namespace.c:1038 [inline]
do_new_mount fs/namespace.c:2561 [inline]
do_mount+0x404/0x26e0 fs/namespace.c:2891
SYSC_mount fs/namespace.c:3107 [inline]
SyS_mount+0xe5/0x100 fs/namespace.c:3084
do_mount_root init/do_mounts.c:366 [inline]
mount_block_root+0x378/0x727 init/do_mounts.c:395
prepare_namespace+0x1cf/0x20a init/do_mounts.c:600
kernel_init_freeable+0x382/0x39f init/main.c:1091
kernel_init+0xc/0x157 init/main.c:1000
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:402

Freed by task 14344:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xac/0x190 mm/kasan/kasan.c:524
slab_free_hook mm/slub.c:1389 [inline]
slab_free_freelist_hook mm/slub.c:1410 [inline]
slab_free mm/slub.c:2966 [inline]
kmem_cache_free+0x12d/0x350 mm/slub.c:2988
ext4_release_system_zone+0x79/0x110 fs/ext4/block_validity.c:187
ext4_setup_system_zone+0x3a4/0x470 fs/ext4/block_validity.c:151
ext4_remount+0xdc6/0x1c30 fs/ext4/super.c:5231
do_remount_sb2+0x2eb/0x5f0 fs/super.c:878
do_remount fs/namespace.c:2376 [inline]
do_mount+0xfae/0x26e0 fs/namespace.c:2882
SYSC_mount fs/namespace.c:3107 [inline]
SyS_mount+0xe5/0x100 fs/namespace.c:3084
do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289
entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8801d4c23b98
which belongs to the cache ext4_system_zone of size 40
The buggy address is located 24 bytes inside of
40-byte region [ffff8801d4c23b98, ffff8801d4c23bc0)
The buggy address belongs to the page:
page:ffffea00075308c0 count:1 mapcount:0 mapping: (null)
index:0xffff8801d4c23b60
flags: 0x4000000000000100(slab)
raw: 4000000000000100 0000000000000000 ffff8801d4c23b60 000000018049001a
raw: dead000000000100 dead000000000200 ffff8801d8fd6200 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8801d4c23a80: fb fb fb fb fb fc fc fb fb fb fb fb fc fc fb fb
ffff8801d4c23b00: fb fb fb fc fc fb fb fb fb fb fc fc fb fb fb fb
> ffff8801d4c23b80: fb fc fc fb fb fb fb fb fc fc fc fc fc fc fc fc
^
ffff8801d4c23c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8801d4c23c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
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,
Apr 14, 2019, 5:30:12 AM4/14/19
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: c2f9bce9 ANDROID: ftrace: fix function type mismatches
git tree: android-4.9
console output: https://syzkaller.appspot.com/x/log.txt?x=176f0417800000
kernel config: https://syzkaller.appspot.com/x/.config?x=f3ab3f1c4014fe13
dashboard link: https://syzkaller.appspot.com/bug?extid=5879b432a850c9a2795a
compiler: gcc (GCC) 8.0.1 20180413 (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+5879b4...@syzkaller.appspotmail.com

EXT4-fs (sda1): re-mounted. Opts: noblock_validity,
==================================================================
BUG: KASAN: use-after-free in ext4_data_block_valid+0x290/0x2e0
fs/ext4/block_validity.c:210
Read of size 8 at addr ffff8801cd8b4bb0 by task udevd/7162

CPU: 0 PID: 7162 Comm: udevd Not tainted 4.9.99-gc2f9bce #22
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
ffff8801d69d6fa8 ffffffff81eb0f09 ffffea0007362d00 ffff8801cd8b4bb0
0000000000000000 ffff8801cd8b4bb0 0000000000002147 ffff8801d69d6fe0
ffffffff815652eb ffff8801cd8b4bb0 0000000000000008 0000000000000000
Call Trace:
[<ffffffff81eb0f09>] __dump_stack lib/dump_stack.c:15 [inline]
[<ffffffff81eb0f09>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
[<ffffffff815652eb>] print_address_description+0x6c/0x234
mm/kasan/report.c:256
[<ffffffff815656f5>] kasan_report_error mm/kasan/report.c:355 [inline]
[<ffffffff815656f5>] kasan_report.cold.6+0x242/0x2fe mm/kasan/report.c:412
[<ffffffff81539374>] __asan_report_load8_noabort+0x14/0x20
mm/kasan/report.c:433
[<ffffffff8182d6c0>] ext4_data_block_valid+0x290/0x2e0
fs/ext4/block_validity.c:210
[<ffffffff8173c111>] __check_block_validity.constprop.87+0xc1/0x200
fs/ext4/inode.c:378
[<ffffffff8173ff47>] ext4_map_blocks+0xc87/0x16d0 fs/ext4/inode.c:568
[<ffffffff81742afc>] ext4_getblk+0x2cc/0x450 fs/ext4/inode.c:943
[<ffffffff8176ddf4>] ext4_find_entry+0xa94/0x12b0 fs/ext4/namei.c:1418
[<ffffffff8176fa4c>] ext4_lookup+0x13c/0x5f0 fs/ext4/namei.c:1567
[<ffffffff815988bd>] lookup_open+0x63d/0x1930 fs/namei.c:3203
[<ffffffff815a2e33>] do_last fs/namei.c:3315 [inline]
[<ffffffff815a2e33>] path_openat+0x1803/0x3590 fs/namei.c:3534
[<ffffffff815a8e87>] do_filp_open+0x197/0x270 fs/namei.c:3568
[<ffffffff81580bcf>] do_open_execat+0x10f/0x640 fs/exec.c:844
[<ffffffff81581143>] open_exec+0x43/0x60 fs/exec.c:876
[<ffffffff81692c46>] load_elf_binary+0x7e6/0x4be0 fs/binfmt_elf.c:754
[<ffffffff815830df>] search_binary_handler+0x14f/0x6f0 fs/exec.c:1622
[<ffffffff81587a55>] exec_binprm fs/exec.c:1664 [inline]
[<ffffffff81587a55>] do_execveat_common.isra.40+0x11c5/0x1f30
fs/exec.c:1786
[<ffffffff81589122>] do_execve fs/exec.c:1830 [inline]
[<ffffffff81589122>] SYSC_execve fs/exec.c:1911 [inline]
[<ffffffff81589122>] SyS_execve+0x42/0x50 fs/exec.c:1906
[<ffffffff81006316>] do_syscall_64+0x1a6/0x490 arch/x86/entry/common.c:282
[<ffffffff839f4653>] entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Allocated by task 1:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
save_stack+0x43/0xd0 mm/kasan/kasan.c:505
set_track mm/kasan/kasan.c:517 [inline]
kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:609
kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:547
slab_post_alloc_hook mm/slab.h:417 [inline]
slab_alloc_node mm/slub.c:2715 [inline]
slab_alloc mm/slub.c:2723 [inline]
kmem_cache_alloc+0xbe/0x290 mm/slub.c:2728
add_system_zone+0x284/0x5d0 fs/ext4/block_validity.c:84
ext4_setup_system_zone+0x30a/0x490 fs/ext4/block_validity.c:168
ext4_fill_super+0x6a86/0xb260 fs/ext4/super.c:4136
mount_bdev+0x2c7/0x390 fs/super.c:1100
ext4_mount+0x34/0x40 fs/ext4/super.c:5558
mount_fs+0x28c/0x370 fs/super.c:1206
vfs_kern_mount.part.29+0xd1/0x3d0 fs/namespace.c:991
vfs_kern_mount fs/namespace.c:973 [inline]
do_new_mount fs/namespace.c:2513 [inline]
do_mount+0x3c9/0x2740 fs/namespace.c:2835
SYSC_mount fs/namespace.c:3051 [inline]
SyS_mount+0xfe/0x110 fs/namespace.c:3028
do_mount_root init/do_mounts.c:366 [inline]
mount_block_root+0x35d/0x711 init/do_mounts.c:396
mount_root+0x77/0x7a init/do_mounts.c:541
prepare_namespace+0x1d8/0x215 init/do_mounts.c:601
kernel_init_freeable+0x50f/0x52d init/main.c:1036
kernel_init+0x11/0x15e init/main.c:946
ret_from_fork+0x5c/0x70 arch/x86/entry/entry_64.S:373

Freed by task 7155:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
save_stack+0x43/0xd0 mm/kasan/kasan.c:505
set_track mm/kasan/kasan.c:517 [inline]
kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:582
slab_free_hook mm/slub.c:1355 [inline]
slab_free_freelist_hook mm/slub.c:1377 [inline]
slab_free mm/slub.c:2958 [inline]
kmem_cache_free+0xbe/0x310 mm/slub.c:2980
ext4_release_system_zone+0x7c/0x110 fs/ext4/block_validity.c:186
ext4_setup_system_zone+0x3cd/0x490 fs/ext4/block_validity.c:150
ext4_remount+0xbf0/0x1b90 fs/ext4/super.c:5050
do_remount_sb2+0x351/0x7d0 fs/super.c:825
do_remount fs/namespace.c:2328 [inline]
do_mount+0xf93/0x2740 fs/namespace.c:2826
SYSC_mount fs/namespace.c:3051 [inline]
SyS_mount+0xfe/0x110 fs/namespace.c:3028
do_syscall_64+0x1a6/0x490 arch/x86/entry/common.c:282
entry_SYSCALL_64_after_swapgs+0x5d/0xdb

The buggy address belongs to the object at ffff8801cd8b4b98
which belongs to the cache ext4_system_zone of size 40
The buggy address is located 24 bytes inside of
40-byte region [ffff8801cd8b4b98, ffff8801cd8b4bc0)
The buggy address belongs to the page:
page:ffffea0007362d00 count:1 mapcount:0 mapping: (null)
index:0xffff8801cd8b4b60
flags: 0x8000000000000080(slab)
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8801cd8b4a80: fb fb fb fb fb fc fc fb fb fb fb fb fc fc fb fb
ffff8801cd8b4b00: fb fb fb fc fc fb fb fb fb fb fc fc fb fb fb fb
> ffff8801cd8b4b80: fb fc fc fb fb fb fb fb fc fc fc fc fc fc fc fc
^
ffff8801cd8b4c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8801cd8b4c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc

syzbot

unread,
Jun 29, 2019, 2:27:04 PM6/29/19
to syzkaller-a...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.

syzbot

unread,
Sep 11, 2019, 6:38:04 AM9/11/19
to syzkaller-a...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages