Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AEB11EF48C2 for ; Fri, 13 Feb 2026 03:18:31 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1230148.1535721 (Exim 4.92) (envelope-from ) id 1vqjh8-0005FZ-NH; Fri, 13 Feb 2026 03:18:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1230148.1535721; Fri, 13 Feb 2026 03:18:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vqjh8-0005FS-KG; Fri, 13 Feb 2026 03:18:14 +0000 Received: by outflank-mailman (input) for mailman id 1230148; Fri, 13 Feb 2026 03:18:13 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vqjh7-0005FM-2l for xen-devel@lists.xenproject.org; Fri, 13 Feb 2026 03:18:13 +0000 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9f7ec94a-088a-11f1-b163-2bf370ae4941; Fri, 13 Feb 2026 04:18:10 +0100 (CET) Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.phl.internal (Postfix) with ESMTP id 9AC6514000F5; Thu, 12 Feb 2026 22:18:09 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Thu, 12 Feb 2026 22:18:09 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 12 Feb 2026 22:18:08 -0500 (EST) 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" X-Inumbo-ID: 9f7ec94a-088a-11f1-b163-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= invisiblethingslab.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm3; t=1770952689; x=1771039089; bh=MQdfMQaHPBHgZeyVIkCI+JydNTfIFqtr LGdsuLTCQVs=; b=uHPhzV9W8GJz07iqGuVUWzWCMZKNXPz/DWxtf+WzZYAZ9uyy aTREoSgWeM1kYIGOUPVuXR3bfvQqywACqReeFy00M4jIk+dNREujIuU7HczmTLLx 7fwLhxjdRvdJjic+mJrxyuoQRp/6D/Zxg009jqW4PxaODp2z7r0+2zvuq/tSr/b0 UohqKP59ZkZDlqosAhoR4Pb9SjabL7+kNECbC1h0IRviIGoc48r4JAZahy2jxyeI I66sPHeTFjLLzyjGKgrpdGIWAPeOnSzmBm/FC9BpLrsHMtDrXAeMe2+MuFor7avK Te2EnuR8WZ14qPS2EIuxNihYzIq5B2bwnxnoHQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1770952689; x=1771039089; bh=MQdfMQaHPBHgZeyVIkCI+JydNTfI FqtrLGdsuLTCQVs=; b=GjX5cgAs5W2WlkuDre6lOoCK7ByaLIBvSwKYw/oCm+kM 0Fm+t5E47McseC2zfqjZWA9KIBm9T+jv4dBIceQLNgxpq6KzXaCMcFypj/C/s3Ue 83zxPo2N+JgVD+ZqaMKsTmvjx+QUMEb5OkxGvOwqesJ95YhGn7r62YkPGOBgu3b5 QMRPG/agtxyNnT//kC4mmm+L4y/mp+S4/WXwI2z/+ZRuoPA57rOCRxixGMNTYlYM kij5dPtDcVcwwMFUTFK5GP1IPTWvEDcjKdXn/NGB7dn6j9Oy53SMJhPHMbToONbV mA4iGXtRVGO9QmYYcj7Yk71hruw+J/L/NUQ5eEN04w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvtdejudehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofggtgfgsehtkeertdertdejnecuhfhrohhmpeforghrvghkucfo rghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvhhish hisghlvghthhhinhhgshhlrggsrdgtohhmqeenucggtffrrghtthgvrhhnpeelkefhudel teelleelteetveeffeetffekteetjeehlefggeekleeghefhtdehvdenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrghrmhgrrhgvkhesihhn vhhishhisghlvghthhhinhhgshhlrggsrdgtohhmpdhnsggprhgtphhtthhopeehpdhmoh guvgepshhmthhpohhuthdprhgtphhtthhopeigvghnqdguvghvvghlsehlihhsthhsrdig vghnphhrohhjvggtthdrohhrghdprhgtphhtthhopehmrghrmhgrrhgvkhesihhnvhhish hisghlvghthhhinhhgshhlrggsrdgtohhmpdhrtghpthhtohepjhgsvghulhhitghhsehs uhhsvgdrtghomhdprhgtphhtthhopegrnhgurhgvfidrtghoohhpvghrfeestghithhrih igrdgtohhmpdhrtghpthhtoheprhhoghgvrhdrphgruhestghithhrihigrdgtohhm X-ME-Proxy: Feedback-ID: i1568416f:Fastmail From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH] VT-d: fix off-by-one when handling extra RMRR ranges Date: Fri, 13 Feb 2026 04:17:48 +0100 Message-ID: <20260213031801.1744145-1-marmarek@invisiblethingslab.com> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add_one_user_rmrr() operates on inclusive [start,end] range, which means the end page needs to be calculated as (start + page_count - 1). This off-by-one error resulted in one extra pages being mapped in IOMMU context, but not marked as reserved in the memory map. This in turns confused PVH dom0 code, resulting in the following crash: (XEN) [ 3.934848] d0: GFN 0x5475c (0x5475c,5,3) -> (0x46a0f4,0,7) not permitted (0x20) (XEN) [ 3.969657] domain_crash called from arch/x86/mm/p2m.c:695 (XEN) [ 3.972568] Domain 0 reported crashed by domain 32767 on cpu#0: (XEN) [ 3.975527] Hardware Dom0 crashed: rebooting machine in 5 seconds. (XEN) [ 8.986353] Resetting with ACPI MEMORY or I/O RESET_REG. I checked other parts of this API and it was the only error like this. Other places: - iommu_get_extra_reserved_device_memory() -> reserve_e820_ram() - this function expects exclusive range, so the code is correct - add_one_extra_ivmd() - this operates on start address and memory length Signed-off-by: Marek Marczykowski-Górecki --- xen/drivers/passthrough/vtd/dmar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c index 91c22b833043..3da0854e6d91 100644 --- a/xen/drivers/passthrough/vtd/dmar.c +++ b/xen/drivers/passthrough/vtd/dmar.c @@ -1065,7 +1065,7 @@ static int __init add_user_rmrr(void) static int __init cf_check add_one_extra_rmrr(xen_pfn_t start, xen_ulong_t nr, u32 id, void *ctxt) { u32 sbdf_array[] = { id }; - return add_one_user_rmrr(start, start+nr, 1, sbdf_array); + return add_one_user_rmrr(start, start + nr - 1, 1, sbdf_array); } static int __init add_extra_rmrr(void) -- 2.51.0