syzbot


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

Status: closed as dup on 2020/04/10 17:50
Subsystems: kvm
[Documentation on labels]
Reported-by: syzbot+25a50e1a4e196faed650@syzkaller.appspotmail.com
First crash: 1423d, last: 1407d
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 1380d 1424d
Discussions (1)
Title Replies (including bot) Last reply
KASAN: slab-out-of-bounds Read in gfn_to_pfn 1 (2) 2020/04/10 17:50

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 gfn_to_memslot arch/x86/kvm/../../../virt/kvm/kvm_main.c:1597 [inline]
BUG: KASAN: slab-out-of-bounds in gfn_to_pfn+0x4a6/0x4c0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1977
Read of size 8 at addr ffff8880909b7468 by task syz-executor.2/11939

CPU: 1 PID: 11939 Comm: syz-executor.2 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]
 gfn_to_memslot arch/x86/kvm/../../../virt/kvm/kvm_main.c:1597 [inline]
 gfn_to_pfn+0x4a6/0x4c0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1977
 reexecute_instruction arch/x86/kvm/x86.c:6532 [inline]
 reexecute_instruction+0x1fa/0x430 arch/x86/kvm/x86.c:6497
 x86_emulate_instruction+0x880/0x1c50 arch/x86/kvm/x86.c:6806
 kvm_mmu_page_fault+0x308/0x15d0 arch/x86/kvm/mmu/mmu.c:5495
 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:0x45c829
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:00007f53b2fffc78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000004e7ac0 RCX: 000000000045c829
RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 0000000000000005
RBP: 000000000078bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000000003c0 R14: 00000000004c6499 R15: 00007f53b30006d4

Allocated by task 11939:
 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
 kvm_set_memory_region+0x29/0x50 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1321
 kvm_vm_ioctl_set_memory_region arch/x86/kvm/../../../virt/kvm/kvm_main.c:1333 [inline]
 kvm_vm_ioctl+0x678/0x23e0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3604
 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 4115:
 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
 rcu_do_batch kernel/rcu/tree.c:2206 [inline]
 rcu_core+0x59f/0x1370 kernel/rcu/tree.c:2433
 __do_softirq+0x26c/0x9f7 kernel/softirq.c:292

The buggy address belongs to the object at ffff8880909b7000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 1128 bytes inside of
 2048-byte region [ffff8880909b7000, ffff8880909b7800)
The buggy address belongs to the page:
page:ffffea0002426dc0 refcount:1 mapcount:0 mapping:000000000fa41c08 index:0x0
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea000250f248 ffffea00029b6688 ffff8880aa000e00
raw: 0000000000000000 ffff8880909b7000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880909b7300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880909b7380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880909b7400: 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc
                                                          ^
 ffff8880909b7480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880909b7500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/04/22 01:22 upstream 189522da8b3a 2e44d63e .config console log report ci-upstream-kasan-gce-root
2020/04/14 03:53 upstream 8f3d9f354286 7c54686a .config console log report ci-upstream-kasan-gce
2020/04/12 22:23 upstream 4f8a3cc1183c 36b0b050 .config console log report ci-upstream-kasan-gce
2020/04/08 20:19 upstream f5e94d10e4c4 db9bcd4b .config console log report ci-upstream-kasan-gce
2020/04/22 09:39 upstream 189522da8b3a 2e44d63e .config console log report ci-upstream-kasan-gce-386
2020/04/15 05:40 upstream 8632e9b5645b 3f3c5574 .config console log report ci-upstream-kasan-gce-386
2020/04/25 00:42 linux-next ac935d227366 03d97a1b .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.