]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: nVMX: Remove support for "early" consistency checks via hardware
authorSean Christopherson <seanjc@google.com>
Fri, 19 Sep 2025 00:59:54 +0000 (17:59 -0700)
committerSean Christopherson <seanjc@google.com>
Fri, 17 Oct 2025 22:11:27 +0000 (15:11 -0700)
commita175da6d430ef7f8e24153e44c59ab6903e20f97
tree3965fb94b2edab9747a8446847225edb77fe4cc7
parentf91699d5692ddd0ee92b9487014fc477179ab3a7
KVM: nVMX: Remove support for "early" consistency checks via hardware

Remove nested_early_check and all associated code, as it's quite obviously
not being used or tested (it's been broken for 4+ years without a single
bug report).  More importantly, KVM's software-based consistency checks
have matured since the option to do hardware-based checks was added; KVM
appears to be missing only _one_ consistency check, on vTPR.  And even
*more* importantly, that consistency check can't be prevented by an early
hardware check due to L1 being able to modify the virtual APIC at any
time, i.e. there's an inherent TOCTOU flaw that could cause KVM to "miss"
a consistency check VM-Fail, regardless of whether the check is performed
by software or by hardware.

In other words, KVM _must_ be able to unwind from a late VM-Fail (which
was a big motivation for doing early checks).  I.e. now that KVM provides
(almost) all necessary consistency checks, what's really needed is a way
to detect missing checks in KVM, not a way to avoid having to unwind from
a late VM-Fail.  And that can be done much more simply, e.g. by an simple
module param to guard a WARN (which, sadly, must be off-by-default to
avoid splats due to the aforementioned TOCTOU issue).

For all intents and purposes, this reverts commit 52017608da33 ("KVM:
nVMX: add option to perform early consistency checks via H/W").

Link: https://lore.kernel.org/r/20250919005955.1366256-9-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/vmx/nested.c