KASAN: use-after-free Read in _vm_unmap_aliases

8 views
Skip to first unread message

syzbot

unread,
Jun 6, 2020, 5:26:17 AM6/6/20
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 8b41eaf1 ANDROID: Update ABI representation
git tree: android-5.4
console output: https://syzkaller.appspot.com/x/log.txt?x=156e9212100000
kernel config: https://syzkaller.appspot.com/x/.config?x=9d1a84ff4be032b6
dashboard link: https://syzkaller.appspot.com/bug?extid=8603fe3ba09478727692
compiler: Android (6032204 based on r370808) clang version 10.0.1 (https://android.googlesource.com/toolchain/llvm-project 6e765c10313d15c02ab29977a82938f66742c3a9)

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+8603fe...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in _vm_unmap_aliases+0x188/0x380 mm/vmalloc.c:1687
Read of size 8 at addr ffff88811ca69600 by task syz-executor.3/15944

CPU: 0 PID: 15944 Comm: syz-executor.3 Not tainted 5.4.44-syzkaller-00692-g8b41eaf1ffa9 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x14a/0x1ce lib/dump_stack.c:118
print_address_description+0x93/0x620 mm/kasan/report.c:374
__kasan_report+0x16d/0x1e0 mm/kasan/report.c:506
kasan_report+0x34/0x60 mm/kasan/common.c:634
_vm_unmap_aliases+0x188/0x380 mm/vmalloc.c:1687
change_page_attr_set_clr+0x2ae/0x700 arch/x86/mm/pageattr.c:1713
change_page_attr_clear arch/x86/mm/pageattr.c:1770 [inline]
set_memory_ro+0xa4/0xe0 arch/x86/mm/pageattr.c:1903
bpf_jit_binary_lock_ro include/linux/filter.h:844 [inline]
bpf_int_jit_compile+0x6e9f/0x72b0 arch/x86/net/bpf_jit_comp.c:1179
bpf_prog_select_runtime+0x666/0x910 kernel/bpf/core.c:1738
bpf_prog_load kernel/bpf/syscall.c:1726 [inline]
__do_sys_bpf+0x82f8/0xbed0 kernel/bpf/syscall.c:2883
do_syscall_64+0xcb/0x150 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45ca69
Code: 0d b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 db b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ff320d6cc78 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00000000004da900 RCX: 000000000045ca69
RDX: 0000000000000064 RSI: 00000000202a0fb8 RDI: 0000000000000005
RBP: 000000000078bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 000000000000006a R14: 00000000004c32f4 R15: 00007ff320d6d6d4

Allocated by task 142:
save_stack mm/kasan/common.c:69 [inline]
set_track mm/kasan/common.c:77 [inline]
__kasan_kmalloc+0x12c/0x1c0 mm/kasan/common.c:510
slab_post_alloc_hook mm/slab.h:584 [inline]
slab_alloc_node mm/slub.c:2766 [inline]
slab_alloc mm/slub.c:2774 [inline]
kmem_cache_alloc+0x1d5/0x260 mm/slub.c:2779
kmem_cache_alloc_node include/linux/slab.h:427 [inline]
alloc_vmap_area+0x164/0x1bc0 mm/vmalloc.c:1068
new_vmap_block mm/vmalloc.c:1473 [inline]
vb_alloc mm/vmalloc.c:1621 [inline]
vm_map_ram+0x428/0x950 mm/vmalloc.c:1785
ion_clear_pages drivers/staging/android/ion/ion_buffer.c:98 [inline]
ion_sglist_zero drivers/staging/android/ion/ion_buffer.c:126 [inline]
ion_buffer_zero+0x3b0/0x490 drivers/staging/android/ion/ion_buffer.c:186
ion_system_heap_free+0x9f/0x330 drivers/staging/android/ion/heaps/ion_system_heap.c:168
ion_buffer_release+0xd4/0x250 drivers/staging/android/ion/ion_buffer.c:215
ion_heap_deferred_free+0xd4/0x590 drivers/staging/android/ion/ion_heap.c:119
kthread+0x2df/0x300 kernel/kthread.c:255
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352

Freed by task 15948:
save_stack mm/kasan/common.c:69 [inline]
set_track mm/kasan/common.c:77 [inline]
kasan_set_free_info mm/kasan/common.c:332 [inline]
__kasan_slab_free+0x181/0x230 mm/kasan/common.c:471
slab_free_hook mm/slub.c:1424 [inline]
slab_free_freelist_hook+0xd0/0x150 mm/slub.c:1457
slab_free mm/slub.c:3014 [inline]
kmem_cache_free+0xac/0x600 mm/slub.c:3030
merge_or_add_vmap_area mm/vmalloc.c:725 [inline]
__purge_vmap_area_lazy+0x5c4/0x18b0 mm/vmalloc.c:1288
_vm_unmap_aliases+0x2f7/0x380 mm/vmalloc.c:1705
change_page_attr_set_clr+0x2ae/0x700 arch/x86/mm/pageattr.c:1713
change_page_attr_clear arch/x86/mm/pageattr.c:1770 [inline]
set_memory_ro+0xa4/0xe0 arch/x86/mm/pageattr.c:1903
bpf_jit_binary_lock_ro include/linux/filter.h:844 [inline]
bpf_int_jit_compile+0x6e9f/0x72b0 arch/x86/net/bpf_jit_comp.c:1179
bpf_prog_select_runtime+0x666/0x910 kernel/bpf/core.c:1738
bpf_prog_load kernel/bpf/syscall.c:1726 [inline]
__do_sys_bpf+0x82f8/0xbed0 kernel/bpf/syscall.c:2883
do_syscall_64+0xcb/0x150 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff88811ca69600
which belongs to the cache vmap_area of size 64
The buggy address is located 0 bytes inside of
64-byte region [ffff88811ca69600, ffff88811ca69640)
The buggy address belongs to the page:
page:ffffea0004729a40 refcount:1 mapcount:0 mapping:ffff8881da822c80 index:0x0
flags: 0x8000000000000200(slab)
raw: 8000000000000200 ffffea0004386cc0 0000000300000003 ffff8881da822c80
raw: 0000000000000000 00000000002a002a 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88811ca69500: fb fb fb fb fc fc fc fc fb fb fb fb fb fb fb fb
ffff88811ca69580: fc fc fc fc fb fb fb fb fb fb fb fb fc fc fc fc
>ffff88811ca69600: fb fb fb fb fb fb fb fb fc fc fc fc fb fb fb fb
^
ffff88811ca69680: fb fb fb fb fc fc fc fc fb fb fb fb fb fb fb fb
ffff88811ca69700: fc fc fc fc fb fb fb fb fb fb fb fb 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,
Oct 4, 2020, 5:26:12 AM10/4/20
to syzkaller-a...@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