]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: VMX: Extract checking of guest's DEBUGCTL into helper
authorSean Christopherson <seanjc@google.com>
Tue, 10 Jun 2025 23:20:07 +0000 (16:20 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Aug 2025 16:36:34 +0000 (18:36 +0200)
commitd3ac7088014646651ef672fbe7a75c0fe41c2d65
tree8a9b41531f6cdcaa10159e032104d36328467b22
parent42ebc16d9d2563f1a1ce0f05b643ee68d54fabf8
KVM: VMX: Extract checking of guest's DEBUGCTL into helper

commit 8a4351ac302cd8c19729ba2636acfd0467c22ae8 upstream.

Move VMX's logic to check DEBUGCTL values into a standalone helper so that
the code can be used by nested VM-Enter to apply the same logic to the
value being loaded from vmcs12.

KVM needs to explicitly check vmcs12->guest_ia32_debugctl on nested
VM-Enter, as hardware may support features that KVM does not, i.e. relying
on hardware to detect invalid guest state will result in false negatives.
Unfortunately, that means applying KVM's funky suppression of BTF and LBR
to vmcs12 so as not to break existing guests.

No functional change intended.

Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Link: https://lore.kernel.org/r/20250610232010.162191-6-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Stable-dep-of: 095686e6fcb4 ("KVM: nVMX: Check vmcs12->guest_ia32_debugctl on nested VM-Enter")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/vmx/vmx.c