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

Re: [PATCH 2/4] x86/hvm: Disable non-FEP cross-vendor handling in #UD handler


  • To: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
  • Date: Wed, 28 Jan 2026 13:38:34 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=temperror (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=temperror 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=YYgszTUoITTBF5Lcaekyh/Egk6dXZ+86YDrnZLCaIB8=; b=c8ZHHdxPhguL+qREg1tLV/ChP+60Mko8dgoAcGVUndRTqC7iNJOHchG9JRddIXLbH+f1swW7B5qt9Wy4FgJ3y7CVenr9ex0/tFUJy3m5jpoIUkdw/jRmRku327Tz35cBSK/ZX9NdCdVOMIwGW/IwSjFmmsEUcBcrWFB2lshmGD5miACMv+/7bx2kSVE8OlQ0KpdJmLDqNjMZA5Ugvq5qu5VD0DAsZhxCuFH0zVgFbEqLvx/mQc9qLcwsjlcLDQ5HMYHvBYRnevOOE7eH3qq2TUZtTIPgeXNijdOwYc3VWpjETip7Rnqmh3rAnmWRF3RjIMXdmFHePLwf/46b4BoWFA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wilsxGdxVzlE4GkH8j3qQmuHxbKDTTAAGK7yhrQkIXtm/HCgE/sNYUunmNQakgBBMMQW2qNYzgBy8Uf9HrfrsACw8746B81vRVTxV6DeALNzW8o5G5vzgcxw6vs6O1IALzb5khjSiK6cfPnoekR49ypIiQ1S0hI4A0b5xVTBP+E+TzTJhvjKUt7f9A5I43Dp/RLYPt5TQbmM0xYueFMA9guQl++Jd3PSlnRt9tMHMimWTEgoXEgcngn3JScn3zaHmFWPSyb2s9hCGzBHaUO90/hiPYAhQY2DS8XFweEXOzdUav1QtnS3ZMnNGttQOWDIHMWCB+Hc6RNf+jrbevBNMg==
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>
  • Delivery-date: Wed, 28 Jan 2026 12:39:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu Jan 22, 2026 at 5:49 PM CET, Alejandro Vallejo wrote:
> Remove cross-vendor support now that VMs can no longer have a different
> vendor than the host, leaving FEP as the sole raison-d'être for #UD
> interception.
>
> Not a functional change.
>
> Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
> ---
>  xen/arch/x86/hvm/hvm.c     | 25 ++++---------------------
>  xen/arch/x86/hvm/svm/svm.c |  4 ++--
>  xen/arch/x86/hvm/vmx/vmx.c |  4 ++--
>  3 files changed, 8 insertions(+), 25 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
> index 4d37a93c57..611ff83a60 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;
> -}
> -
> +#ifdef CONFIG_HVM_FEP
>  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;
>      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 )
>      {
> @@ -3878,12 +3863,9 @@ void hvm_ud_intercept(struct cpu_user_regs *regs)
>                  regs->rip = (uint32_t)regs->rip;
>  
>              add_taint(TAINT_HVM_FEP);
> -
> -            should_emulate = true;
>          }
>      }
> -
> -    if ( !should_emulate )
> +    else

review to self. This is buggy. It allows instruction emulation when HVM_FEP is
enabled, but the FEP is absent in the particular instruction that caused the
exception.

#UD should be re-injected when the instruction doesn't have the prefix.

Cheers,
Alejandro



 


Rackspace

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