FAILED: patch "[PATCH] KVM: x86: nSVM: harden svm_free_nested against freeing vmcb02" failed to apply to 5.10-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Possible dependencies:
16ae56d7e052 ("KVM: x86: nSVM: harden svm_free_nested against freeing vmcb02 while still in use")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 16ae56d7e0528559bf8dc9070e3bfd8ba3de80df Mon Sep 17 00:00:00 2001
From: Maxim Levitsky <[email protected]>
Date: Thu, 3 Nov 2022 16:13:44 +0200
Subject: [PATCH] KVM: x86: nSVM: harden svm_free_nested against freeing vmcb02
while still in use
Make sure that KVM uses vmcb01 before freeing nested state, and warn if that is not the case.
This is a minimal fix for CVE-2022-3344 making the kernel print a warning instead of a kernel panic.
Message-Id: <[email protected]>
arch/x86/kvm/svm/nested.c +3 -0
@@ -1125,6 +1125,9 @@ void svm_free_nested(struct vcpu_svm *svm)if (!svm->nested.initialized)return ; +if (WARN_ON_ONCE (svm->vmcb != svm->vmcb01.ptr)) +svm_switch_vmcb (svm, &svm->vmcb01); +svm_vcpu_free_msrpm (svm->nested.msrpm); svm->nested.msrpm =NULL ;