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

[PATCH v2 0/2] x86/nestedhvm: Fix #VMEXITs which L0 creates for L2 events


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Stephen Cheng <stephen.cheng@xxxxxxxxxx>
  • Date: Fri, 20 Nov 2026 17:00:11 +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=lJflN8Rfxna3WIqRcMlIFLSb59UL/P6t4+JtU6Q2ra0=; b=hRf2Dkyyo/bHu/ptNRBgnf9CM4c5nCeb3VDTMr6t7J02FjOFYSK7Fea9QsI/NK4DELUGCs7yP2wTXYAm+CLf20AOoAuIFTC5rZWmrXlAjYVF681OHsKc+cV+K+RrVz69eC4Xyr1cppsNdAdzACyAbzZyjkSCs5bGkc+zpK/2f3CkIBulIeAseB2sLl7pOuvWmy3r9uKAkz07p6vP8skxCSuucOumQ2KesGw/F78B4h/qvhsItx+ZAsVuy3q6rqKFbWJUzpQaU6/yrS29818ntGq87gPVmZV+Y2Gz5B/SyL/CGh97hmXQFIwTIrPHMBTKOQwjDXPhEzU4FO/h4E3W8A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sfPf/4IR9MYcAVGNDP/UkytWpz/euG839Tf22jP4txlpgiCSj2jeUQb/3jO3WcqgrM/jDCCc/aVJCh6koluAbk/n8B1LwVtZuzU75muR2NNkKrHnonLqpMnOV/Hl3snU4GXyhXx8gFqy4FYKEpk4B+Fx6KFFH6Qi0AAlVd1RWLE+iRaKn1T7DLjDCD3v1wwpfa57H+QcbjTJRnUUZq2yo3Uxe7pTygSW/rlYhKthv71uXYgNZ6wQ12KN/6abuHR05+SibaQpwJFsiElPruSbJrF1oimrdRmy81YqC7ezBJVTND0HBVXBeDA9X4zPW1evZsjimVm25xZBjvNudoDSYA==
  • 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: Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Stephen Cheng <stephen.cheng@xxxxxxxxxx>
  • Delivery-date: Fri, 20 Nov 2026 09:01:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

When L0 handles an event of L2 itself, and L1 intercepts it, L0 creates
the #VMEXIT to L1.  Two parts of that #VMEXIT are wrong:

 1. NextRIP is copied from an earlier hardware #VMEXIT.
 2. An emulated INT $n is treated as exception n, so the software
    interrupt intercept is not checked.  For some n, L1 is crashed with
    "Illegal exitcode".

Patch 1 was sent alone on 22 Oct (no replies); it is only rebased and
reworded here.  v1:
https://lore.kernel.org/xen-devel/20261022090658.151682-1-stephen.cheng@xxxxxxxxxx/

Patch 2 is new, and uses the NextRIP from patch 1 for INT $n, so I send
them together.

Both were found with nested-SVM XTF tests using the forced emulation
prefix, and tested on AMD EPYC.  The VMX part of patch 2 is only build
tested.

Not fixed here: an ICEBP in L2 which L0 handles (always for a native
ICEBP, since Xen intercepts it, or when emulated) is checked against the
#DB intercept instead of the ICEBP intercept (APM 15.12.2).  I will send
a fix separately.

v2:
 - Rebased on current staging.
 - Reworded patch 1's commit message.
 - New patch 2.

Stephen Cheng (2):
  x86/nestedsvm: Record NextRIP with the deferred #VMEXIT
  x86/nestedhvm: Don't treat an emulated INT $n as an exception

 xen/arch/x86/hvm/hvm.c                   |  3 +-
 xen/arch/x86/hvm/svm/nestedhvm.h         |  5 +-
 xen/arch/x86/hvm/svm/nestedsvm.c         | 60 ++++++++++++++++++++----
 xen/arch/x86/hvm/svm/svm.c               |  8 ++--
 xen/arch/x86/hvm/vmx/vmx.c               |  6 +--
 xen/arch/x86/hvm/vmx/vvmx.c              | 10 +++-
 xen/arch/x86/include/asm/hvm/hvm.h       |  8 ++--
 xen/arch/x86/include/asm/hvm/svm-types.h |  1 +
 xen/arch/x86/include/asm/hvm/vmx/vvmx.h  |  6 ++-
 9 files changed, 80 insertions(+), 27 deletions(-)


base-commit: 5b28c0efc1d5d73ce651ca651e103c45b6932f9d
-- 
2.49.0




 


Rackspace

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