syzbot


KASAN: slab-out-of-bounds Read in __kvm_map_gfn

Status: closed as dup on 2020/04/08 01:08
Subsystems: kvm
[Documentation on labels]
Reported-by: syzbot+516667c144d77aa5ba3c@syzkaller.appspotmail.com
First crash: 1481d, last: 1441d
Cause bisection: introduced by (bisect log) :
commit 3a00e7c47c382b30524e78b36ab047c16b8fcfef
Author: Alex Shi <alex.shi@linux.alibaba.com>
Date: Tue Jan 21 08:34:05 2020 +0000

  ida: remove abandoned macros

Crash: KASAN: vmalloc-out-of-bounds Read in srcu_invoke_callbacks (log)
Repro: C syz .config
  
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
KASAN: slab-out-of-bounds Read in __kvm_gfn_to_hva_cache_init kvm C done 1537 1432d 1476d
Discussions (1)
Title Replies (including bot) Last reply
KASAN: slab-out-of-bounds Read in __kvm_map_gfn 2 (3) 2020/04/08 01:08

Sample crash report:
L1TF CPU bug present and SMT on, data leak possible. See CVE-2018-3646 and https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/l1tf.html for details.
==================================================================
BUG: KASAN: slab-out-of-bounds in search_memslots include/linux/kvm_host.h:1051 [inline]
BUG: KASAN: slab-out-of-bounds in __gfn_to_memslot include/linux/kvm_host.h:1063 [inline]
BUG: KASAN: slab-out-of-bounds in __kvm_map_gfn+0x933/0xa10 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2060
Read of size 8 at addr ffff8880a6608468 by task syz-executor475/7010

CPU: 0 PID: 7010 Comm: syz-executor475 Not tainted 5.6.0-syzkaller #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+0x188/0x20d lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xd3/0x315 mm/kasan/report.c:382
 __kasan_report.cold+0x35/0x4d mm/kasan/report.c:511
 kasan_report+0x33/0x50 mm/kasan/common.c:625
 search_memslots include/linux/kvm_host.h:1051 [inline]
 __gfn_to_memslot include/linux/kvm_host.h:1063 [inline]
 __kvm_map_gfn+0x933/0xa10 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2060
 kvm_steal_time_set_preempted arch/x86/kvm/x86.c:3609 [inline]
 kvm_arch_vcpu_put+0x3b9/0x530 arch/x86/kvm/x86.c:3642
 vcpu_put+0x1b/0x70 arch/x86/kvm/../../../virt/kvm/kvm_main.c:220
 kvm_arch_vcpu_ioctl+0x1ae/0x2c20 arch/x86/kvm/x86.c:4620
 kvm_vcpu_ioctl+0x866/0xe60 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3291
 vfs_ioctl fs/ioctl.c:47 [inline]
 ksys_ioctl+0x11a/0x180 fs/ioctl.c:763
 __do_sys_ioctl fs/ioctl.c:772 [inline]
 __se_sys_ioctl fs/ioctl.c:770 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:770
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295
 entry_SYSCALL_64_after_hwframe+0x49/0xb3
