]> git.proxmox.com Git - pve-kernel.git/blob - patches/kernel/0010-Revert-nSVM-Check-for-reserved-encodings-of-TLB_CONT.patch
3b93ded8b37f651223bbb037d30cd53db308f901
[pve-kernel.git] / patches / kernel / 0010-Revert-nSVM-Check-for-reserved-encodings-of-TLB_CONT.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Sean Christopherson <seanjc@google.com>
3 Date: Wed, 18 Oct 2023 12:41:03 -0700
4 Subject: [PATCH] Revert "nSVM: Check for reserved encodings of TLB_CONTROL in
5 nested VMCB"
6
7 Revert KVM's made-up consistency check on SVM's TLB control. The APM says
8 that unsupported encodings are reserved, but the APM doesn't state that
9 VMRUN checks for a supported encoding. Unless something is called out
10 in "Canonicalization and Consistency Checks" or listed as MBZ (Must Be
11 Zero), AMD behavior is typically to let software shoot itself in the foot.
12
13 This reverts commit 174a921b6975ef959dd82ee9e8844067a62e3ec1.
14
15 Fixes: 174a921b6975 ("nSVM: Check for reserved encodings of TLB_CONTROL in nested VMCB")
16 Reported-by: Stefan Sterz <s.sterz@proxmox.com>
17 Closes: https://lkml.kernel.org/r/b9915c9c-4cf6-051a-2d91-44cc6380f455%40proxmox.com
18 Cc: stable@vger.kernel.org
19 Signed-off-by: Sean Christopherson <seanjc@google.com>
20 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
21 ---
22 arch/x86/kvm/svm/nested.c | 15 ---------------
23 1 file changed, 15 deletions(-)
24
25 diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
26 index 36482780a42f..43481f26a34b 100644
27 --- a/arch/x86/kvm/svm/nested.c
28 +++ b/arch/x86/kvm/svm/nested.c
29 @@ -247,18 +247,6 @@ static bool nested_svm_check_bitmap_pa(struct kvm_vcpu *vcpu, u64 pa, u32 size)
30 kvm_vcpu_is_legal_gpa(vcpu, addr + size - 1);
31 }
32
33 -static bool nested_svm_check_tlb_ctl(struct kvm_vcpu *vcpu, u8 tlb_ctl)
34 -{
35 - /* Nested FLUSHBYASID is not supported yet. */
36 - switch(tlb_ctl) {
37 - case TLB_CONTROL_DO_NOTHING:
38 - case TLB_CONTROL_FLUSH_ALL_ASID:
39 - return true;
40 - default:
41 - return false;
42 - }
43 -}
44 -
45 static bool __nested_vmcb_check_controls(struct kvm_vcpu *vcpu,
46 struct vmcb_ctrl_area_cached *control)
47 {
48 @@ -278,9 +266,6 @@ static bool __nested_vmcb_check_controls(struct kvm_vcpu *vcpu,
49 IOPM_SIZE)))
50 return false;
51
52 - if (CC(!nested_svm_check_tlb_ctl(vcpu, control->tlb_ctl)))
53 - return false;
54 -
55 if (CC((control->int_ctl & V_NMI_ENABLE_MASK) &&
56 !vmcb12_is_intercept(control, INTERCEPT_NMI))) {
57 return false;