[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] x86/nestedsvm: Inject #UD for not-intercepted VMMCALL


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
  • Date: Fri, 20 Nov 2026 11:11:11 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LQcj2z2LkRdrjxPr8x4xYgvUyG2/EcmvGz87ZVciWxc=; b=W/SnVa/rMgCdUxxfQUayDF9NaPpgVUBXo3MKqtUC4zVvpVPbXDasFeArvnyHqE37g4VStaDjUs0GCahxmnwtQME1RzySGeKLAJCJ4AnB5TVukr5JvLlAraxwmEeCadpFq8nN+m2Itq0V7xyBv93Gy6d1cDJPZi3mjtFxPB7Ozx7JE0aqa78kLDiipR/eo1r2X/9/BRUz8ICQ7uWuquJx2PfIHzcE/0pwb06CTYuz8yynA3gycw5nmYeFBWOaLhCwwxc0aH1uuleOu48oaxyNLn/kai8goqH8aZRdtTX9APOeavo1LjWcNxhDgISp9yzeFIjpJKAnmwDt/myFmuiZQQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ISo+u4erfQ2gOqdWBzuF2cesBXBBa4KtrAl+YBQLbpnYxIhZIi3/prOuW3bEz/pGja3R4qsggMrGPsLFmba8tX9Bc5NNMzT4LXvA6JmUQH47zwyMo/W+bpJAZ/7LBzrtBNhhNElCCIeQlKcTZGE0xA2W5S4wYos4f9ei3zglFPitbENsx+oE8mmNC8yAXrpQsovka1Vxvnai/c63z0K05jj02EZBZ3a/EhQ50B6aR25PaPAh6x3G8fTS8Mqo2F+xpagboptp/ZqTZeSNj9LoAafw8KMnzr8HNr7XHdtFM3k74N5aYW8BpE4g5DFt1XB8Gmqotu7Y/Dd6eQwUCTEssg==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>
  • Delivery-date: Fri, 20 Nov 2026 11:11:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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 <ross.lagerwall@xxxxxxxxxx>
---
 xen/arch/x86/hvm/svm/nestedsvm.c | 3 ---
 xen/arch/x86/hvm/svm/svm.c       | 7 ++++++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index 366178ff54a7..7bc5710c8294 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -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;
     }
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index bfca1eda4af5..ef42d5eb981d 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -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 )
-- 
2.56.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.