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 7A99EC71136 for ; Thu, 12 Jun 2025 07:51:04 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1012473.1390926 (Exim 4.92) (envelope-from ) id 1uPci4-0000wk-IC; Thu, 12 Jun 2025 07:50:52 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1012473.1390926; Thu, 12 Jun 2025 07:50:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uPci4-0000wd-EY; Thu, 12 Jun 2025 07:50:52 +0000 Received: by outflank-mailman (input) for mailman id 1012473; Thu, 12 Jun 2025 07:50:50 +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 1uPci2-0000u3-8E for xen-devel@lists.xenproject.org; Thu, 12 Jun 2025 07:50:50 +0000 Received: from fout-b3-smtp.messagingengine.com (fout-b3-smtp.messagingengine.com [202.12.124.146]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f3565c97-4761-11f0-a309-13f23c93f187; Thu, 12 Jun 2025 09:50:48 +0200 (CEST) Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.stl.internal (Postfix) with ESMTP id ED6D111401FF; Thu, 12 Jun 2025 03:50:45 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Thu, 12 Jun 2025 03:50:46 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 12 Jun 2025 03:50:41 -0400 (EDT) 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: f3565c97-4761-11f0-a309-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= invisiblethingslab.com; h=cc:cc:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1749714645; x=1749801045; bh=3lxvYPHUDqNyMMaaO4nBx8a2VCjVkFHriDdvmhxDgQs=; b= QqgoUSidtbgX4DPDrnommgwH6jTfgHbNT6guBbQitbEhN9IlnnVXkf+KDWA63U66 sZIgvLCGQfwGqXuGstgel9vldV0TGlaQRQnynpL7Thhh/KLMRKmmxQq0WKsPfpLv y7MH0GBCkk/o7PiX13ISpr8DoSUylV39p2W8P5XDtI2rmNuCoX+9G1a2h7sF/QiK RqXPNIJZAO7EVpaeEuUGgfzexnRqUH+6/7IjUy+DG6/Zys+CZ6At9Lb+lwKUsBNY MzrXzbyXYAewVyEBtyw8lEoe6SbZ7B0E5COSoRnJ+pW0GAi3LVDnw2IIYleQHDlX 9kB8YrhuEfdTzhtzLYez+w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1749714645; x=1749801045; bh=3lxvYPHUDqNyMMaaO4nBx8a2VCjVkFHriDd vmhxDgQs=; b=glLnqqCLnSF8AhYpnMCSmVQJK2ij0idHRVIgx8TnpMWZjQTjjpw FW0SugIJLcms+KeG5CO5lcT2xb/uYuZR2PbMbnBYIjlsJQFUTX9z9humlUGrNny+ ffWfUliG8O5TM8E6NnW8lHgkphQOitvmP4lMbHAMuMFCFUIw6Bz4mkjtVPT80Ci/ jjQQfkaof9YbmMZCqNfoB2Sstfbh6+rG+krvA26xVceNBRyPf3l5MmD96SEJzAFu YeatmnsRokr1fAU5JXblE+6FwpC31LEeeUKminvJagiE/HZHzyEK4Yqm014wwzAd tVoaGQGP/27xxjFN0b4tkDFvhv28GGrf+4g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugddugeehudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttdej necuhfhrohhmpeforghrvghkucforghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoe hmrghrmhgrrhgvkhesihhnvhhishhisghlvghthhhinhhgshhlrggsrdgtohhmqeenucgg tffrrghtthgvrhhnpeekgeeiteefgeevjeeiuddulefgvdevgfdvgfejkeejffffgfejle fffedvvefhkeenucffohhmrghinheprhgvrgguthhhvgguohgtshdrihhopdhgihhthhhu sgdrtghomhdpshgsrghtrdhmugenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehmrghrmhgrrhgvkhesihhnvhhishhisghlvghthhhinhhgshhl rggsrdgtohhmpdhnsggprhgtphhtthhopeduhedpmhhouggvpehsmhhtphhouhhtpdhrtg hpthhtoheprghnughrvgifrdgtohhophgvrhefsegtihhtrhhigidrtghomhdprhgtphht thhopeigvghnqdguvghvvghlsehlihhsthhsrdigvghnphhrohhjvggtthdrohhrghdprh gtphhtthhopegrnhhthhhonhihrdhpvghrrghrugesvhgrthgvshdrthgvtghhpdhrtghp thhtohepmhhitghhrghlrdhorhiivghlsegrmhgurdgtohhmpdhrtghpthhtohepjhgsvg hulhhitghhsehsuhhsvgdrtghomhdprhgtphhtthhopehjuhhlihgvnhesgigvnhdrohhr ghdprhgtphhtthhopehrohhgvghrrdhprghusegtihhtrhhigidrtghomhdprhgtphhtth hopehsshhtrggsvghllhhinhhisehkvghrnhgvlhdrohhrghdprhgtphhtthhopehsvggt uhhrihhthiesgigvnhdrohhrgh X-ME-Proxy: Feedback-ID: i1568416f:Fastmail Date: Thu, 12 Jun 2025 09:50:38 +0200 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= To: Andrew Cooper Cc: Xen-devel , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , Roger Pau =?utf-8?B?TW9ubsOp?= , Stefano Stabellini , security@xen.org, Juergen Gross , Trammell Hudson , Ross Lagerwall , Frediano Ziglio , Gerald Elder-Vass , Kevin Lampis Subject: Re: [PATCH] docs: UEFI Secure Boot security policy Message-ID: References: <20250611235851.167385-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xqmz7RRHR2+q0XuL" Content-Disposition: inline In-Reply-To: <20250611235851.167385-1-andrew.cooper3@citrix.com> --xqmz7RRHR2+q0XuL Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Thu, 12 Jun 2025 09:50:38 +0200 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= To: Andrew Cooper Cc: Xen-devel , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , Roger Pau =?utf-8?B?TW9ubsOp?= , Stefano Stabellini , security@xen.org, Juergen Gross , Trammell Hudson , Ross Lagerwall , Frediano Ziglio , Gerald Elder-Vass , Kevin Lampis Subject: Re: [PATCH] docs: UEFI Secure Boot security policy On Thu, Jun 12, 2025 at 12:58:51AM +0100, Andrew Cooper wrote: > Written to be solution and deployment neutral in order to focus on the > technology itself. This policy is intended to work as well for UKI as fo= r the > "classic server setup" approach. >=20 > Signed-off-by: Andrew Cooper > --- > CC: Anthony PERARD > CC: Michal Orzel > CC: Jan Beulich > CC: Julien Grall > CC: Roger Pau Monn=C3=A9 > CC: Stefano Stabellini > CC: security@xen.org > CC: Juergen Gross > CC: Marek Marczykowski-G=C3=B3recki > CC: Trammell Hudson > CC: Ross Lagerwall > CC: Frediano Ziglio > CC: Gerald Elder-Vass > CC: Kevin Lampis >=20 > A rendered version is available at: > https://andrewcoop-xen.readthedocs.io/en/docs-secureboot/admin-guide/ue= fi-secure-boot.html >=20 > Obviously RFC at this point. It's worth saying that XenServer is intendi= ng to > use Shim and get a signature from Microsoft, retaining all exiting featur= es > such as Livepatching and Kexec crash reporting. >=20 > This trails off into more TODOs towards the end. Individual tasks should > expand on the start made and resulting conversation from this thread. As= a > reminder, the target audience for this doc is an administrator running a = Xen > deployment, but who is not necesserily a developer. >=20 > Several things are hard to express and want further discussion. Suggesti= ons > welcome: >=20 > 1) Content of CONFIG_CMDLINE and the various CONFIG_*_DEFAULT options. X= en is > not going to be issuing XSAs for "downstream chose an unsafe configuratio= n, > then signed and deployed the result", yet Xen probably should be on the h= ook > for bad "default ..." settings in Kconfig. Should there be some guidelines what values are/aren't safe for UEFI SB? I don't think there can be a simple list, for example some things may depend on other settings and/or whether UKI is involved. But some comment about relation to UEFI SB (in Kconfig help?) would be useful. As for CONFIG_CMDLINE, IIUC the current implementation does cover it too (as in, lockdown mode will filter built-in cmdline too). > 2) Pre-boot DMA Protection. Microsoft consider this a platform feature > requiring OEM enablement, and do not consider its absence to be a Secure = Boot > vulnerability. But, it is less clear what the policy ought to be for Xen > booting on a capable system and failing to do a correct live-handover of = the > IOMMU across ExitBootServices(). That's a very good question. Do you know if disabling pre-boot DMA protection is allowed if UEFI SB is enabled? If so, I'd assume it doesn't need to be covered. > 3) The AMD microcode signature vulnerability. While it's not Xen's bug p= er > say, it's clearly a Secure Boot bypass because we do offer microcode load= ing > capabilties to userspace, and malicious userspace can load an unauthorised > microcode which allows them to read/write physical memory and bypass furt= her > signature checks. >=20 > 4) Userspace Hypercalls. To anyone who isn't already aware, /dev/xen/pri= vcmd > in the various Unicies is a giant priv-esc hole, as root userspace can > e.g. issue direct memory hypercalls behind the back of an (intentionally) > oblivious kernel, and cannot be handwaved away as "it's fine because it's > root" under Secure Boot. It's not a Xen vuln (Xen *does* audit pointers = in > guest hypercalls), but it is a guest kernel vuln because of failing to > correctly audit hypercall parameters. However, it does require substanti= al > changes in Xen in order to allow guest kernels to do something half-way s= afe. > --- > docs/admin-guide/index.rst | 1 + > docs/admin-guide/uefi-secure-boot.rst | 134 ++++++++++++++++++++++++++ > 2 files changed, 135 insertions(+) > create mode 100644 docs/admin-guide/uefi-secure-boot.rst >=20 > diff --git a/docs/admin-guide/index.rst b/docs/admin-guide/index.rst > index 54e6f65de347..e7895ee95001 100644 > --- a/docs/admin-guide/index.rst > +++ b/docs/admin-guide/index.rst > @@ -5,4 +5,5 @@ Admin Guide > =20 > .. toctree:: > introduction > + uefi-secure-boot > microcode-loading > diff --git a/docs/admin-guide/uefi-secure-boot.rst b/docs/admin-guide/uef= i-secure-boot.rst > new file mode 100644 > index 000000000000..0e0f50143892 > --- /dev/null > +++ b/docs/admin-guide/uefi-secure-boot.rst > @@ -0,0 +1,134 @@ > +.. SPDX-License-Identifier: CC-BY-4.0 > + > +UEFI Secure Boot > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +UEFI Secure Boot is a verification mechanism, intended to ensure that on= ly > +code trusted by the platform can run. This is to prevent malicious code= from > +hijacking the system. Secure Boot requires that all privileged code be > +signed, and that there is a trust relationship with the platform; i.e. c= ode > +which is not signed by a key enrolled in platform must not run privilege= d. > + > +Within the Xen architecture, Xen, the :term:`control domain` and > +:term:`hardware domain` share responsibility for running and administeri= ng the > +platform. This makes their kernels privileged as far as Secure Boot is > +concerned. > + > +When Secure Boot is active in the platform, privileged code is required = to not > +run any untrusted code (i.e. not run any code for which there is not a g= ood > +signature), and is required not to allow this restriction to be bypassed > +(e.g. by command line request). > + > + > +Support in Xen > +-------------- > + > +There are multiple ways to achieve this security goal, with differing > +tradeoffs for the eventual system. > + > +On one end of the spectrum is the Unified Kernel Image. e.g. Xen is bun= dled > +with the dom0 kernel and init-ramdisk, with an embedded command line, an= d with > +livepatching and kexec compiled out, and suitably signed. The signature= is > +checked by the bootloader and, as this covers all the privileged code, X= en > +doesn't need to perform further checks itself. > + > +On the other end of the spectrum is maintaining the features of existing > +deployments. e.g. Xen needs signature checking capabilities for the dom0 > +kernel, livepatches and kexec kernels, and needs to allow the use of safe > +command line options while disallowing unsafe ones. > + > +It is important to remember that Xen is one piece of the larger platform, > +where every piece depends on the correct functioning of all earlier piec= es. A > +product supporting Secure Boot requires a holistic approach involving all > +components in the system. It is not sufficient to consider Xen in isola= tion. This paragraph is a bit vague. Maybe include (repeat) that it includes any privileged domain's kernel, but also bootloader(s)? Or simply remove it as it doesn't add much give the introduction section explaining this already. > + > +.. TODO: Move "In Progress" tasks here as they become ready > + > +Security Scope > +-------------- > + > +Vulnerabilities impacting Secure Boot require a fixed component to be pr= oduced > +and distributed, the vulnerable component to be revoked, and the revocat= ion > +distributed to platforms. > + > +The following principles and guidelines indicate where Secure Boot diffe= rs > +from more traditional security models, and the situations in which extra > +remediation may be necessary. > + > +Principles > +^^^^^^^^^^ > + > + * Privileged code shall include Xen and the kernel(s) of the control and > + hardware domain (both, if they're split). While there is a privilege= split > + here in Xen's regular security model, they are equal from Secure Boot= 's > + point of view. > + > + * Root or ADMIN in userspace is unprivileged from Secure Boot's point of > + view, and must not be able to alter the enforcement policy or load un= signed > + code even by e.g. editing a configuration file and rebooting. > + > +Within Scope > +^^^^^^^^^^^^ > + > +The following types of issue require remediation and revocation of vulne= rable > +binaries. > + > + * Any failure to apply enforcements even against traditionally-privileg= ed > + userspace, including failure to authenticate new code to run and fail= ure to > + handle revocations properly. > + > + * Any Out-of-Bounds write capable of altering the enforcement policy, or > + capable of bypassing enforcement, e.g. by corrupting the running code. > + > +Out of Scope > +^^^^^^^^^^^^ > + > +While typically a security issue in their own rights, these issues do not > +constitute a Secure Boot vulnerability, and do not require special > +remediation. > + > + * Denial of Service vulnerabilities. > + > + * Out-of-Bounds reads. Maybe more generic "Information disclosure" or "Information leak"? > + > +The Xen Security Team will endeavour to produce XSAs for all violations = of > +this security policy, including identifying them specifically as requiri= ng > +further remediation by downstreams. > + > + > +In Progress > +----------- > + > +.. warning:: > + > + The following work is still in progress. It is provisional, and not > + security supported yet. > + > + > +Secure Boot Advanced Targeting > +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > + > +SBAT is a recovation scheme for Secure Boot enabled components, using a > +generation based scheme. See `Shim SBAT.md > +`_ for full details. > + > +Upstream Xen provides the infrastructure to embed SBAT metadata in > +``xen.efi``, but does not maintain a generation number itself. Downstre= ams > +are expected to maintain their own generation numbers. > + > + > +Lockdown Mode > +^^^^^^^^^^^^^ > + > +A mode which causes the enforcement of the properties necessary to confo= rm to > +the Secure Boot specification. Lockdown Mode is forced active when Secu= re > +Boot is active in the platform, but may be activated independently too f= or > +development purposes with the ``lockdown`` command line option. > + > +TODO > +^^^^ > + > + * Command Line > + * Livepatching > + * Kexec > + * Userspace hypercalls > --=20 > 2.39.5 >=20 --=20 Best Regards, Marek Marczykowski-G=C3=B3recki Invisible Things Lab --xqmz7RRHR2+q0XuL Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAmhKhs4ACgkQ24/THMrX 1ywxDwf9HAYoVwQ+eCCjrIv575CkCXg5kYq9FiJHNc7Fe3nQZLvX1dl6TbjQPcb4 JF00j1Ldh2hNZnQBxfu4dnJ+ItyKSCAXlVq7JhI04l23XB0Kn8pUhoVvz43jOI0D wUnnhx6LEryp57FYd0uvnN8ypunWz9A3h+HaCBbRxuGJSpqS6hduYOYmGTfGs0kN l4xhGHCrNpEqUW8iTU2XFnJr4TVhmWDso0yBKkk0wNpJpqRlNXoFgAxmtLoVsXjq 0SiCTtkhghcw2xDAQCB2yAfBFpovVuRhFfgiDL5FBVEg2RgDxRuCHqRBDJ9svT2+ BrWLpV7Ig6XKp5kZZpyITtRGRh3pww== =LQgl -----END PGP SIGNATURE----- --xqmz7RRHR2+q0XuL--