syzbot


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

Status: closed as dup on 2020/04/08 01:09
Subsystems: kvm
[Documentation on labels]
Reported-by: syzbot+89a42836ac72e6a02d35@syzkaller.appspotmail.com
First crash: 1431d, last: 1382d
Cause bisection: introduced by (bisect log) :
commit 36947254e5f981aeeedab1c7dfa35fc34d330e80
Author: Sean Christopherson <sean.j.christopherson@intel.com>
Date: Tue Feb 18 21:07:32 2020 +0000

  KVM: Dynamically size memslot array based on number of used slots

Crash: KASAN: slab-out-of-bounds Read in gfn_to_hva (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 1382d 1427d
Discussions (1)
Title Replies (including bot) Last reply
KASAN: slab-out-of-bounds Read in kvm_vcpu_gfn_to_memslot 1 (2) 2020/04/08 01:09

Sample crash report:
==================================================================
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_vcpu_gfn_to_memslot+0x50e/0x540 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1603
Read of size 8 at addr ffff8880a60a4468 by task syz-executor507/7203

CPU: 0 PID: 7203 Comm: syz-executor507 Not tainted 5.7.0-rc2-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_vcpu_gfn_to_memslot+0x50e/0x540 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1603
 try_async_pf+0x12b/0xac0 arch/x86/kvm/mmu/mmu.c:4097
 direct_page_fault+0x27d/0x1d70 arch/x86/kvm/mmu/mmu.c:4146
 kvm_mmu_do_page_fault arch/x86/kvm/mmu.h:115 [inline]
 kvm_mmu_page_fault+0x187/0x15d0 arch/x86/kvm/mmu/mmu.c:5446
 vmx_handle_exit+0x2b8/0x1700 arch/x86/kvm/vmx/vmx.c:5980
 vcpu_enter_guest+0xfea/0x59d0 arch/x86/kvm/x86.c:8481
 vcpu_run arch/x86/kvm/x86.c:8544 [inline]
 kvm_arch_vcpu_ioctl_run+0x3fb/0x16e0 arch/x86/kvm/x86.c:8766
 kvm_vcpu_ioctl+0x493/0xe60 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3138
 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:0x4468b9
Code: e8 0c e8 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 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 5b 07 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fde41684da8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000006dbc48 RCX: 00000000004468b9
RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 0000000000000005
RBP: 00000000006dbc40 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dbc4c
R13: 0000000020001a40 R14: 00000000004ae768 R15: 0000000000000000

Allocated by task 7203:
 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:757 [inline]
 kvzalloc include/linux/mm.h:765 [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:9856
 alloc_apic_access_page arch/x86/kvm/vmx/vmx.c:3540 [inline]
 vmx_create_vcpu+0x2107/0x2b40 arch/x86/kvm/vmx/vmx.c:6799
 kvm_arch_vcpu_create+0x6ef/0xb80 arch/x86/kvm/x86.c:9376
 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 0:
(stack is not available)

The buggy address belongs to the object at ffff8880a60a4000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 1128 bytes inside of
 2048-byte region [ffff8880a60a4000, ffff8880a60a4800)
The buggy address belongs to the page:
page:ffffea0002982900 refcount:1 mapcount:0 mapping:00000000ae817ae2 index:0x0
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea00027ddf08 ffffea000298c488 ffff8880aa000e00
raw: 0000000000000000 ffff8880a60a4000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a60a4300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880a60a4380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880a60a4400: 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc
                                                          ^
 ffff8880a60a4480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880a60a4500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (24153):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/04/22 13:08 upstream 189522da8b3a 2e44d63e .config console log report syz C ci-upstream-kasan-gce-root
2020/04/09 15:49 upstream ae46d2aa6a7f a8c6a3f8 .config console log report syz C ci-upstream-kasan-gce
2020/04/09 15:17 upstream ae46d2aa6a7f a8c6a3f8 .config console log report syz C ci-upstream-kasan-gce
2020/04/09 09:25 upstream ae46d2aa6a7f a8c6a3f8 .config console log report syz C ci-upstream-kasan-gce
2020/04/03 15:50 upstream bef7b2a7be28 5ed396e6 .config console log report syz C ci-upstream-kasan-gce-selinux-root
2020/04/03 15:42 upstream bef7b2a7be28 5ed396e6 .config console log report syz C ci-upstream-kasan-gce-smack-root
2020/04/03 14:09 upstream bef7b2a7be28 5ed396e6 .config console log report syz C ci-upstream-kasan-gce-root
2020/04/03 13:19 upstream bef7b2a7be28 5ed396e6 .config console log report syz C ci-upstream-kasan-gce
2020/04/12 14:28 upstream b032227c6293 36b0b050 .config console log report syz C ci-upstream-kasan-gce-386
2020/04/12 11:08 upstream b032227c6293 a8c6a3f8 .config console log report syz C ci-upstream-kasan-gce-386
2020/04/12 07:49 upstream b032227c6293 a8c6a3f8 .config console log report syz C ci-upstream-kasan-gce-386
2020/04/12 07:26 upstream b032227c6293 a8c6a3f8 .config console log report syz C ci-upstream-kasan-gce-386
2020/04/08 07:04 upstream 763dede1b248 db9bcd4b .config console log report syz C ci-upstream-kasan-gce-386
2020/04/29 01:41 linux-next ac935d227366 e3ecea2e .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2020/04/29 01:23 linux-next ac935d227366 e3ecea2e .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2020/04/28 21:12 linux-next ac935d227366 e3ecea2e .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2020/04/28 20:32 linux-next ac935d227366 e3ecea2e .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2020/04/24 22:20 linux-next ac935d227366 03d97a1b .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2020/04/14 15:24 upstream 8f3d9f354286 3f3c5574 .config console log report syz ci-upstream-kasan-gce-root
2020/04/03 16:26 upstream bef7b2a7be28 5ed396e6 .config console log report syz ci-upstream-kasan-gce-386
2020/04/22 13:26 upstream 189522da8b3a 2e44d63e .config console log report ci-upstream-kasan-gce-root
2020/04/22 13:02 upstream 189522da8b3a 2e44d63e .config console log report ci-upstream-kasan-gce-selinux-root
2020/04/22 12:46 upstream 189522da8b3a 2e44d63e .config console log report ci-upstream-kasan-gce
2020/04/22 10:22 upstream 189522da8b3a 2e44d63e .config console log report ci-upstream-kasan-gce-smack-root
2020/04/22 12:01 upstream 189522da8b3a 2e44d63e .config console log report ci-upstream-kasan-gce-386
2020/04/03 10:51 upstream bef7b2a7be28 5ed396e6 .config console log report ci-upstream-kasan-gce-386
2020/05/22 15:17 linux-next ac935d227366 5afa2ddd .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/22 14:09 linux-next ac935d227366 5afa2ddd .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/22 13:58 linux-next ac935d227366 5afa2ddd .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/22 12:36 linux-next ac935d227366 5afa2ddd .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/22 11:28 linux-next ac935d227366 5afa2ddd .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/22 10:48 linux-next ac935d227366 5afa2ddd .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/22 09:39 linux-next ac935d227366 5afa2ddd .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/22 08:58 linux-next ac935d227366 5afa2ddd .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/22 07:25 linux-next ac935d227366 5afa2ddd .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/22 06:25 linux-next ac935d227366 5afa2ddd .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/22 05:14 linux-next ac935d227366 5afa2ddd .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/22 05:12 linux-next ac935d227366 5afa2ddd .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/22 04:02 linux-next ac935d227366 5afa2ddd .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/22 02:31 linux-next ac935d227366 5afa2ddd .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/22 01:05 linux-next ac935d227366 1f30020f .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/22 00:32 linux-next ac935d227366 1f30020f .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 23:27 linux-next ac935d227366 1f30020f .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 22:26 linux-next ac935d227366 1f30020f .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 21:26 linux-next ac935d227366 1f30020f .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 20:50 linux-next ac935d227366 1f30020f .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 20:38 linux-next ac935d227366 1f30020f .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 19:36 linux-next ac935d227366 1f30020f .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 19:09 linux-next ac935d227366 1f30020f .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 18:07 linux-next ac935d227366 1f30020f .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 16:46 linux-next ac935d227366 1f30020f .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 16:04 linux-next ac935d227366 1f30020f .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 15:02 linux-next ac935d227366 1f30020f .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 14:15 linux-next ac935d227366 1f30020f .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 13:24 linux-next ac935d227366 1f30020f .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 12:16 linux-next ac935d227366 1f30020f .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 10:43 linux-next ac935d227366 c61086ab .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 10:39 linux-next ac935d227366 c61086ab .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 09:19 linux-next ac935d227366 c61086ab .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 08:17 linux-next ac935d227366 c61086ab .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 07:38 linux-next ac935d227366 c61086ab .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 06:26 linux-next ac935d227366 c61086ab .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 06:09 linux-next ac935d227366 c61086ab .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 05:05 linux-next ac935d227366 c61086ab .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 04:59 linux-next ac935d227366 c61086ab .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 03:51 linux-next ac935d227366 c61086ab .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 03:26 linux-next ac935d227366 c61086ab .config console log report ci-upstream-linux-next-kasan-gce-root
2020/05/21 02:25 linux-next ac935d227366 c61086ab .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.