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

[PATCH v5 2/5] x86/hvm: Disable cross-vendor handling in #UD handler


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
  • Date: Thu, 12 Mar 2026 12:21:11 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=wv5wvI380mS69M5JH7UHNf7qmRDw4qiA/tgGNcS4cFM=; b=feBmPoti15B5Q4AoZ1DKIEngV8URAIk6B44RRlrlEsJG+44j/1+t9l5lyQ8+xStRVkEfGsLKYfXMt1AFbw6iKnQK+oZalzQdOVFmh8chw4ImRZK5NZahB6pN3jsIOjrrafjKoBMNAY6GAU6Ld20MsoOl52JTY82IVSJeSyU9wMu+BSOpDK6AcoYPGXYnx872p2ugwsIJkT/qIWxkpp50ah1Mt3dsCoOw+mcfJeWlqzJD/kF7q/rvuuCIT928cT3tmqSS/64hMU0aZh0MOUQxyve5DwU2Am0YIIqUMzhOhHBaDPBFuqvwzvw3wGnPXpeXGhhdw0q4ke8Xpz1o0JDQZg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pzFx4z92leE4X94xzu6vXFjM59CEBxe0fnTSy0wdRI6obVtU+DxheYnlV+yBGahDO0Uk6qZUL2RQWDcog3MxdadXcqWdBo6NnSVwTpAHVvDpf9OFRI/T+T6mLs7afU6r3IFI28zD6aklfsRz+mHDKd607I8Z834/afqFdCO9qwIvfbbOJsGyxLdY6Wp+u5SrvhrFEaBL+liuR8E0hSvOKTw7F6b+StW+yYgdVvsYp2mSPSn40F5YBsMjPaYVlmOm2P1633CIDIwhCYjDpURHd2H+b9y+6WpX8aj/5ASuAIB8nTRNV/BOKR1+jIiNXHfajSj9O6H6Ri/QhfEeYgbqeA==
  • Cc: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>
  • Delivery-date: Thu, 12 Mar 2026 11:21:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Remove cross-vendor support now that VMs can no longer have a different
vendor than the host.

No functional change intended.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
---
v5:
  * This patch now performs a minimal diff, with the other parts appended
    to the tail of the series.
---
 xen/arch/x86/hvm/hvm.c     | 19 ++-----------------
 xen/arch/x86/hvm/svm/svm.c |  3 +--
 xen/arch/x86/hvm/vmx/vmx.c |  3 +--
 3 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 4d37a93c57a..c8cae41705d 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3832,28 +3832,13 @@ int hvm_descriptor_access_intercept(uint64_t exit_info,
     return X86EMUL_OKAY;
 }
 
-static bool cf_check is_cross_vendor(
-    const struct x86_emulate_state *state, const struct x86_emulate_ctxt *ctxt)
-{
-    switch ( ctxt->opcode )
-    {
-    case X86EMUL_OPC(0x0f, 0x05): /* syscall */
-    case X86EMUL_OPC(0x0f, 0x34): /* sysenter */
-    case X86EMUL_OPC(0x0f, 0x35): /* sysexit */
-        return true;
-    }
-
-    return false;
-}
-
 void hvm_ud_intercept(struct cpu_user_regs *regs)
 {
     struct vcpu *cur = current;
-    bool should_emulate =
-        cur->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor;
+    bool should_emulate = false;
     struct hvm_emulate_ctxt ctxt;
 
-    hvm_emulate_init_once(&ctxt, opt_hvm_fep ? NULL : is_cross_vendor, regs);
+    hvm_emulate_init_once(&ctxt, NULL, regs);
 
     if ( opt_hvm_fep )
     {
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 243c41fb13a..20591c4a44f 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -589,8 +589,7 @@ static void cf_check svm_cpuid_policy_changed(struct vcpu 
*v)
     const struct cpu_policy *cp = v->domain->arch.cpu_policy;
     u32 bitmap = vmcb_get_exception_intercepts(vmcb);
 
-    if ( opt_hvm_fep ||
-         (v->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor) )
+    if ( opt_hvm_fep )
         bitmap |= (1U << X86_EXC_UD);
     else
         bitmap &= ~(1U << X86_EXC_UD);
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 82c55f49aea..eda99e268d1 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -803,8 +803,7 @@ static void cf_check vmx_cpuid_policy_changed(struct vcpu 
*v)
     const struct cpu_policy *cp = v->domain->arch.cpu_policy;
     int rc = 0;
 
-    if ( opt_hvm_fep ||
-         (v->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor) )
+    if ( opt_hvm_fep )
         v->arch.hvm.vmx.exception_bitmap |= (1U << X86_EXC_UD);
     else
         v->arch.hvm.vmx.exception_bitmap &= ~(1U << X86_EXC_UD);
-- 
2.43.0




 


Rackspace

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