[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 0/2] x86/nestedhvm: Fix #VMEXITs which L0 creates for L2 events
- To: Stephen Cheng <stephen.cheng@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- From: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
- Date: Fri, 20 Nov 2026 09:22:44 +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=syHnxj4Mt/t6CYVC+IZGOjxDJHK51qrriwU9fGKaaAU=; b=PDnugUGxhyAFJJPMIWRK6rn/6sWbJypBvnrERhuMssXxELs2O2TNUrlc7S13OPx/yvhlnBWW9wK/iZtqN6g8wb3OXvT7szYWQQFMXxUY+U4+pgoG/31hmJ2H4e14QH8vjmJlThsYGi3MxdkuLm+n4cy9lsI/AeO9gDs4W4yL24kQK7H49vmtTt4O75Q/9q/OCfoD8o/quvLaFQI4ohTSON5hYiGfMde0bP1pyG/7MA/DElwc/BaOXKncHlLVHBqeMaJkivAn62TwtBWpi/0rRDvhCoPbtjlpiLzkBewIzMIKN+hEofpsQMLxM57wrWi6UitkNZuYcnu+/xZBAvXUNQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hhqpou/c69/7y/yZWf3smBAJexA2pGu7tS4XD6XqBMdDbwb9vLGaL+GBpoUrC8dsxB5D3e+yIWnS3df/UjZHezDk8v34XzAqs0m4fGW2OWNvjTaPncCPTeVYla0mCWJGMnk3b4TOMnZcjh4DULxA0fhltrR3Pzx1PspM9CMD57DgRMnuN4kY8AgMwCR5azKCeGQ4tyXfju+Ak56C+o1zlxEUrrdr7CoV3cKTDevy1u5uOmISGxtn9Hynddhi3R1dmnY8wJ5wpgVrhLs/N1t8nVDQ0JMPVGhOvcyCKwetEKj9WdpAbXnqwFnzBnYDQxwmvJipx3fyYkoHv51vbMcGmA==
- 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>
- Delivery-date: Fri, 20 Nov 2026 09:23:02 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 11/20/26 9:00 AM, Stephen Cheng wrote:
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
This mostly changes VMEXIT handling.
I think the plan is for the rework of VMRUN and VMEXIT to go in first.
Hopefully that resolves several issues but any further bugfixes should be
rebased on top of it and go in afterwards.
Ross
|