From nobody Thu Jul 23 21:53:00 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; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1783331111; cv=none; d=zohomail.com; s=zohoarc; b=bMU9bd6sRiw5/Y5mgjD4hPVf6c6hKomFRIRMOK7siTvnBjQC0V/J1Ehq2s9yqrs0GaahUJkIyI6saP/4hBAoEERcdhbiUz9ljBsHHKeLPI221Hxw7heFRCMXA5sXMGvgChIUp2fgSc+aJ0UIiqZbeN0oJh2pzCC+tkAVPbE5w9U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783331111; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=EgcFpTg0M719DUSQiohUXmyN6KV71kHNHsNKWBm10go=; b=mH+5tkjiiSPWzAoZC7ip4cTuCxYucsfnJcC9NtsYKZIi3JUk4cguOf6BJYDIsEruFqSJ7KIXOcU2rBBWjvRqMAwLao1MygpvZIOEK22040/cU+xFt9L4X0kX5fzJydI4rEXg65GgCH+VD9SZ3ZmnL5UfOma/cRhFMWt3iavZ+b4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1783331111888337.52993747008543; Mon, 6 Jul 2026 02:45:11 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1355211.1609972 (Exim 4.92) (envelope-from ) id 1wgfsY-00072y-1a; Mon, 06 Jul 2026 09:44:42 +0000 Received: by outflank-mailman (output) from mailman id 1355211.1609972; Mon, 06 Jul 2026 09:44:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wgfsX-00072q-Tg; Mon, 06 Jul 2026 09:44:41 +0000 Received: by outflank-mailman (input) for mailman id 1355211; Mon, 06 Jul 2026 09:44:40 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wgfsW-00072R-PI for xen-devel@lists.xenproject.org; Mon, 06 Jul 2026 09:44:40 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wgfsW-002r9l-63 for xen-devel@lists.xenproject.org; Mon, 06 Jul 2026 11:44:40 +0200 Received: from [10.42.69.1] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a4b78f9-5cb7-0a2a0a5109dd-0a2a4501e532-28 for ; Mon, 06 Jul 2026 11:44:40 +0200 Received: from [209.85.128.50] (helo=mail-wm1-f50.google.com) by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a4b7907-400f-0a2a45010019-d1558032e014-3 for ; Mon, 06 Jul 2026 11:44:40 +0200 Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-493d92b7db3so10932495e9.2 for ; Mon, 06 Jul 2026 02:44:40 -0700 (PDT) Received: from localhost.localdomain (2.115.147.147.dyn.plus.net. [147.147.115.2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-493ccd9d620sm283605205e9.1.2026.07.06.02.44.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 02:44:38 -0700 (PDT) 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; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783331079; x=1783935879; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EgcFpTg0M719DUSQiohUXmyN6KV71kHNHsNKWBm10go=; b=Du9o+Opo/JUFynOCIYBoe0aFnMF3ZylARjZetlDz5zilFHKfGg/2hSFrOhn/YKmP56 l7XkSeFYrcV59Th6e6RO3/7BBxQIG4XogsuH4gQHs7E+lpWW5mt9ZSK7PVYT34cScnGX m56+gg7jtHV5B9fsznBrfIpdzIl5PtDhn9HVHKPWFVw72chzfPMcZHZ1cFJ7ojSdQ+Au N4DQAWZZd5098xplX2TP9Z9jM5vNiSgJ35PV9HPVZgeuMM0pBQcbt90ZUIEBy8nvLjy+ xRe+ULuMHtVCH11MdRb+INgxUQGW4m5fyzSnCy9dBrC/xPe/8CR3CqME9B9QniBwdEjB tSkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783331079; x=1783935879; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=EgcFpTg0M719DUSQiohUXmyN6KV71kHNHsNKWBm10go=; b=lrWE0nkPsgsQLiA5ugcBMw6DZOA/z6MVrHObsqRnUDUO4Oi+6Ce/XumJO5oNrTLf/9 FDCHpRbVOKAUVfZ2CyhXfRYRaehZ0yWw4CnwcHyiP7NQ8ly3HrZO1cbEqRyu5qhSgvDn zqV3LI8n0VyQOuso75lqnTim5d92LwBFX1D0oRrOsLsXXBlebCNhZWNVu2nVc0MaAenD VFOZNInMZ0d2IxmoPbxRmsGgRfOO0NDFGI/JNrVMAywtpM5up6vqvXuXR+dkPqHXuZHP 6P39VW93U1uG3A6M9aTNFEPNyTiuoFF9FlAc32AYLSEcO7vjs6gVYDGyULcqvBWuWLT4 ydSg== X-Gm-Message-State: AOJu0Yz/lvO5HdKaMY1dHgtAK0X+LASUqw9TL/8EnI8l2Fe1K5afaEYJ NISQ8G93bB9osENA5AOJBTLdhZsemnx29zMxPGpRPBcvkjZh1nTXFMabC1hbhPedX2U= X-Gm-Gg: AfdE7cn8mgqqfofz4LMRIXKRAK9MBewmdXOps0T+GFHQ7A2SpU/llkaQdpS/TpVPvPN n7almMx69N3YnNxRyadzY3OX6Fr+MA6CeuzrCOYpsv91YWpSMWuw8Ea5VTD93FASQCC+0772bOP ROzRPoiJgLmX0LFYnYZNFN/8F38RhmIbGeeFUBW7uqym6RrFbXL1DCBNxOHYIjS5nk08r8IZsOG No70qPXV9aDhNMFKf67XJmlRggPASEg39HJ/9K+EHaAfCVmRKTzZBcKD4RD26uAQqc3Dy6lb60C nwDGRNcx6ErmBZ8feSNyIiF2jgBqapTHBzVfrMt7sePkbuZ0O9Gv3Ddo5nc5a2fwGwySplNCkXV uYId/s54TgIi7bksFtC3V4s+kWKpkSjnjXi5xtsABhF/gEEunDJxl3Elx5k1LAO5N7JXKfSb4L3 epQTzL7fvQp2wcRsAcbjA6+giVOtjxZ8CV2uV5erW8AJgK1DUh9ppuuivuo312MhHC269dQB1Sp Ca/eszd8xj6U+IfVB0= X-Received: by 2002:a05:600d:6401:10b0:493:cd3f:d051 with SMTP id 5b1f17b1804b1-493d11f03b7mr80054245e9.25.1783331079285; Mon, 06 Jul 2026 02:44:39 -0700 (PDT) From: Frediano Ziglio X-Google-Original-From: Frediano Ziglio To: xen-devel@lists.xenproject.org Cc: Frediano Ziglio , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Frediano Ziglio Subject: [PATCH v6 1/4] Align relevant sections to 4KB Date: Mon, 6 Jul 2026 10:44:27 +0100 Message-ID: <20260706094430.427155-2-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706094430.427155-1-frediano.ziglio@citrix.com> References: <20260706094430.427155-1-frediano.ziglio@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-d62444/1783331080-818D81E0-473B6DAC/0/0 X-purgate-type: clean X-purgate-size: 2076 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1783331113362158500 From: Frediano Ziglio Required by UEFI CA memory mitigation. It is a requirement for NX_COMPAT so the PE can be loaded with W^X perms in the pagetables. NX_COMPAT is a requirement from shim-review, https://github.com/rhboot/shim-review#do-you-have-the-nx-bit-set-in-your-sh= im-if-so-is-your-entire-boot-stack-nx-compatible-and-what-testing-have-you-= done-to-ensure-such-compatibility Sections with different permissions must be in separate pages. In the case of debug sections they are contiguous and have the same permissions, including the immediately preceding .reloc section, so it's not an issue if they are not aligned to the page. Before the .debug sections you could have the .reloc or the SBAT section, either are permission-compatible. Signed-off-by: Frediano Ziglio Acked-by: Marek Marczykowski-G=C3=B3recki Acked-by: Jan Beulich --- Changes since v1: - Change subject. Changes since v2: - Improved commit message and subject. Changes since v3: - Added Acked-by; - Improved commit message. Changes since v4: - Added missing comment; - Added Acked-by. --- xen/arch/x86/xen.lds.S | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index b9e888e596..8e63cf5bc2 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -162,8 +162,8 @@ SECTIONS __note_gnu_build_id_end =3D .; } PHDR(note) PHDR(text) #elif defined(BUILD_ID_EFI) - /* Workaround bug in binutils < 2.36 */ - . =3D ALIGN(32); + /* Align to satisfy UEFI CA memory mitigation. */ + . =3D ALIGN(PAGE_SIZE); DECL_SECTION(.buildid) { __note_gnu_build_id_start =3D .; *(.buildid) @@ -330,6 +330,8 @@ SECTIONS __2M_rwdata_end =3D ALIGN(SECTION_ALIGN); =20 #ifdef EFI + /* Align to satisfy UEFI CA memory mitigation. */ + . =3D ALIGN(PAGE_SIZE); .reloc ALIGN(4) : { __base_relocs_start =3D .; *(.reloc) --=20 2.43.0 From nobody Thu Jul 23 21:53:00 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; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1783331112; cv=none; d=zohomail.com; s=zohoarc; b=Z9Wtm8Jv+31Jf3Zk2qlT96UtMg33WwFhduas7hcLS1q3xX8ybJzn+0UX8+QZdSduZvqamm4CTZ9edKQ6cMlQLNv9HQOanwiBOrF9ZLju+mIln/hX7M4FP5kIYGrKUt4syUiZpyqPPqRbJXyONTSGkfZ2NQFZUlIj2YPuR0/oyXM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783331112; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=X0/pd4NebReOi1u00xuUMPx7iuXllyYVM7OCMuJ2B44=; b=em19lzojn92Be7RrKqadFVs7jUYCO4PjZOitD3ar5FteHNXAQjL6yg88jtTHOjfj9OVXmrSnIvuKZ/uY5yKx2P8xTtp/SPa89xS5M1wD+glk/eRKQmdKI8cwSxo+vouNPot0Dkhfa9Wm1BqTrNGjo+IjYaiSWXRvuqLdUvKGrTY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1783331112310826.0846839031246; Mon, 6 Jul 2026 02:45:12 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1355212.1609980 (Exim 4.92) (envelope-from ) id 1wgfsZ-0007G0-7y; Mon, 06 Jul 2026 09:44:43 +0000 Received: by outflank-mailman (output) from mailman id 1355212.1609980; Mon, 06 Jul 2026 09:44:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wgfsZ-0007Fl-4A; Mon, 06 Jul 2026 09:44:43 +0000 Received: by outflank-mailman (input) for mailman id 1355212; Mon, 06 Jul 2026 09:44:41 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wgfsX-00072g-MS for xen-devel@lists.xenproject.org; Mon, 06 Jul 2026 09:44:41 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wgfsX-009Ezx-39 for xen-devel@lists.xenproject.org; Mon, 06 Jul 2026 11:44:41 +0200 Received: from [10.42.69.12] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a4b78fb-e002-0a2a0a5209dd-0a2a450ced64-18 for ; Mon, 06 Jul 2026 11:44:40 +0200 Received: from [209.85.128.50] (helo=mail-wm1-f50.google.com) by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a4b7908-f399-0a2a450c0019-d1558032e427-3 for ; Mon, 06 Jul 2026 11:44:40 +0200 Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-493bc8fda98so30747405e9.0 for ; Mon, 06 Jul 2026 02:44:40 -0700 (PDT) Received: from localhost.localdomain (2.115.147.147.dyn.plus.net. [147.147.115.2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-493ccd9d620sm283605205e9.1.2026.07.06.02.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 02:44:39 -0700 (PDT) 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; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783331080; x=1783935880; darn=lists.xenproject.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=X0/pd4NebReOi1u00xuUMPx7iuXllyYVM7OCMuJ2B44=; b=gxLVbjaoP1nvM08a3Tkn/vbEdEo62hMZNk5KT/KIl4WFy6ha978VbICWx3ssc530/U FBC15pxCAUQt02u+fWAYQVNPVflokp3XYhrox9WtMjOHO+ETvoA671ZceKWkYD0uJaoy ypnr51NhNy77uAZ/8JoVVIu/A2IC8HMabFxZQyfAw8cYE53PlmO+GKBwbmtH8rvYJf/d YW+E8ofk2j/32f2BFuSCSpr7LObh2ida/VVUVQpuyAxrOq2pspXGCyB9f7dJrLmaV1DB 4INgpLZBsggB3QTq5Q26Rk+pKy49Q/xBL2NQFU2t8ePa0e7ttLAY7t61DQOzqR6IS2na mRNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783331080; x=1783935880; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=X0/pd4NebReOi1u00xuUMPx7iuXllyYVM7OCMuJ2B44=; b=iIhXS165uqY6Kdnzh/9+UPOCnKCxVyrXMROH49u5lgixZVQugYF9/CegJmAJQhifL8 oRnV9hBjULd+1XPpBiGCX8PGSx0b8zFmSUp4uf+Mxcl40EnG+vI0lF//Ug0FIWPQ/VLa ut0rH8cT2De1zU2zCt3CTmhIA0wLInu/9Z4NcPojftZuD3lDBHJojdz6pxZ+0rCBM9WW w1588/rMOYBbDwb1RUjhXdws3z5IS3K5otw42xh294sXXz63E2zDHZMATBcs8ydrs+HY 15ocu1DH77rEfhdLOwup3wstpiao7RTnrWap/iQVdlB+pscGEptOu1UOJX5ocpNE7vEJ NXpw== X-Gm-Message-State: AOJu0YxllqD1HZPZADVuyJqhObEUYSgbsFVHPI6BeEptrVlRObnSA87u lOpeHhS6g7yCV/0St1AGy1RNVf1HELFZZs+M8Sdf/BQHCLjMr6OFfVHjFx90wgn0EVk= X-Gm-Gg: AfdE7cmoJ56mAnNJchQw7MCmd6apTtzOuUH+tFkHVxG78RTTRAEcj+FzqnorOJ2BMsq YnsPRg61+S5grjvD/h95AJDCLIk/HebquT8BWmQ98IgOpG9RbI8zR7AvcDMWIPaw8pRNHCAR3Yk TFYMhThoUGtbL5ZESu9oyDcUFYtVAADP0yMFYGIoEJAKHdB+fxf4b6hhYTBAaiRKumrV4jyRnr/ HaNvD+WDI09/F63dthD7A6ulbjI9a9Khqd/xxAiiEVp5CizToVXapiZrXv9X6zepuVUhO181B+V OTQMdpdD8j4rKJVmBfntWcSl32huhD8y16QDOYmHlgHYpMXVJpsD/A4sKaUMG8WfL5stEWibI+Q FmoCorlLlqd+F0TiP89fFbOCrXKlA2GoxQAMCKOUQdx9AnNvj5SEGOiscutPv1Y+qeTTIF2SdAl RJlFQQmnBhKJgsjkyoGofZSNsRcjotGpZnRg+v5vJT6Yg+2Fsd9+VE0phb4aTxbok9sNNFpxiZ5 28UddNEPF+TTOHte/g= X-Received: by 2002:a05:600c:3554:b0:493:a5d0:d1a1 with SMTP id 5b1f17b1804b1-493d11f6bf5mr115083975e9.31.1783331080005; Mon, 06 Jul 2026 02:44:40 -0700 (PDT) From: Frediano Ziglio X-Google-Original-From: Frediano Ziglio To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Jan Beulich , Andrew Cooper , Teddy Astie , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Frediano Ziglio Subject: [PATCH v6 2/4] x86/efi: discard multiboot and PVH support for PE binary Date: Mon, 6 Jul 2026 10:44:28 +0100 Message-ID: <20260706094430.427155-3-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706094430.427155-1-frediano.ziglio@citrix.com> References: <20260706094430.427155-1-frediano.ziglio@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-d25034/1783331080-0F138D51-188A3276/0/0 X-purgate-type: clean X-purgate-size: 5049 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1783331113401158500 From: Roger Pau Monn=C3=A9 Multiboot and PVH booting are not supported for PE, hence discards them in the linker script when doing a PE build. That removes some relocations that otherwise appear due to the usage of the start and __efi64_mb2_start symbols in the multiboot2 header. Section discarding is not done updating DISCARD_SECTIONS definition as the change is specific for x86. No functional change intended. Signed-off-by: Roger Pau Monn=C3=A9 Signed-off-by: Frediano Ziglio --- Changes since v1: - improve commit message; - change section orders to avoid changing code order in final executable; - merge 2 commits; - removed deprecated documentation section. Changes since v2: - Update commit message, join 2 sentences together. Changes since v3: - Added Acked-by. Changes since v4: - more clear subject; - removed more code/data from EFI output; - removed Acked-by. Changes since v5: - simplify section exclusion using more wildcard; - exclude more multiboot functions. --- docs/hypervisor-guide/x86/how-xen-boots.rst | 6 ------ xen/arch/x86/boot/head.S | 8 ++++---- xen/arch/x86/xen.lds.S | 7 +++++++ xen/tools/combine_two_binaries.py | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/docs/hypervisor-guide/x86/how-xen-boots.rst b/docs/hypervisor-= guide/x86/how-xen-boots.rst index 8b3229005c..b6d852050a 100644 --- a/docs/hypervisor-guide/x86/how-xen-boots.rst +++ b/docs/hypervisor-guide/x86/how-xen-boots.rst @@ -82,12 +82,6 @@ When a PEI-capable toolchain is found, the objects are l= inked together and a PE32+ binary is created. It can be run directly from the EFI shell, and h= as ``efi_start`` as its entry symbol. =20 -.. note:: - - xen.efi does contain all MB1/MB2/PVH tags included in the rest of the - build. However, entry via anything other than the EFI64 protocol is - unsupported, and won't work. - =20 Boot ---- diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 68b963ce6f..981f262b5e 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -126,7 +126,7 @@ multiboot2_header: .size multiboot2_header, . - multiboot2_header .type multiboot2_header, @object =20 - .section .init.rodata, "a", @progbits + .section .init.rodata.multiboot, "a", @progbits =20 .Lbad_cpu_msg: .asciz "ERR: Not a 64-bit CPU!" .Lbad_ldr_msg: .asciz "ERR: Not a Multiboot bootloader!" @@ -137,8 +137,7 @@ multiboot2_header: .Lno_nx_msg: .asciz "ERR: Not an NX-capable CPU!" #endif =20 - .section .init.data, "aw", @progbits - .subsection 1 /* Put data here after the page tables (in x86_64.S)= . */ + .section .init.data.multiboot, "aw", @progbits .align 4 =20 .word 0 @@ -154,7 +153,7 @@ vga_text_buffer: efi_platform: .byte 0 =20 - .section .init.text, "ax", @progbits + .section .init.multiboot, "ax", @progbits =20 early_error: /* Here to improve the disassembly. */ =20 @@ -712,6 +711,7 @@ trampoline_setup: /* Jump into the relocated trampoline. */ lret =20 + .section .init.text, "ax", @progbits ENTRY(trampoline_start) #include "trampoline.S" ENTRY(trampoline_end) diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 8e63cf5bc2..4ed1d2bec1 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -57,6 +57,10 @@ SECTIONS __image_base__ =3D .; #else . =3D __image_base__; + /DISCARD/ : { + *(.text.header) + *(.init.*multiboot) + } #endif =20 #if 0 @@ -195,6 +199,7 @@ SECTIONS DECL_SECTION(.init.text) { #endif _sinittext =3D .; + *(.init.multiboot) *(.init.text) *(.text.startup) _einittext =3D .; @@ -220,6 +225,7 @@ SECTIONS *(.init.rodata.cf_clobber) __initdata_cf_clobber_end =3D .; =20 + *(.init.rodata.multiboot) *(.init.rodata) *(.init.rodata.*) =20 @@ -234,6 +240,7 @@ SECTIONS *(.initcall1.init) __initcall_end =3D .; =20 + *(.init.data.multiboot) *(.init.data) *(.init.data.rel) *(.init.data.rel.*) diff --git a/xen/tools/combine_two_binaries.py b/xen/tools/combine_two_bina= ries.py index 581e57cbc0..5f0433dcad 100755 --- a/xen/tools/combine_two_binaries.py +++ b/xen/tools/combine_two_binaries.py @@ -33,7 +33,7 @@ parser.add_argument('--map', dest=3D'mapfile', parser.add_argument('--exports', dest=3D'exports', help=3D'Symbols to export') parser.add_argument('--section-header', dest=3D'section_header', - default=3D'.section .init.text, "ax", @progbits', + default=3D'.section .init.multiboot, "ax", @progbits', help=3D'Section header declaration') parser.add_argument('-v', '--verbose', action=3D'store_true') --=20 2.43.0 From nobody Thu Jul 23 21:53:00 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; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1783331117; cv=none; d=zohomail.com; s=zohoarc; b=VHKl1ZlIGCCE7cm0jpEHYq0SsyJMDE9iVtVshDwCrhB/aQON36eYk7vNTLzX8Banljr5obvk3RrR1HVHh9mahuI5Plf18SleVPw8Dc1jfCu/xl3Kres1pgFVIiYtvy8JfjArOYK3M9g15HiZRlQkQtN1tCvTyLIQZKRUOSdmfjM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783331117; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BraaY1qC7HOBXFTxSHCrNc1y8UspO9XuBbEgUVn16EY=; b=H3OZvT9hqpH+0Xsz3kfZZkyefK9VvIAswPGPfVeGZ9DZLxeApaMQW2KKEZKIhym5M9IN8nIpD450yrtE9bL3+xjhXVNxWUcoUm8tzIZ4IynQw8rSpNoc7ia55gStayH0BgYIoXSzAFOLnKj6jCesaaIRzjZSDV4d5/Zf+7kKC8M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 178333111798521.41194574681208; Mon, 6 Jul 2026 02:45:17 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1355214.1609993 (Exim 4.92) (envelope-from ) id 1wgfsa-0007WT-OH; Mon, 06 Jul 2026 09:44:44 +0000 Received: by outflank-mailman (output) from mailman id 1355214.1609993; Mon, 06 Jul 2026 09:44:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wgfsa-0007WG-Jw; Mon, 06 Jul 2026 09:44:44 +0000 Received: by outflank-mailman (input) for mailman id 1355214; Mon, 06 Jul 2026 09:44:43 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wgfsZ-0007Fw-B9 for xen-devel@lists.xenproject.org; Mon, 06 Jul 2026 09:44:43 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wgfsY-002r9l-OL for xen-devel@lists.xenproject.org; Mon, 06 Jul 2026 11:44:42 +0200 Received: from [10.42.69.4] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a4b78fd-5cb7-0a2a0a5109dd-0a2a4504c6e0-46 for ; Mon, 06 Jul 2026 11:44:42 +0200 Received: from [209.85.128.49] (helo=mail-wm1-f49.google.com) by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a4b790a-a01d-0a2a45040019-d1558031ddd5-3 for ; Mon, 06 Jul 2026 11:44:42 +0200 Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-493c2c0b9a8so25356765e9.1 for ; Mon, 06 Jul 2026 02:44:42 -0700 (PDT) Received: from localhost.localdomain (2.115.147.147.dyn.plus.net. [147.147.115.2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-493ccd9d620sm283605205e9.1.2026.07.06.02.44.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 02:44:40 -0700 (PDT) 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; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783331082; x=1783935882; darn=lists.xenproject.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=BraaY1qC7HOBXFTxSHCrNc1y8UspO9XuBbEgUVn16EY=; b=au7mGDey2UgTbbwtTESrELm69WH6rJ9Z6FrwpW983XxBBkaZA3pfrVnqjDuFMeYWMM y36QzmCp8y0Melegmk2t56AkH4bcXja18VGsICO9eT658dc2dmgDHOB+z3xnfz7E4rmJ ZOmVI6g1ruCWGH5XpyhmuLaFzB73B6HojR012mljaEBM2c2WhuuaE2hZ1EJsPlmc7Q2x rzTI16oK7ERQC/rbwjzPzg8s42agR20BbYplYxTkrTeN+DUW+tDMgB+lNban/4jmi9yD j666SzsI4RW2CI6KmFxy6Md02olVoYDAMnI2fVw+F3lEeYID9VM9BhJ0WIUo+e70Xxs7 GuDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783331082; x=1783935882; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=BraaY1qC7HOBXFTxSHCrNc1y8UspO9XuBbEgUVn16EY=; b=XBUupeSE6EF5mih5zBX+rFHUoXfV4/w/VwjeHAwdWLBH0wWKAOIiyh/lgwF9pQ+nkQ p9gJMFZQw9iZ7gbVcWlm6V8tajvXfWrFyUJscPgWQE88ViiQyvfpiL8jxeZgdcpxpgfk jWRI7tqNx/jlE5KMA2JGO/g8HB2hrSb8rQ+VcvyPQ/+mua8SD5yYrEirBrFuF20gZbXQ zGOF70uSI88CZR+JnJATxMad6xGSXnJQKqoTwoJo8t9XYs/fxCAE9vrVapRpbARXbFoS RsXv7LgPOnD5oVklnKX7va/cm/EL/IfeowlwD9sCgxR5MbY16A+Se+R5HKs93dLoB1Nm Ccpw== X-Gm-Message-State: AOJu0YxA4cRH16zIuq5z9K8Y5U/ExCpa1oDt3mgs8RQ+U+QaEJyGwMCT QX50cP5iiVery27d0ZKMkDbzi5b7JRxBXbDM0EM7LLOoqDkefYLf6KBljoMK/ybIzMw= X-Gm-Gg: AfdE7clg83cdL1CmcRqvygWLjkarbxoS1NfhJJO3dQ2q1SeQ3L+GQKKdLi6P2l9hyfP jr+zVOr6R99p0IeasJ6GfH6fJgy3WHd5qxDx740CjJa0LhnT9mgNccU+nPiwLKmKkxyZLa/8qZk 0a0ed88NaUCS64TA2wjnRx5BqWMJbVBaweD20HL9oQKd70Y6Sct/P+npI/rbtLQPOBWNZQzX/aw 2ltbBhp9s6cNH0ent58zVzisTywxqBzipgVQuhP+NQnOJOYJm2frsfLaM86E2iAFwGbj6QcfBau OWHMTBUHU5YUfS74zcPWau7dFt1lSgjahA2ZvrVo6iU8K3PD/6lzgTxnuDF6rTWz5CkkpFUueKQ KRojSNpwpmXHOMVjLW/kE4jnJ4g6I8xkroj54hgNVBnQj5DouADW2exleg7pYqKJVbOgIrwHGtj sMX67ack+LEdOQybVC9QpkRwCbYBqdAJpAt/hUipx0GfI3IlULvhMZA3LvACsiD7TacyyfcwcoC xvZawjwCMuV2x/9/LM= X-Received: by 2002:a05:600c:2314:b0:490:e974:e006 with SMTP id 5b1f17b1804b1-493d11f6f7bmr76574215e9.29.1783331080929; Mon, 06 Jul 2026 02:44:40 -0700 (PDT) From: Frediano Ziglio X-Google-Original-From: Frediano Ziglio To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Daniel P. Smith" , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Jan Beulich , Andrew Cooper , Teddy Astie , Frediano Ziglio Subject: [PATCH v6 3/4] x86/efi: avoid a relocation in efi_arch_post_exit_boot() Date: Mon, 6 Jul 2026 10:44:29 +0100 Message-ID: <20260706094430.427155-4-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706094430.427155-1-frediano.ziglio@citrix.com> References: <20260706094430.427155-1-frediano.ziglio@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-ebf023/1783331082-77B231CC-B10C79E3/0/0 X-purgate-type: clean X-purgate-size: 1924 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1783331119270158500 From: Roger Pau Monn=C3=A9 Instead of using the absolute __start_xen address, calculate it as an offset from the current instruction pointer. The relocation would be problematic if the generated PE binary had .init.text as a standalone section with just read and execute permissions." Removing this relocation is necessary to make it safe to split .init. No functional change intended. Signed-off-by: Roger Pau Monn=C3=A9 Signed-off-by: Frediano Ziglio Acked-by: Marek Marczykowski-G=C3=B3recki --- Changes since v1: - Improve commit message. Changes since v3: - Added Acked-by. --- xen/arch/x86/efi/efi-boot.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index d738b839ee..b983f054b5 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -270,7 +270,9 @@ static void __init noreturn efi_arch_post_exit_boot(voi= d) =20 /* Jump to higher mappings. */ "mov stack_start(%%rip), %%rsp\n\t" - "movabs $__start_xen, %[rip]\n\t" + "lea __start_xen(%%rip), %[rip]\n\t" + "add %[offset], %[rip]\n\t" + "push %[cs]\n\t" "push %[rip]\n\t" "lretq" @@ -278,7 +280,8 @@ static void __init noreturn efi_arch_post_exit_boot(voi= d) [cr4] "+&r" (cr4) : [cr3] "r" (idle_pg_table), [cs] "i" (__HYPERVISOR_CS), - [ds] "r" (__HYPERVISOR_DS) + [ds] "r" (__HYPERVISOR_DS), + [offset] "r" (__XEN_VIRT_START - xen_phys_start) : "memory" ); unreachable(); } --=20 2.43.0 From nobody Thu Jul 23 21:53:00 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; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1783331122; cv=none; d=zohomail.com; s=zohoarc; b=NyfzHWFhgCRpLHV0d6F5qC0/PcdAxkcCpFuRYv55wZCwc5rAYvsQAqKkJfo41DBINZl9PQk+jKZj4OmVpd/FHlJE/OWFjvQQc0ldliTpG7kMqCnQdCWz+pm2mrUVu+z9H7q1IbWYYBxf4hRcZkB7Uo6m/o65VK/pYLF+FARKcM8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783331122; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ia93IaiRGnVFsVP6/iZrBYXvaYw/rZ06cLV16cU84oM=; b=lGyZBYYMR+U21pf450lrgl4/REbD4abBq7xISQarngG1aOcnLYyWyrrbKsaE9qaOb0ZiypDkxyo+HNyXnrFijDczr5OyU0fqJ0lpHHqJTNmbaXmpZNhg5lgLB5hGmn4mCR0izsxpneW0pnQyHYF1pL0kZ2VUnr7y8w/uiz/u9ac= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1783331122167536.8838249707567; Mon, 6 Jul 2026 02:45:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1355213.1609989 (Exim 4.92) (envelope-from ) id 1wgfsa-0007Tc-FA; Mon, 06 Jul 2026 09:44:44 +0000 Received: by outflank-mailman (output) from mailman id 1355213.1609989; Mon, 06 Jul 2026 09:44:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wgfsa-0007TV-CX; Mon, 06 Jul 2026 09:44:44 +0000 Received: by outflank-mailman (input) for mailman id 1355213; Mon, 06 Jul 2026 09:44:43 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wgfsZ-0007Fi-3H for xen-devel@lists.xenproject.org; Mon, 06 Jul 2026 09:44:43 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wgfsY-002r9l-GP for xen-devel@lists.xenproject.org; Mon, 06 Jul 2026 11:44:42 +0200 Received: from [10.42.69.4] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a4b78fd-5cb7-0a2a0a5109dd-0a2a4504c6e0-42 for ; Mon, 06 Jul 2026 11:44:42 +0200 Received: from [209.85.221.49] (helo=mail-wr1-f49.google.com) by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a4b790a-a01d-0a2a45040019-d155dd31c50c-3 for ; Mon, 06 Jul 2026 11:44:42 +0200 Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-47640541585so1723767f8f.1 for ; Mon, 06 Jul 2026 02:44:42 -0700 (PDT) Received: from localhost.localdomain (2.115.147.147.dyn.plus.net. [147.147.115.2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-493ccd9d620sm283605205e9.1.2026.07.06.02.44.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 02:44:41 -0700 (PDT) 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; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783331082; x=1783935882; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ia93IaiRGnVFsVP6/iZrBYXvaYw/rZ06cLV16cU84oM=; b=lc4GCSERlL7vHVdOWN4g54TbPs+iKkzF9wiyTcBD4e6HBFtnZkuaypXrdrTidxucpw jwvs59cupMwO/9CD7V/4TfSk6QE37OS2GAXdv34PveZnIc6uNMIcaKrPC7KnKq/BnK08 dfDCoq2Cg2pMZdnM0uBfk4IRUpvofjSTjmaCfubnqW84Laj0BE3hNznmOWQO+T2MtlR3 Ds3L41jU1LjzXSkFdWVAaqrxhpJAOIBh+XtgAQWqiqwTfiJWUhLvcNqrdISPziKiFt2P 9JSUWNo4r7K3wG65mDmayGghdb2KpILaP7n8erbPRkAj5a6xzlPg/xWyzQ2Gs9BHGqUK mI8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783331082; x=1783935882; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ia93IaiRGnVFsVP6/iZrBYXvaYw/rZ06cLV16cU84oM=; b=BgBAJaSUU7EX36q/QOXLFAHnewO22Glm8pnvG3yjPb70BDAaN0Zu0+BrbT/nXljl+7 7Y/En9A6ssps9nYODK4xxY6m/+1rxDJX7hckW947L+RkpFX3ybax9N1oPYurS83T6GAS NgTIhKER6Q/mNq2RqeL3UuRv5LejmH0zFaEeL0ioT0FYGBkxPGHvISaDCHbHGzvgnEuz BmGmR+rKTFGqz4O3CyczmXILlfqaT+BNuIGuuZLW8YXMFmM2/BPsRUx+z5QFaCs4Yr5r ctE7otUXcO58ScgbLq5B2kgnfmSt6olflBQYYmOmICqC0OMC/OKjcTVwvnCSoW9i3kmc mwWg== X-Gm-Message-State: AOJu0YywDObZ4CTMwztOdyP8rN37TmYK+Q/1ySLawW68cEqz+MVc2dor Htnb8X5hBVxSpuixx+mGypc0cCLmOmvoYQ0rAAGNR55fvu8LOgRifK3CoGNbMy+nEnA= X-Gm-Gg: AfdE7cmuGwvxOOPrhCOxbAkgriwq+Os775R+3CG7AalX/DRu0j8ZLI/aXbqKLeBpZK0 R+hcbIhHZjdtwHdhcqxcudS8ZBOE6RcCjuQX+NH4kRPlmfAH+LdO+36LCS8JTua0vf1f7KOxNwP 2BdB96eE5sjgmiD7nITGwH94KWOmt3KZtvSo+7OFiH5yRUszSLOiPerzOC4s6YJ3CO6MjLiW2Vp UFzykhhf+h0iMK+MMWMeD7fjXp3xeIgJPwZtIUrO1kz5sqdpCph3QAc3Dmqn8SmY1t6wGSBD+C6 rIkpotjMOXvHKk1yiGj7gpnGPMekTvgkB9amYZDQDKcNcvCVKyUPeeXvsZrjvLv1raZL8rLFoWN hrKMXLuBnhfqW4iSaUCWTrBCMjGAcUFfCy9zbGW/gjy0VU1YBGL9x1qz2ICz/NTaQf1T8VgUeDS x5Fsv4DRb38yATUaJuoMDaIsFZENJ87GNccmD0k+2cN23nhgfIvsqY6ZXmu6Xuj9ragghMeKeyH aqYP4gscBNlei9SBV0= X-Received: by 2002:a05:600c:8711:b0:493:aa24:792b with SMTP id 5b1f17b1804b1-493d11f15c6mr104883045e9.22.1783331081816; Mon, 06 Jul 2026 02:44:41 -0700 (PDT) From: Frediano Ziglio X-Google-Original-From: Frediano Ziglio To: xen-devel@lists.xenproject.org Cc: Frediano Ziglio , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Frediano Ziglio Subject: [PATCH v6 4/4] x86: Split .init section to satisfy UEFI CA memory mitigation Date: Mon, 6 Jul 2026 10:44:30 +0100 Message-ID: <20260706094430.427155-5-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706094430.427155-1-frediano.ziglio@citrix.com> References: <20260706094430.427155-1-frediano.ziglio@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-ebf023/1783331082-2DDA51CC-36E60BFD/0/0 X-purgate-type: clean X-purgate-size: 1957 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1783331123305158500 From: Frediano Ziglio Currently .init section is both writeable and executable, split data and co= de to have 2 sections satisfying W^X rule. It is a requirement for NX_COMPAT so the PE can be loaded with W^X perms in the pagetables. NX_COMPAT is a requirement from shim-review, https://github.com/rhboot/shim-review#do-you-have-the-nx-bit-set-in-your-sh= im-if-so-is-your-entire-boot-stack-nx-compatible-and-what-testing-have-you-= done-to-ensure-such-compatibility Signed-off-by: Frediano Ziglio Acked-by: Marek Marczykowski-G=C3=B3recki Acked-by: Jan Beulich --- Change since v1: - update comment style. Changes since v3: - Added Acked-by. Changes since v4: - Added Acked-by. --- xen/arch/x86/xen.lds.S | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 4ed1d2bec1..e26e37db13 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -193,11 +193,7 @@ SECTIONS __2M_init_start =3D .; /* Start of 2M superpages, mapped RWX (bo= ot only). */ . =3D ALIGN(PAGE_SIZE); /* Init code and data */ __init_begin =3D .; -#ifdef EFI /* EFI wants to merge all of .init.* ELF doesn't. */ - DECL_SECTION(.init) { -#else DECL_SECTION(.init.text) { -#endif _sinittext =3D .; *(.init.multiboot) *(.init.text) @@ -210,12 +206,12 @@ SECTIONS */ *(.altinstr_replacement) =20 -#ifdef EFI /* EFI wants to merge all of .init.* ELF doesn't. */ - . =3D ALIGN(SMP_CACHE_BYTES); -#else } PHDR(text) - DECL_SECTION(.init.data) { +#ifdef EFI + /* Align to satisfy UEFI CA memory mitigation. */ + . =3D ALIGN(SECTION_ALIGN); #endif + DECL_SECTION(.init.data) { *(.init.bss.stack_aligned) *(.init.data.page_aligned) =20 --=20 2.43.0