syzbot


general protection fault in gfn_to_rmap (2)

Status: fixed on 2021/11/10 00:50
Subsystems: kvm
[Documentation on labels]
Reported-by: syzbot+fb0b6a7e8713aeb0319c@syzkaller.appspotmail.com
Fix commit: 78fcb2c91adf KVM: x86: Immediately reset the MMU context when the SMM flag is cleared
First crash: 1218d, last: 1218d
Cause bisection: introduced by (bisect log) :
commit 9ec19493fb86d6d5fbf9286b94ff21e56ef66376
Author: Sean Christopherson <sean.j.christopherson@intel.com>
Date: Tue Apr 2 15:03:11 2019 +0000

  KVM: x86: clear SMM flags before loading state while leaving SMM

Crash: general protection fault in gfn_to_rmap (log)
Repro: C syz .config
  
Discussions (5)
Title Replies (including bot) Last reply
[PATCH 5.10 000/146] 5.10.46-rc1 review 164 (164) 2021/06/27 08:57
[PATCH 5.12 000/178] 5.12.13-rc1 review 185 (185) 2021/06/23 15:12
[PATCH 5.4 00/90] 5.4.128-rc1 review 97 (97) 2021/06/22 23:59
[PATCH 0/9] KVM: x86: Fix NULL pointer #GP due to RSM bug 18 (18) 2021/06/11 11:42
[syzbot] general protection fault in gfn_to_rmap (2) 1 (2) 2021/06/08 16:48
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream general protection fault in gfn_to_rmap syz 7 2423d 2533d 5/28 fixed on 2018/05/17 19:21

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.
general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
CPU: 1 PID: 8410 Comm: syz-executor382 Not tainted 5.13.0-rc5-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:__gfn_to_rmap arch/x86/kvm/mmu/mmu.c:935 [inline]
RIP: 0010:gfn_to_rmap+0x2b0/0x4d0 arch/x86/kvm/mmu/mmu.c:947
Code: 00 00 00 00 00 fc ff df 48 8b 5c 24 10 48 8b 44 24 08 42 8a 04 20 84 c0 0f 85 a9 01 00 00 8b 2b 83 e5 0f 4c 89 f8 48 c1 e8 03 <42> 80 3c 20 00 74 08 4c 89 ff e8 f1 79 a9 00 4c 89 fb 4d 8b 37 44
RSP: 0018:ffffc90000ffef98 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff888015b9f414 RCX: ffff888019669c40
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001
RBP: 0000000000000001 R08: ffffffff811d9cdb R09: ffffed10065a6002
R10: ffffed10065a6002 R11: 0000000000000000 R12: dffffc0000000000
R13: 0000000000000003 R14: 0000000000000001 R15: 0000000000000000
FS:  000000000124b300(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 0000000028e31000 CR4: 00000000001526e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 rmap_add arch/x86/kvm/mmu/mmu.c:965 [inline]
 mmu_set_spte+0x862/0xe60 arch/x86/kvm/mmu/mmu.c:2604
 __direct_map arch/x86/kvm/mmu/mmu.c:2862 [inline]
 direct_page_fault+0x1f74/0x2b70 arch/x86/kvm/mmu/mmu.c:3769
 kvm_mmu_do_page_fault arch/x86/kvm/mmu.h:124 [inline]
 kvm_mmu_page_fault+0x199/0x1440 arch/x86/kvm/mmu/mmu.c:5065
 vmx_handle_exit+0x26/0x160 arch/x86/kvm/vmx/vmx.c:6122
 vcpu_enter_guest+0x3bdd/0x9630 arch/x86/kvm/x86.c:9428
 vcpu_run+0x416/0xc20 arch/x86/kvm/x86.c:9494
 kvm_arch_vcpu_ioctl_run+0x4e8/0xa40 arch/x86/kvm/x86.c:9722
 kvm_vcpu_ioctl+0x70f/0xbb0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3460
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:1069 [inline]
 __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:1055
 do_syscall_64+0x3f/0xb0 arch/x86/entry/common.c:47
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x440ce9
Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 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 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffeee792908 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000400488 RCX: 0000000000440ce9
RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 0000000000000005
RBP: 00000000004047e0 R08: 0000000000400488 R09: 0000000000400488
R10: 0000000000400488 R11: 0000000000000246 R12: 0000000000404870
R13: 0000000000000000 R14: 00000000004b0018 R15: 0000000000400488
Modules linked in:
---[ end trace 41422839215ce938 ]---
RIP: 0010:__gfn_to_rmap arch/x86/kvm/mmu/mmu.c:935 [inline]
RIP: 0010:gfn_to_rmap+0x2b0/0x4d0 arch/x86/kvm/mmu/mmu.c:947
Code: 00 00 00 00 00 fc ff df 48 8b 5c 24 10 48 8b 44 24 08 42 8a 04 20 84 c0 0f 85 a9 01 00 00 8b 2b 83 e5 0f 4c 89 f8 48 c1 e8 03 <42> 80 3c 20 00 74 08 4c 89 ff e8 f1 79 a9 00 4c 89 fb 4d 8b 37 44
RSP: 0018:ffffc90000ffef98 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff888015b9f414 RCX: ffff888019669c40
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001
RBP: 0000000000000001 R08: ffffffff811d9cdb R09: ffffed10065a6002
R10: ffffed10065a6002 R11: 0000000000000000 R12: dffffc0000000000
R13: 0000000000000003 R14: 0000000000000001 R15: 0000000000000000
FS:  000000000124b300(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 0000000028e31000 CR4: 00000000001526e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/06/07 22:48 upstream 614124bea77e e59537be .config console log report syz C ci-upstream-kasan-gce-smack-root general protection fault in gfn_to_rmap
* Struck through repros no longer work on HEAD.