]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: SVM: Suppress DEBUGCTL.BTF on AMD
authorSean Christopherson <seanjc@google.com>
Thu, 27 Feb 2025 22:24:07 +0000 (14:24 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 12:02:14 +0000 (13:02 +0100)
commit6622db50d800ec0091db3acee54c64b2f60e6962
tree651ae43788492db47922babe2491f0dda73bddde
parent941135a335e9a896d22c9db8f1cd4add072ade9f
KVM: SVM: Suppress DEBUGCTL.BTF on AMD

commit d0eac42f5cecce009d315655bee341304fbe075e upstream.

Mark BTF as reserved in DEBUGCTL on AMD, as KVM doesn't actually support
BTF, and fully enabling BTF virtualization is non-trivial due to
interactions with the emulator, guest_debug, #DB interception, nested SVM,
etc.

Don't inject #GP if the guest attempts to set BTF, as there's no way to
communicate lack of support to the guest, and instead suppress the flag
and treat the WRMSR as (partially) unsupported.

In short, make KVM behave the same on AMD and Intel (VMX already squashes
BTF).

Note, due to other bugs in KVM's handling of DEBUGCTL, the only way BTF
has "worked" in any capacity is if the guest simultaneously enables LBRs.

Reported-by: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: stable@vger.kernel.org
Reviewed-and-tested-by: Ravi Bangoria <ravi.bangoria@amd.com>
Link: https://lore.kernel.org/r/20250227222411.3490595-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/svm/svm.c
arch/x86/kvm/svm/svm.h