]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: VMX: Extract checking of guest's DEBUGCTL into helper
authorSean Christopherson <seanjc@google.com>
Fri, 15 Aug 2025 00:25:37 +0000 (17:25 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:28:13 +0000 (16:28 +0200)
commitd1e28ef79b4363f154d04b282dcd3b00caffc752
tree0bb1e7d0b526b451cc8d98b9bdbb1c6b36bb0e93
parent48ebed8bd66b13e80e6c3259d2ba3de221550260
KVM: VMX: Extract checking of guest's DEBUGCTL into helper

[ Upstream commit 8a4351ac302cd8c19729ba2636acfd0467c22ae8 ]

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
Stable-dep-of: 7d0cce6cbe71 ("KVM: VMX: Wrap all accesses to IA32_DEBUGCTL with getter/setter APIs")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kvm/vmx/vmx.c