]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.4
authorSasha Levin <sashal@kernel.org>
Thu, 12 Nov 2020 17:05:31 +0000 (12:05 -0500)
committerSasha Levin <sashal@kernel.org>
Thu, 12 Nov 2020 17:05:31 +0000 (12:05 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-5.4/kvm-x86-don-t-expose-msr_ia32_umwait_control-uncondi.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/kvm-x86-don-t-expose-msr_ia32_umwait_control-uncondi.patch b/queue-5.4/kvm-x86-don-t-expose-msr_ia32_umwait_control-uncondi.patch
new file mode 100644 (file)
index 0000000..a58277f
--- /dev/null
@@ -0,0 +1,49 @@
+From 2f35b382f217b0d35d8d7e5ab185d4c5f0e05ac6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 11 Nov 2020 14:20:47 +0100
+Subject: KVM: x86: don't expose MSR_IA32_UMWAIT_CONTROL unconditionally
+
+From: Maxim Levitsky <mlevitsk@redhat.com>
+
+[ Upstream commit f4cfcd2d5aea4e96c5d483c476f3057b6b7baf6a ]
+
+This msr is only available when the host supports WAITPKG feature.
+
+This breaks a nested guest, if the L1 hypervisor is set to ignore
+unknown msrs, because the only other safety check that the
+kernel does is that it attempts to read the msr and
+rejects it if it gets an exception.
+
+Cc: stable@vger.kernel.org
+Fixes: 6e3ba4abce ("KVM: vmx: Emulate MSR IA32_UMWAIT_CONTROL")
+Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
+Message-Id: <20200523161455.3940-3-mlevitsk@redhat.com>
+Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+(cherry picked from commit f4cfcd2d5aea4e96c5d483c476f3057b6b7baf6a
+use boot_cpu_has for checking the feature)
+Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
+Acked-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/kvm/x86.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
+index 12e83297ea020..880a24889291c 100644
+--- a/arch/x86/kvm/x86.c
++++ b/arch/x86/kvm/x86.c
+@@ -5235,6 +5235,10 @@ static void kvm_init_msr_list(void)
+                       if (!kvm_x86_ops->rdtscp_supported())
+                               continue;
+                       break;
++              case MSR_IA32_UMWAIT_CONTROL:
++                      if (!boot_cpu_has(X86_FEATURE_WAITPKG))
++                              continue;
++                      break;
+               case MSR_IA32_RTIT_CTL:
+               case MSR_IA32_RTIT_STATUS:
+                       if (!kvm_x86_ops->pt_supported())
+-- 
+2.27.0
+
index f392b8a2b9df77f9831072e6d9b9ef01ffb5ada8..adabace33c38eda2467f695e0a116d3a348d8ef3 100644 (file)
@@ -41,3 +41,4 @@ xfs-fix-scrub-flagging-rtinherit-even-if-there-is-no.patch
 tpm-efi-don-t-create-binary_bios_measurements-file-f.patch
 random32-make-prandom_u32-output-unpredictable.patch
 kvm-arm64-arm_smccc_arch_workaround_1-doesn-t-return-smccc_ret_not_required.patch
+kvm-x86-don-t-expose-msr_ia32_umwait_control-uncondi.patch