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

Re: [PATCH v2 2/2] x86/nestedhvm: Don't treat an emulated INT $n as an exception


  • To: stephen.cheng@xxxxxxxxxx
  • From: chunjie.zhu@xxxxxxxxxx
  • Date: Fri, 27 Nov 2026 15:55:24 +0800
  • 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=FZal+WCyJrqzodCNZ8GmvTXL+mw+KhUxeLf/oVzle2g=; b=MIpMtKRFASWXgKNs9/zwYezwNehUWS5kXBre2mJjeVLatFIH85wyNES4CFLG8dCuCxFU2P4Wtchuno5X+//dwPI6srM46EuHBzN5Fv57sNQspq7Q4ky4hJfF6CVUTjKnZqTbUnAiaj8pRMWgdqrklUZJZvqUQiHTF4dlnz0AuDKZwG8Pm75/Uj/1EUUoNRG9GjFqoP90UrBYchauSgCODxw6usz+5ERLlm+WzHaCvYJt8b2qckC3nYemxJxDSlwi6eWjU3H7Acy3NUm4bS/UmNR5ewpdSBXbjRDZax4Wf9cJYHKj8s6FKtshYHcvHZhxXXEjglwkjhRfUBG6iBza3g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=toTd31GqhLwD9aJ4RQi9mOpdkogQMqvEL56dtCjOVQ0D14NKwsTM7v1W5OwGjejvxyo2+bfGKRjbqGlYor3de0ts4t+C4vOBHPH1r7Vjdzb6C9XYH8C7vWCABhMdb5+AEMIiJvhgqY3MPNHlVSZ8FMLeYbkypncFIeju3/pVIf3Hc1pKNEEUwbXEagH8/TFCrdgqtgDlbYERe2EwhVWI36H2pBSEDp/mcYH6/CGiY7vZScAWMEMKUH+8AEnvexpiUnZWXdXWBu2NcYF/JNNlwNBhlJw/McOV2Y7g2u/bfEiXMpO9VMbUr4SBxCt3AdNHRNhzo/78PtLq2jfsHAwgUQ==
  • 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: andrew.cooper3@xxxxxxxxxx, jason.andryuk@xxxxxxx, jbeulich@xxxxxxxx, roger@xxxxxxxxxxxxxx, teddy.astie@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 27 Nov 2026 07:56:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 11/20/26 9:00 AM, Stephen Cheng wrote:
> +bool cf_check nvmx_intercepts_event(
> +    struct vcpu *v, const struct x86_event *event)
>  {
> +    const unsigned int vector = event->vector;
> +    const int error_code = event->error_code;
>      u32 exception_bitmap, pfec_match=0, pfec_mask=0;
>      int r;
>  
> +    /* INT $n is not an exception, and is never in the exception bitmap. */
> +    if ( event->type == X86_ET_SW_INT )
> +        return false;

An alternative idea,

Since nhvm_vmcx_guest_intercepts_event() cannot tell an exception from
a software interrupt by itself, would it be cleaner to split the hook
in two and let hvm_inject_event() pick one by event->type?  Roughly:

    nhvm_vmcx_guest_intercepts_exception(v, vector, errcode)
    nhvm_vmcx_guest_intercepts_swint(v, vector)

SVM would check VMEXIT_EXCEPTION_DE + vector in the first and
VMEXIT_SWINT in the second.  VMX would keep nvmx_intercepts_exception()
as it is, with its ASSERT(vector < 32) still meaning "exceptions only",
and the second hook would simply return false, as INT $n never causes a
VM exit on VMX.  That also avoids passing the whole struct x86_event
to the hooks.




 


Rackspace

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