From: Kevin Cheng commit d99df02ff427f461102230f9c5b90a6c64ee8e23 upstream. INVLPGA should cause a #UD when EFER.SVME is not set. Add a check to properly inject #UD when EFER.SVME=0. Fixes: ff092385e828 ("KVM: SVM: Implement INVLPGA") Cc: stable@vger.kernel.org Signed-off-by: Kevin Cheng Reviewed-by: Yosry Ahmed Link: https://patch.msgid.link/20260228033328.2285047-3-chengkev@google.com [sean: tag for stable@] Signed-off-by: Sean Christopherson [ adapted to 5.10.y-cip: pass the vcpu_svm argument to the branch's permission helper ] Signed-off-by: Dickson Wu --- The 5.10 nested SVM permission helper takes a struct vcpu_svm pointer. The backport passes that pointer from the INVLPGA handler. Tested on 5.10.272-cip79: arch/x86/kvm/svm/svm.o built with W=1 before and after the patch, with no new diagnostics. The same paired build passed on the 5.10.275-cip80 tip. On v5.10.275, svm_vmcall_test passed in a QEMU TCG EPYC guest and skipped in the Intel/KVM guest. The runtime test was not rerun on the CIP tip. The backport and the test runs were prepared with AI coding tools (OpenAI Codex agents, with review by Claude). I went over the result before signing off. --- arch/x86/kvm/svm/svm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 41a4ee2aaa4c..f7862a5b686f 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -2162,6 +2162,9 @@ static int invlpga_interception(struct vcpu_svm *svm) { struct kvm_vcpu *vcpu = &svm->vcpu; + if (nested_svm_check_permissions(svm)) + return 1; + trace_kvm_invlpga(svm->vmcb->save.rip, kvm_rcx_read(&svm->vcpu), kvm_rax_read(&svm->vcpu)); --- base-commit: bd8b111cdf1d9897bf4d826b7305a9c16bfe5f71 change-id: 20261127-cip-svm-510-ded22c7b8ef0 Best regards, -- Dickson Wu