From nobody Mon Nov 23 22:28:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=sfu.ca Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1794203713799814.102205353954; Sun, 8 Nov 2026 21:55:13 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1479507.1683454 (Exim 4.92) (envelope-from ) id 1xQILI-0008GG-HD; Mon, 09 Nov 2026 05:54:56 +0000 Received: by outflank-mailman (output) from mailman id 1479507.1683454; Mon, 09 Nov 2026 05:54:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xQILI-0008G9-CO; Mon, 09 Nov 2026 05:54:56 +0000 Received: by outflank-mailman (input) for mailman id 1479507; Mon, 09 Nov 2026 04:41:12 +0000 Received: from mx.expurgate.net ([195.190.135.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xQHBw-0006OV-BH for xen-devel@lists.xenproject.org; Mon, 09 Nov 2026 04:41:12 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xQHBv-0081dx-EG for xen-devel@lists.xenproject.org; Mon, 09 Nov 2026 05:41:11 +0100 Received: from [10.42.69.11] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6af14ece-8faa-0a2a0a5109dd-0a2a450bdab4-16 for ; Mon, 09 Nov 2026 05:41:11 +0100 Received: from [142.58.10.48] (helo=cs-arch-srv04.cmpt.sfu.ca) by tlsNG-42698a.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6af14ee5-b7e8-0a2a450b0019-8e3a0a30811c-3 for ; Mon, 09 Nov 2026 05:41:10 +0100 Received: by cs-arch-srv04.cmpt.sfu.ca (Postfix, from userid 662374) id 7F21B5A000D; Sun, 8 Nov 2026 20:41:08 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; none From: Mahmoud Abumandour To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , Mahmoud Abumandour Subject: [PATCH] x86/nestedhvm: don't give L2 instructions L1 did not enable Date: Sun, 8 Nov 2026 20:41:06 -0800 Message-Id: <20261109044106.2830619-1-mam47@sfu.ca> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-42698a/1794199270-1BCD79EA-E51C3D32/0/0 X-purgate-type: clean X-purgate-size: 1470 X-ZM-MESSAGEID: 1794203714567158500 Content-Type: text/plain; charset="utf-8" From: Mahmoud Abumandour nvmx_update_secondary_exec_control() ORs Xen's own secondary controls for L1 into those L2 runs with, among them "enable RDTSCP", "enable INVPCID" and "enable XSAVES", which L1 is not offered. L2 then executes these instructions where L1's VMCS makes them raise #UD, and when L1 sets "INVLPG exiting", L2's INVPCID exits with reason 58, which nvmx_n2_vmexit_handler() does not handle. Xen crashes L1's domain. Fixes: 729186073765 ("Nested VMX: Extend VMCS control fields for n2 guest") Signed-off-by: Mahmoud Abumandour --- xen/arch/x86/hvm/vmx/vvmx.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index 29e48387a1..79f5c00ba6 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -650,6 +650,13 @@ void nvmx_update_secondary_exec_control(struct vcpu *v, =20 host_cntrl &=3D ~apicv_bit; host_cntrl &=3D ~SECONDARY_EXEC_ENABLE_VMCS_SHADOWING; + /* + * Whether L2 may execute RDTSCP, INVPCID and XSAVES is L1's choice. L2 + * gets #UD as on hardware. + */ + host_cntrl &=3D ~(SECONDARY_EXEC_ENABLE_RDTSCP | + SECONDARY_EXEC_ENABLE_INVPCID | + SECONDARY_EXEC_XSAVES); shadow_cntrl =3D get_vvmcs(v, SECONDARY_VM_EXEC_CONTROL); =20 /* No vAPIC-v support, so it shouldn't be set in vmcs12. */ --=20 2.25.1