x86/nestedsvm: Inject #UD for not-intercepted VMMCALL
PATCH 1/1 x86/nestedsvm: Inject #UD for not-intercepted VMMCALL
Rather than always forwarding VMMCALL to L1, follow the APM Vol 2 Rev 3.46 15.18 "VMMCALL Instruction" and inject #UD for a not-intercepted VMMCALL.
Signed-off-by Ross Lagerwall <[email protected]>
--- xen/arch/x86/hvm/svm/nestedsvm.c | 3 --- xen/arch/x86/hvm/svm/svm.c | 7 ++++++- 2 files changed, 6 insertions(+), 4 deletions(-)
xen/arch/x86/hvm/svm/nestedsvm.c +0 -3
@@ -1261,9 +1261,6 @@ nestedsvm_check_intercepts(struct vcpu *v, struct cpu_user_regs *regs,return NESTEDHVM_VMEXIT_HOST ;return NESTEDHVM_VMEXIT_INJECT ; -case VMEXIT_VMMCALL : -/* Always let the guest handle VMMCALL/VMCALL */ -return NESTEDHVM_VMEXIT_INJECT ;default :break ; }
xen/arch/x86/hvm/svm/svm.c +6 -1
@@ -2924,9 +2924,14 @@ void asmlinkage svm_vmexit_handler(void)break ;case VMEXIT_VMMCALL : +if ( vcpu_guestmode ) + { +hvm_inject_hw_exception (X86_EXC_UD ,X86_EVENT_NO_EC ); +break ; + } +if ( (insn_len =svm_get_insn_len (v,INSTR_VMCALL )) ==0 )break ; -BUG_ON (vcpu_guestmode);TRACE (TRC_HVM_VMMCALL , regs->eax);if (hvm_hypercall (regs) == HVM_HCALL_completed )
Signature · 1 line
2.56.0
Quoted 5 lines · Ross Lagerwall
Rather than always forwarding VMMCALL to L1, follow the APM Vol 2 Rev 3.46 15.18 "VMMCALL Instruction" and inject #UD for a not-intercepted VMMCALL.
Signed-off-by Ross Lagerwall <[email protected]>
Reviewed-by Andrew Cooper <[email protected]>
Le 20/11/2026 à 12:11, Ross Lagerwall a écrit :
Quoted 34 lines
Rather than always forwarding VMMCALL to L1, follow the APM Vol 2 Rev 3.46 15.18 "VMMCALL Instruction" and inject #UD for a not-intercepted VMMCALL.
Signed-off-by Ross Lagerwall <[email protected]>--- xen/arch/x86/hvm/svm/nestedsvm.c | 3 --- xen/arch/x86/hvm/svm/svm.c | 7 ++++++- 2 files changed, 6 insertions(+), 4 deletions(-)xen/arch/x86/hvm/svm/nestedsvm.c +0
-3@@ -1261,9 +1261,6 @@ nestedsvm_check_intercepts(struct vcpu *v, struct cpu_user_regs *regs,return NESTEDHVM_VMEXIT_HOST ;return NESTEDHVM_VMEXIT_INJECT ; -case VMEXIT_VMMCALL : -/* Always let the guest handle VMMCALL/VMCALL */ -return NESTEDHVM_VMEXIT_INJECT ;default :break ; }xen/arch/x86/hvm/svm/svm.c +2
-0@@ -2924,9 +2924,14 @@ void asmlinkage svm_vmexit_handler(void)break ;case VMEXIT_VMMCALL : +if ( vcpu_guestmode ) + {
xen/arch/x86/hvm/svm/svm.c void asmlinkage svm_vmexit_handler(void) · line 2937
Quoted 10 lines
xen/arch/x86/hvm/svm/svm.c +4
-1+hvm_inject_hw_exception (X86_EXC_UD ,X86_EVENT_NO_EC ); +break ; + } +if ( (insn_len =svm_get_insn_len (v,INSTR_VMCALL )) ==0 )break ; -BUG_ON (vcpu_guestmode);TRACE (TRC_HVM_VMMCALL , regs->eax);if (hvm_hypercall (regs) == HVM_HCALL_completed )
Reviewed-by Teddy Astie <[email protected]>
Teddy