From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B47FAC433F5 for ; Fri, 30 Sep 2022 16:39:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232182AbiI3Qj0 (ORCPT ); Fri, 30 Sep 2022 12:39:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231454AbiI3QjX (ORCPT ); Fri, 30 Sep 2022 12:39:23 -0400 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61D7A176AE8; Fri, 30 Sep 2022 09:39:22 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 52D043200A6D; Fri, 30 Sep 2022 12:39:18 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 30 Sep 2022 12:39:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= invisiblethingslab.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1664555957; x= 1664642357; bh=DoeBKhNM231m+VnHzmoAfyLlv634Z/C2yHlE48QGwmE=; b=R AnXKkXOMSU+BfY4Svif+GgKtE3EZZR3FiZYcOA+s2P9XKphqptvxQcDvtBL7PzQP shp5xMoQBmWW7RNxGlVd+Bv6xE3OjATiKgCM5XGEBiwRC8AW7A4F1ux6kk0nCg2L XqhnZ6kb177nOJAU82R92cE+AupGNIelZS/xmvzxPgj2umJEpRHAHVbCrzbZYCbQ roKywPaJxZyfBR66TVyA4HuO1fWoQWza6Y5ASQ66iEVO3Y1+gBPG9ckXc+qR9ScY 9QV7w5uWcsqdHoPxO5anCFwFHmfNBQ/2BbrUMvcrcFJbloqMtfwsEUk5+IwwsPGd awuq5w4dEiAtXBAqhPc2w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1664555957; x=1664642357; bh=DoeBKhNM231m+VnHzmoAfyLlv634 Z/C2yHlE48QGwmE=; b=v6oSJCSW4ufsZYuHvjpdFCKETWg0LBcB5eaRsQ5vdWpt vxPD8C9cZc7gDuOAL2nzs3mEj6S9FW/e5pICSLp+1mnoZgBu4cBtpOhGeeD++oQ7 7ZxUDAT511KNqeKQbk3ZgjdUKToYMY4zj2y7lXAIFn0N3kb+Wbg151SA2NqpXwBs srg9BqzDYH+w4tKSBGE5TQlVjS8hEnvnfucrPZoVVL9lYfNbAw1GqBzQVmmxGcxM Km0eT72RYcDN7q5QfGUDuISqLdBHYtnmSMNpsL9/mBmRvcCOFFOQnTf4urccjJtj V/myZcCnbX+TV4MQuV+i5mfsExXXNpEbumvzg9C5Rg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeehvddguddtfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpeffvghm ihcuofgrrhhivgcuqfgsvghnohhurhcuoeguvghmihesihhnvhhishhisghlvghthhhinh hgshhlrggsrdgtohhmqeenucggtffrrghtthgvrhhnpeekteegiefhteehffegvdeggeej udelleeltdffveevtdetfeejuefgieeuhfeuleenucffohhmrghinhepkhgvrhhnvghlrd horhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep uggvmhhisehinhhvihhsihgslhgvthhhihhnghhslhgrsgdrtghomh X-ME-Proxy: Feedback-ID: iac594737:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 30 Sep 2022 12:39:16 -0400 (EDT) Date: Fri, 30 Sep 2022 12:38:44 -0400 From: Demi Marie Obenour To: Jan Beulich Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Ard Biesheuvel , Kees Cook , Anton Vorontsov , Colin Cross , Tony Luck , Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= Subject: Re: [PATCH v4 1/2] Avoid using EFI tables Xen may have clobbered Message-ID: References: <282a225d-8782-0321-6f0e-19dd4510dc42@suse.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="SGczFINJLmmUm2Ge" Content-Disposition: inline In-Reply-To: <282a225d-8782-0321-6f0e-19dd4510dc42@suse.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --SGczFINJLmmUm2Ge Content-Type: text/plain; protected-headers=v1; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Fri, 30 Sep 2022 12:38:44 -0400 From: Demi Marie Obenour To: Jan Beulich Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Ard Biesheuvel , Kees Cook , Anton Vorontsov , Colin Cross , Tony Luck , Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= Subject: Re: [PATCH v4 1/2] Avoid using EFI tables Xen may have clobbered On Fri, Sep 30, 2022 at 08:44:21AM +0200, Jan Beulich wrote: > On 30.09.2022 01:02, Demi Marie Obenour wrote: > > Memory of type EFI_CONVENTIONAL_MEMORY, EFI_LOADER_CODE, EFI_LOADER_DAT= A, > > EFI_BOOT_SERVICES_CODE, and EFI_BOOT_SERVICES_DATA may be clobbered by > > Xen before Linux gets to start using it. Therefore, Linux under Xen > > must not use EFI tables from such memory. Most of the remaining EFI > > memory types are not suitable for EFI tables, leaving only > > EFI_ACPI_RECLAIM_MEMORY, EFI_RUNTIME_SERVICES_DATA, and > > EFI_RUNTIME_SERVICES_CODE. When running under Xen, Linux should only > > use tables that are located in one of these types of memory. > >=20 > > This patch ensures this, and also adds a function > > (xen_config_table_memory_region_max()) that will be used later to > > replace the usage of the EFI memory map in esrt.c when running under > > Xen. This function can also be used in mokvar-table.c and efi-bgrt.c, > > but I have not implemented this. > >=20 > > Signed-off-by: Demi Marie Obenour >=20 > In Xen we don't clobber EfiBootServices{Code,Data} when xen.efi was passed > "-mapbs". Should we perhaps extend the interface such that Dom0 can then > also use tables located in such regions, perhaps by faking > EFI_MEMORY_RUNTIME in the attributes returned by XEN_FW_EFI_MEM_INFO? I can add a check for EFI_MEMORY_RUNTIME, but only if I can require a Xen version with https://lore.kernel.org/xen-devel/cc0fbcb4-5ea3-178c-e691-9acb= 7cc9a3a7@suse.com/t/#u. This is easy in Qubes OS via RPM dependencies, but I am not sure if it is suitable for upstream without a mechanism for dom0 to verify that the patch has been included. --=20 Sincerely, Demi Marie Obenour (she/her/hers) Invisible Things Lab --SGczFINJLmmUm2Ge Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEdodNnxM2uiJZBxxxsoi1X/+cIsEFAmM3G7MACgkQsoi1X/+c IsGoBxAA1qb1ePsiOtinAK894ShZXnVAj3jNHthhWj963jYXw6jD9iX2hYAeRFvw ViOU6LodPurxZl4DJpiOW738pLkTYWf6CDfA01oPf2PD9nUA+kdD1doldC3PQ5Pf yBpX0cPWDmP7xnNzdHW/ogcBCBVs6RBwiVFJsklGfKtQ9CfxRCW0q9KGL+YJTkL8 uSNTPe1v+4Q+ZdXs0Qsn/Yj33mOcg7ECO00cT8lgfF4lV/xIvi8jTgWjHVlkK3Qs yxhmIiH0tvdegEu4uLcA15EmcFNi+l3Dkx8WU1674wDy/ZG1DdLljbFRSxp3HUjq i5G2sixSYHn/PH6f6b8mOJFwHDasyDnV3FZbE9oEXAhz8Qz1zp6BlCQ3g/bFTyhU lTVoMNL6AuXFFQ9eRAy5YWcNc/Ypt2eg/IBPXZDBP35Uq/BhYdzVkrlWUvYBhm82 iPZ7yyUsmjots3iLJkHgmA85ZbSDV1oMallsRmosYgTiam9N4/F7eHM3kIAjmnMD yDaD4rQBPYY7a8+GEXfdS1EirIR94Ysb+D6zuMl0f9onBg1eW22955zWYtCgo4pW dNE0NoMzSwdwvHi6VIA51K9Qz/LJMtXiin01RSbmk0vVyIuOnmKQElueQmw8S97O tcxYwdZ6+4h6CZr3Iez+UXsH1rvB89qlW7bdkS3ETJH2RgGCsOo= =pxje -----END PGP SIGNATURE----- --SGczFINJLmmUm2Ge--