RIP: 0033:0x4403f9
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 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 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffdedbb7d38 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 00000000004403f9
RDX: 0000000020000100 RSI: 000000004008ae89 RDI: 0000000000000005
RBP: 00000000006ca018 R08: 00000000004002c8 R09: 00000000004002c8
R10: 00000000004002c8 R11: 0000000000000246 R12: 0000000000401c80
R13: 0000000000401d10 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 7010:
 save_stack+0x1b/0x40 mm/kasan/common.c:49
 set_track mm/kasan/common.c:57 [inline]
 __kasan_kmalloc mm/kasan/common.c:495 [inline]
 __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:468
 kmalloc_node include/linux/slab.h:578 [inline]
 kvmalloc_node+0x61/0xf0 mm/util.c:574
 kvmalloc include/linux/mm.h:739 [inline]
 kvzalloc include/linux/mm.h:747 [inline]
 kvm_dup_memslots arch/x86/kvm/../../../virt/kvm/kvm_main.c:1101 [inline]
 kvm_set_memslot+0x115/0x1530 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1118
 __kvm_set_memory_region+0xcf7/0x1320 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1300
 __x86_set_memory_region+0x2a3/0x5a0 arch/x86/kvm/x86.c:9845
 alloc_apic_access_page arch/x86/kvm/vmx/vmx.c:3544 [inline]
 vmx_create_vcpu+0x2107/0x2b40 arch/x86/kvm/vmx/vmx.c:6772
 kvm_arch_vcpu_create+0x6ef/0xb80 arch/x86/kvm/x86.c:9365
 kvm_vm_ioctl_create_vcpu arch/x86/kvm/../../../virt/kvm/kvm_main.c:3030 [inline]
 kvm_vm_ioctl+0x15f7/0x23e0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3585
 vfs_ioctl fs/ioctl.c:47 [inline]
 ksys_ioctl+0x11a/0x180 fs/ioctl.c:763
 __do_sys_ioctl fs/ioctl.c:772 [inline]
 __se_sys_ioctl fs/ioctl.c:770 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:770
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295
 entry_SYSCALL_64_after_hwframe+0x49/0xb3

Freed by task 4104:
 save_stack+0x1b/0x40 mm/kasan/common.c:49
 set_track mm/kasan/common.c:57 [inline]
 kasan_set_free_info mm/kasan/common.c:317 [inline]
 __kasan_slab_free+0xf7/0x140 mm/kasan/common.c:456
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x109/0x2b0 mm/slab.c:3757
 __scm_destroy+0xf1/0x130 net/core/scm.c:126
 scm_destroy include/net/scm.h:75 [inline]
 unix_dgram_sendmsg+0xd70/0x12e0 net/unix/af_unix.c:1810
 sock_sendmsg_nosec net/socket.c:652 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:672
 ____sys_sendmsg+0x6bf/0x7e0 net/socket.c:2362
 ___sys_sendmsg+0x100/0x170 net/socket.c:2416
 __sys_sendmsg+0xec/0x1b0 net/socket.c:2449
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295
 entry_SYSCALL_64_after_hwframe+0x49/0xb3

The buggy address belongs to the object at ffff8880a6608000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 1128 bytes inside of
 2048-byte region [ffff8880a6608000, ffff8880a6608800)
The buggy address belongs to the page:
page:ffffea0002998200 refcount:1 mapcount:0 mapping:0000000074f32ef5 index:0x0
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea0002998008 ffffea00029981c8 ffff8880aa000e00
raw: 0000000000000000 ffff8880a6608000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a6608300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880a6608380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880a6608400: 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc
                                                          ^
 ffff8880a6608480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880a6608500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (9):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/04/09 10:16 upstream ae46d2aa6a7f a8c6a3f8 .config console log report syz C ci-upstream-kasan-gce
2020/04/03 14:35 upstream bef7b2a7be28 5ed396e6 .config console log report syz C ci-upstream-kasan-gce-386
2020/04/28 21:50 linux-next ac935d227366 e3ecea2e .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2020/04/14 02:17 upstream 8f3d9f354286 7c54686a .config console log report ci-upstream-kasan-gce-smack-root
2020/04/03 12:34 upstream bef7b2a7be28 5ed396e6 .config console log report ci-upstream-kasan-gce-386
2020/04/03 12:11 upstream bef7b2a7be28 5ed396e6 .config console log report ci-upstream-kasan-gce-386
2020/05/13 15:19 linux-next ac935d227366 9a6d42fb .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/03 10:32 linux-next ac935d227366 5457883a .config console log report ci-upstream-linux-next-kasan-gce-root
2020/04/22 20:46 linux-next ac935d227366 2e44d63e .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.