From nobody Thu Jul 23 22:28:35 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=1781630940; cv=none; d=zohomail.com; s=zohoarc; b=LfixHgRR7itX2iinvFXh4NPw+wFQwbnQDFiOsVWAQFdVTkrSCL3SNAGw1ZAbTqy8SvI/9eUW/xsAc0XBJc6RXsKLBRrj9qJFNI6g0LQUYT9fFYkLv8xOYmRYotSsvK4JLG/7+3Lz1+AGXMCyMw8+45XSe66YAjSk+rl677e6Awc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781630940; 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=T5ZX9dmJkDiN34cxHkkBNBwcyGdjITLJ3elG4nDDaKs=; b=K8dtt6kUy82Arvo9eljiSX7qt90qvrE6Zw4ixIdSNOyMSuAvyp1IuRmOmDr/pyIdH+kPeXGJcpvxJVLNoHPxvrgGmdAYPmlEVxD3YzC5nWbVe1ViHsIa8Myl9UZfNMc0Mi9FyT4SPyyNm9sCj74ABYSu/kuv6w4EPE8N026xm1k= 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 178163094089764.58945012513516; Tue, 16 Jun 2026 10:29:00 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1339506.1600716 (Exim 4.92) (envelope-from ) id 1wZXaY-0004kZ-Qk; Tue, 16 Jun 2026 17:28:38 +0000 Received: by outflank-mailman (output) from mailman id 1339506.1600716; Tue, 16 Jun 2026 17:28:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wZXaY-0004iy-Md; Tue, 16 Jun 2026 17:28:38 +0000 Received: by outflank-mailman (input) for mailman id 1339506; Tue, 16 Jun 2026 17:28:37 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wZXaX-0004hE-K2 for xen-devel@lists.xenproject.org; Tue, 16 Jun 2026 17:28:37 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wZXaW-00FwMQ-Oi for xen-devel@lists.xenproject.org; Tue, 16 Jun 2026 19:28:36 +0200 Received: from [10.42.69.10] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a318794-2eae-0a2a0a5409dd-0a2a450ae170-36 for ; Tue, 16 Jun 2026 19:28:36 +0200 Received: from [209.85.221.46] (helo=mail-wr1-f46.google.com) by tlsNG-4011c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.1) (envelope-from ) id 6a3187c4-56b3-0a2a450a0019-d155dd2ee83c-3 for ; Tue, 16 Jun 2026 19:28:36 +0200 Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-46013161068so2446792f8f.2 for ; Tue, 16 Jun 2026 10:28:36 -0700 (PDT) Received: from localhost.localdomain (5.116.208.46.dyn.plus.net. [46.208.116.5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-461abb44c3dsm5012754f8f.9.2026.06.16.10.28.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2026 10:28:35 -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=1781630916; x=1782235716; 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=T5ZX9dmJkDiN34cxHkkBNBwcyGdjITLJ3elG4nDDaKs=; b=fo6FO9Jt50m/4eX3KWElo0BYmPURrr97Nii3QiGs5zJScjyBnZeLqkui6q4dquS/On F4LEW4VaV3ve4qs2UQSTbLiGFlNCBbxr6A/442WMQ0xFFpX2BXEhAY6w8Bu/QyAA+K6o E0WOLMW8+xIpI4AVfr7Z3E9kXCb2Q+reI/hYxdcaKzyzFFmpTRo6aEdlBkjuj59i6zT6 /whFMfWKLPnMelj2X/N6Q7c72ans7KULuzuacX753J/f3Ac1zeb5BTVFV/iOTSLFTGoz DsMSGDFIJRc0gA8I4OiIhIcZvNspA579VpLV5L/Uhdp5zGFtT0hnthy9AZKEgrJnTZKJ l1uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781630916; x=1782235716; 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=T5ZX9dmJkDiN34cxHkkBNBwcyGdjITLJ3elG4nDDaKs=; b=K36oPcXCwdICudsJJsqjtrZEe1NC5RAL7Punh2CPQ9S62u/g7nXYC75gnTl7eZW52W jujsl8ZJU47C2+gmRe+O1y+2L8GHOdBfqwdPW4K4ypTbmfYCmkvQeM+5GvsgDxI3uvRs gtQjoBA4OpO+3y8DLGLqj9X9cs9hd0chRllXiqNPw+i7cOvDkLZr/fJZwlFGyp/2AjI1 pm1b7anb/3N2eIJSyylDAh8pBWv6R4Qc7rEkS9j0AxW53FTrzGE/8o8uRwfdDKXAt8A4 yBTwRqsRiXK8oYcSaXitbygEJeuFhr508qe6h78qc4B394N9jkEI+mVorW6ttdB8A3B8 rgfQ== X-Gm-Message-State: AOJu0YyyXYFfA5SA4h6rf/6QSUpRJHBKOknBTReVolRa8NjhEZcHDw3L EHa9ZI3MzGHxEDeeZ+EoiKoiJbG0Y3lIPpl8/VS6ll6kthCm1GmLD5hDavYQnrTCK9Q= X-Gm-Gg: Acq92OGbAXAyXls5TCULZHg8sNcCXKWqsZaLL7bMi8oPYIFUkeUUiOhr+Qhq7HjnmiH huaXj9IcYunqfJqRVRvI26wWsuA5n2RmwaFBTw0Tg37W7BuM1sZo+ozFG/32MCdyc5qw6XIx63F PNQ5crVxFvDCky9GpOUQr4Kj+eSMzukUbhHFv7WOFcZxtidHHpBMi+fYJ6OjDAuArjLq4gCdeqT cSo2d7mzwpMgq2MxmlOJLJfC9F9EDaQOGFdME7ZH2y1/n9pU4MPVNM5Uudell2e/QL8qdwZhk35 d5GOZYmtjN+IXkU0V+KzPPB19rgKG7NSLjmQ69cC2QVIIV2C/Zf6j4eXhzQ+8TrwM5niXiogjag 44sDCBK5WEB4IxpTsoRRCKtyoQoJXR3DBLNWGGe1ArQ17rnbZgmKV6D4yrdCzDlY65tzJDeC4Yp g8p+kUBlF/TXtUuY2QvnpFGQVJ8ChuIRNYVUxNaw0Ias/jHXqNPO52y0xzx1bbEKyzccKXppfdB pXcwV3Jm6a0BVhStZsg6PKDCDgZdkjDaLhJsA== X-Received: by 2002:a05:600c:4f93:b0:492:29a1:98c4 with SMTP id 5b1f17b1804b1-492333e8d1fmr7008005e9.8.1781630915917; Tue, 16 Jun 2026 10:28:35 -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 v4 1/4] Align relevant sections to 4KB Date: Tue, 16 Jun 2026 18:28:27 +0100 Message-ID: <20260616172830.111393-2-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260616172830.111393-1-frediano.ziglio@citrix.com> References: <20260616172830.111393-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-4011c0/1781630916-7D1848B7-8FA6B5E3/0/0 X-purgate-type: clean X-purgate-size: 1911 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1781630942359158500 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 -- Changes since v1: - Change subject. Changes since v2: - Improved commit message and subject. Changes since v3: - Added Acked-by; - Improved commit message. Acked-by: Jan Beulich --- xen/arch/x86/xen.lds.S | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index b9e888e596..f758940674 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,7 @@ SECTIONS __2M_rwdata_end =3D ALIGN(SECTION_ALIGN); =20 #ifdef EFI + . =3D ALIGN(PAGE_SIZE); .reloc ALIGN(4) : { __base_relocs_start =3D .; *(.reloc) --=20 2.43.0 From nobody Thu Jul 23 22:28:35 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=1781630939; cv=none; d=zohomail.com; s=zohoarc; b=CF4Hg389KvJ50MTcZKMCsZgffRK0Q1YxvzYBcvQiX4j71GYQIoHRD0p12Bga8jwMjcMhC411SNv3ccpa6sD3If9XmhU2kCve6IfI5YFLsJcMVGoKW/AcGx5tGtDaeZZaHwseN678nI6AjWEPHGFEdeZrlR3sBeppdRnZmeQLWXM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781630939; 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=59pkg3zSgN49JGtId9KEQHL8kPDSpSqdyB2+a04J4NI=; b=ByACO5XT52yjxQ2Rm49CdcAFxJii74/qBje2aGC5ZisXGwaAY7Vj7xcGWEr+3qz8YOgztj2B+l/QsGVIBVs3n+Dzx4cRHXwLYaLCL27AFCXBfsawZ2zF4o5DsZxqGFb4BSJ68YpGhHdtdm6PKvyOY0CTiTzhxZgvgPOiRZTUBg8= 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 178163093932788.78473204339264; Tue, 16 Jun 2026 10:28:59 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1339507.1600729 (Exim 4.92) (envelope-from ) id 1wZXaa-00057V-1e; Tue, 16 Jun 2026 17:28:40 +0000 Received: by outflank-mailman (output) from mailman id 1339507.1600729; Tue, 16 Jun 2026 17:28:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wZXaZ-00057O-UQ; Tue, 16 Jun 2026 17:28:39 +0000 Received: by outflank-mailman (input) for mailman id 1339507; Tue, 16 Jun 2026 17:28:37 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wZXaX-0004hP-UY for xen-devel@lists.xenproject.org; Tue, 16 Jun 2026 17:28:37 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wZXaX-00FwMQ-BU for xen-devel@lists.xenproject.org; Tue, 16 Jun 2026 19:28:37 +0200 Received: from [10.42.69.10] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a318794-2eae-0a2a0a5409dd-0a2a450ae170-40 for ; Tue, 16 Jun 2026 19:28:37 +0200 Received: from [209.85.221.44] (helo=mail-wr1-f44.google.com) by tlsNG-4011c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.1) (envelope-from ) id 6a3187c5-56b3-0a2a450a0019-d155dd2ca9a6-3 for ; Tue, 16 Jun 2026 19:28:37 +0200 Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-45ee5cdbd28so57857f8f.1 for ; Tue, 16 Jun 2026 10:28:37 -0700 (PDT) Received: from localhost.localdomain (5.116.208.46.dyn.plus.net. [46.208.116.5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-461abb44c3dsm5012754f8f.9.2026.06.16.10.28.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2026 10:28:36 -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=1781630917; x=1782235717; 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=59pkg3zSgN49JGtId9KEQHL8kPDSpSqdyB2+a04J4NI=; b=OAqTQU+HxiuNVB9Oo2EoEDXCndEyokgxjdsmHp9QfJbEzn7T/XDG9SngmeMvE+EdbU w5JcdaB0FwwThuO/gzZRSDmKoEIIOEnCkbLzcs8Mod7HonMaQldMAbQKyo1VfYApUtjh +jYSJJjakrmPE1JWG5vdISu06GgDA9qwMFwnvdll+2rnSph6uf5aobwrBpVHTM5u0lpb 1dtp8i/tOzoSrwWek0LODVPnkihYqEsgQQEE3JoPp6ZH896IDZKkxFyfa5+jJ81tXjy0 BCq8esypq0xwniUj1sAIh/Sr/qs0xDMR9Mz6TvPhllNJfbLea+OPyDXlUY+MB9kjjrj7 aE1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781630917; x=1782235717; 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=59pkg3zSgN49JGtId9KEQHL8kPDSpSqdyB2+a04J4NI=; b=Dg87dMh5sOC0dL3kpWD2Oa4crUJfpRZcBEzT2C3/nIyEh/c9VgsbODtc2LgGCFSrSn P0VwtnsCoAAN4/BopyE7AlRdQUunsbyGNCUl8bG/8JBphhbvgeu7BzaDw1VxaM7OkvdH SoooYsAyd5f5/zaJijmKxJJ6W1a/HrwnqPa7AdaBieDTipg1igBpm+CcTUwPZfp/enSw ecr27TZpbPyZKmTjGWeILUJDTMss9RDnwdNXFWOA12+73tjOqFyFL9ImMcJPmXuvqGuD C9UoY3J+2rZQv9ROPT/UAS5/G/wsyxhKzCFFVDGt0AY7ySLaqQ8Wjk0qWrqP9hsD2ccD otcw== X-Gm-Message-State: AOJu0YzRL0wwKjkkgWi5Yg03+MMCdZko9yDlt/uO7x9A7T/J9KmLDm69 D5xNzJhdvZAWdjbJY9VVciM3DpgphPdBBSUwUJQBSCBzrAH2nH+DixIXhCsjGHbKlUs= X-Gm-Gg: Acq92OGtBvukgfyEXO9HnNwKm0P8VzJVf0mTvxttXEou+0sa3obOyLbVSMHa7YmnPVj S0IJVNyf6UoZUZFAoeutj9iJSnNvLJw3vKjnbyPjeXGrYD/pd7TzK/GsH9ctdxon8/1s9sLmhOj 80aWxCt5qvB8U0+VPadoB53v1+5evuyyFf0aF0CBNHxUxEOVr30o/1MHdJe+Lv8OYouTK/ObaZP 7nrlxS5SyHeCMwEYNkQle4xp2j4wTiKKhd6vP/iTcS3JeGW1YMnWL8RfTQ1RMgdSzxbEO0Dmsqc wQx27GJAsdExfZY3+gwSGB+RKVEU6sxulJKLE4wiM2wAJnjYYcuQkIoOsPHb7R+Vm+vzwKkFv7s H9WR833IHtej/CHaUuwH1vES1rKnSaagdxg+GsEp9TpE/cvwIz8lcbl7OVgDgJleZPzQwzjC6Ju 70bZ0cinlfY7WVCDRHOofNIOZx3J1KTloBMMZA7v7xdQTp9UincLJTvYaB0B0ziy6JUZAe0Tjr3 LC2xoDm5dG2eXK42Omb10F9h4E= X-Received: by 2002:a05:6000:4313:b0:452:bc74:b129 with SMTP id ffacd0b85a97d-4622d0504d5mr1149300f8f.16.1781630916713; Tue, 16 Jun 2026 10:28:36 -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 v4 2/4] x86/efi: discard multiboot support for PE binary Date: Tue, 16 Jun 2026 18:28:28 +0100 Message-ID: <20260616172830.111393-3-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260616172830.111393-1-frediano.ziglio@citrix.com> References: <20260616172830.111393-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-4011c0/1781630917-7196E8B7-40CB9574/0/0 X-purgate-type: clean X-purgate-size: 3030 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1781630940179158500 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 Acked-by: Marek Marczykowski-G=C3=B3recki -- 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. --- docs/hypervisor-guide/x86/how-xen-boots.rst | 6 ------ xen/arch/x86/boot/head.S | 3 ++- xen/arch/x86/xen.lds.S | 5 +++++ 3 files changed, 7 insertions(+), 7 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 77bb7a9e21..90faf411b9 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -152,7 +152,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 @@ -710,6 +710,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 f758940674..749d9719cc 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 .; --=20 2.43.0 From nobody Thu Jul 23 22:28:35 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=1781630943; cv=none; d=zohomail.com; s=zohoarc; b=D/n66r9gQL/nrmEEoOWHJFR/P93VtwBRxQcGAStg66gbDU8cAmQbOIGvf1IM+3wWDEeYHmNS1e+cyBjYIOuFeL9fqdV+PDIZOv+IZISLJ9QgoGd/yFRSznqCWyPriIZ7wbrcC8O/5YfidnAYFGBWS+v127lNt7Pld2KtlI5CqBI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781630943; 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=h7zgfFDoBBPNpJ7qeY1DSNzH5DJ0mfqwAdGCYD7M6W0=; b=g62ZfubEi1ATIfKi05C00O7s9C6gxpniuK8jqx04w5CWtc4kXR6MOharR/aOgSn3dbjFIcAUiE98Bp4/xTrnbldm0wIpO20ygfXvctaKlUsEs4iW3QnZsnqxY17xaQVAsJCKh1Ca2HtZ8mYyxwHzvVgIP7IJ0I1wIHEhkXQfjV8= 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 1781630943409391.6229397099536; Tue, 16 Jun 2026 10:29:03 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1339508.1600733 (Exim 4.92) (envelope-from ) id 1wZXaa-0005At-CE; Tue, 16 Jun 2026 17:28:40 +0000 Received: by outflank-mailman (output) from mailman id 1339508.1600733; Tue, 16 Jun 2026 17:28:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wZXaa-00059f-8A; Tue, 16 Jun 2026 17:28:40 +0000 Received: by outflank-mailman (input) for mailman id 1339508; Tue, 16 Jun 2026 17:28:39 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wZXaY-0004kp-V7 for xen-devel@lists.xenproject.org; Tue, 16 Jun 2026 17:28:38 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wZXaY-00Au7B-C6 for xen-devel@lists.xenproject.org; Tue, 16 Jun 2026 19:28:38 +0200 Received: from [10.42.69.3] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a318794-bab6-0a2a0a5309dd-0a2a4503ae7a-44 for ; Tue, 16 Jun 2026 19:28:38 +0200 Received: from [209.85.221.44] (helo=mail-wr1-f44.google.com) by tlsNG-33051d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.1) (envelope-from ) id 6a3187c6-672d-0a2a45030019-d155dd2ca4e4-3 for ; Tue, 16 Jun 2026 19:28:38 +0200 Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-45ef1198766so70625f8f.0 for ; Tue, 16 Jun 2026 10:28:38 -0700 (PDT) Received: from localhost.localdomain (5.116.208.46.dyn.plus.net. [46.208.116.5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-461abb44c3dsm5012754f8f.9.2026.06.16.10.28.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2026 10:28:37 -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=1781630918; x=1782235718; 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=h7zgfFDoBBPNpJ7qeY1DSNzH5DJ0mfqwAdGCYD7M6W0=; b=aXC0sFGT3UZC7hN8LYImicKW06h+nj0WJQU3UBBE8pTwpftVpvbFu7cuouivpGwHe1 WXCkigmORmZg95k3RBLrJF6zKc6rJZB/A8228hsJKllJZszi0qS/AmHIVxNNj2oNcbjA qP0DPDuigtdQZG5M45WyvIem5Nlvw0Qa7jE3u8PDr0tplBiDFwhWJFRHILizJ23OSeuD zX1Lj6c6Ea3ExKsdQoZKqXxjaj3PIMDj2hs5XKie9PxC9SimLMBNE37CRyJetsFK/HT8 moNcOqcvSwHbj/+0DXA4aza+Z5bq5xjv/PUfpSG6lLy8dRZcyAYq0EX/wyAg/Oh/TF45 B4ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781630918; x=1782235718; 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=h7zgfFDoBBPNpJ7qeY1DSNzH5DJ0mfqwAdGCYD7M6W0=; b=Eo8aQofbxbIpeOY6YFIuCE6EInMhU8ito8wKBTt6JInX61cdn3I70T5Ge5zgtpjzfC YZQU9eoBrViIU0ux8JLIljlGmaQasUr9iEJe+3I9ByPHwU1fd255EGAVcjzzcVmJQtRV RBOZty/Z2jPGUeYJRcs0mT1UgtZXXXpHa5CGRz8uQ12a2vPV7XChYFQpGtFnNzY8+EoM 8Uz1Bp27ed207DNbjboOI8Q6Eojmn7DFiXjgUDcO4efTsAJw9UBVc7AHkH+boxMHl5XV xTX+J+uO/ZFZmBCEBU124SOl9k/tfWdwnqCC3i5BQFM9KcIm5ax2EvsMBs+4dnCjkqJW CAjQ== X-Gm-Message-State: AOJu0Yx8713vMDo5rwM+WuX75a7fbD9dk5PeFeNeKeHPNFGFIibkPlHr cX4Iv42KyP6eqUO65M9mLfrF4ZSU/Pq+DO/brPWxsvwyw3Mr5ZdbU4MiWhXJK5bzUYo= X-Gm-Gg: Acq92OHpbVQO4KXZeG95fND4I6X6xCCqD5k9lWAwL5r1O4V+JUsmNsZzM6wmh0rsHu8 tVUqFlS1Yo3oyamfwJY3FrMgiS1R9w5tZUhvDn6h5Nf2ANA5DFjzPNlf9JiMQWpwGarcpC7IiEo aaq4E7FOkAXm/fOuaTbRYX3GGU58TrESanSVz3BLkLu0lxX+9pEQHnEhISRqwdhmVBBDTCMJsDD hKHQWHgvsZeV49fP/JtrXLSoMmK7f2IdymTEEzlSuEeuJqyBqCKRuI5y3dBoCr6kbju4RE2t4tF AeD3SkCR09ZBLVS/v1H3KGSODHyBb0wwX+xuZARFBlCC54WgYs3keRllm4r9jbrexT7wuVa2Qih e0giZtcmOgSlSoXLBNNfQASNXxm9M4bFSnP3oM2Ii/Q7gC5lvOdH1ljapRJxsVLrx/lyM5iKylt Uv6JAX5jKua+PQUJkiLrMTOOxLHG+pr/ZHbX/6Xok2inocDtjRrw4uHxDT4kY9fPpyQruSvjKQL ft/hb2OMuu4MyMZVHsAqjb85Jc= X-Received: by 2002:a05:6000:4902:b0:460:6b12:1783 with SMTP id ffacd0b85a97d-4622a7dad13mr1171084f8f.4.1781630917514; Tue, 16 Jun 2026 10:28:37 -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 v4 3/4] x86/efi: avoid a relocation in efi_arch_post_exit_boot() Date: Tue, 16 Jun 2026 18:28:29 +0100 Message-ID: <20260616172830.111393-4-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260616172830.111393-1-frediano.ziglio@citrix.com> References: <20260616172830.111393-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-33051d/1781630918-4279C938-AF5D7944/0/0 X-purgate-type: clean X-purgate-size: 1923 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1781630944169158500 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 22:28:35 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=1781630940; cv=none; d=zohomail.com; s=zohoarc; b=DezkYnV9JUJAmt5OjMxokkJBO56N1Or5HzGaITNnv9vxYhXUpu1Xn6xV6OcoK5H3nCDC7X4B/O5wNS+QdxC8g6iMHFZca/Va+rWubO/Zzs4XXBvRov/PwJlG6xMKacgpv/e/N9h67omGw45QJ23IPPDdjIKWqMBdlg0NRrf6/L4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781630940; 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=gBtC0geG/tAfPA7o0MJitiKqtMfuEi6dV5S/o3JXoz4=; b=AhxUSa6ONRLacgMzq5pwPlYyXvIkEhRPY+UwunF/WH9xuBvwCnkMKHZGtJHDwbZY6j3mVpl1o83pQ2WgkFiihUIeMj9/lM0bw26U4pKsKqZ7R4CKOqogtCoTHNDSPiWHy4N+BhHSBonIuhgOkLNN4xTZi64drFE6HIh/zzF/EJg= 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 1781630940568339.0751089014726; Tue, 16 Jun 2026 10:29:00 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1339509.1600740 (Exim 4.92) (envelope-from ) id 1wZXaa-0005GN-N1; Tue, 16 Jun 2026 17:28:40 +0000 Received: by outflank-mailman (output) from mailman id 1339509.1600740; Tue, 16 Jun 2026 17:28:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wZXaa-0005F5-HR; Tue, 16 Jun 2026 17:28:40 +0000 Received: by outflank-mailman (input) for mailman id 1339509; Tue, 16 Jun 2026 17:28:39 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wZXaZ-00051J-LO for xen-devel@lists.xenproject.org; Tue, 16 Jun 2026 17:28:39 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wZXaZ-00FwMQ-1S for xen-devel@lists.xenproject.org; Tue, 16 Jun 2026 19:28:39 +0200 Received: from [10.42.69.12] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a3187c0-2eae-0a2a0a5409dd-0a2a450cbeac-10 for ; Tue, 16 Jun 2026 19:28:39 +0200 Received: from [209.85.221.51] (helo=mail-wr1-f51.google.com) by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.1) (envelope-from ) id 6a3187c6-62f1-0a2a450c0019-d155dd33c199-3 for ; Tue, 16 Jun 2026 19:28:38 +0200 Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-461a15bb819so860527f8f.3 for ; Tue, 16 Jun 2026 10:28:38 -0700 (PDT) Received: from localhost.localdomain (5.116.208.46.dyn.plus.net. [46.208.116.5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-461abb44c3dsm5012754f8f.9.2026.06.16.10.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2026 10:28:37 -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=1781630918; x=1782235718; 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=gBtC0geG/tAfPA7o0MJitiKqtMfuEi6dV5S/o3JXoz4=; b=gFvFiyRb/zSgj3MpUgRJS1rO9P7Z11MOrqO/vOoXr0EXJQVpji2Lp06lrF9wb5R3f4 Dm8wKPVTsYMFMJYs29Fal6mgtInqwjSs2wEWO7dZq3s6DZQ4LCp55KReBcBPrT8vJXLu b2SSS1NRZcKq8n6gDv3tlZKsQJdM0Ws2LJih02Nu1pUal6Z6O2bbCFoXqoRjVvZYcL6+ krR0KgNquBtdGorfGaPHZcdGkfS54VnnPc6fziUk14vFGOYZnjVDxTgKLLUlyuvc1uMy NZa8cWH8jcxF7pSApIxo1xChlax3yWfjysgzr1yZ3O1PZLuJVJoL/ZRq1DT1qW+1oSmw 0Zsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781630918; x=1782235718; 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=gBtC0geG/tAfPA7o0MJitiKqtMfuEi6dV5S/o3JXoz4=; b=ZXpTmTuWgkAbfihCb5NPsWzfkNM/9eH+SJVdeEf7EYmse1qdDlF5vrxbV8z+a0M4UL vpjHEpOkDwE9p6Z7LNewqdpRz8BMOo58XXqcH7mYequSlxotLqr6bzXnu4AJ80mIG5wl 8lEu8SjTpy0aE+phLx5EL9UK1lMceVhkA/R6hi+tU6oTm+Z+bcqEzl+m4hI8rHMRMAjx RRZ7dif9ja64Uebtet9EPBg/u3Q/ILCvyZbsC7w82eqeK8xwZ3icmLMm81bkQfchEQkD BdlVUz6bZ1T77ioYwa9R02M+m7pwrtfa8fcnWrd4S5Oej92owRa8U5maEzwcXetucCqq bn8Q== X-Gm-Message-State: AOJu0YwLKbbjhf0qnPZQJxcgCHZ9I09H4PY9yFmqHjIz8rLtEJK782qB QcS45gj0hlXcinnlTBmm6/H8EJQVD3dFPGBElri7Jq+R03jVxuNXsiduWQARfeYo+KE= X-Gm-Gg: Acq92OEHiFrY6OfKztjpbuUMSHUGyo9BAyMUJW/975u29CIQCSuQjywA+9nEIMvboS0 yMiDbzAaXh/aW358FxvQv0Xda4r9YiNo6vGAhKZlVIhJnbNDyc1CRuy1ZJ7cVPUrMC32R+RqtxQ Jp5CNSBBXFFOjwKIP3Fyk2mvOv10pTwY7ARn1rcyTHcaU7c+8yqlaeZpETueScLVUOMkdsecIxn TQFnhfXCSOKD5OYB4vUYRBTvG/WGMDm5u10zBFXBsApT3GtgRbAB1gIfRvc5Sba17s1SF4DYDyp CbW+HkzZftk3hOwzIKDNy3m9iW2wqL0LeHLedJjuG/rmgjlYVIduUavziD5zyX4UbgHudFgiNbX yCdBi3wmoZVK1MsTHDlpjIY1ADQGntooh0qYqzmjEUjgNojnwzhomaFDFCPXVCOnmRqCTHykeGy 6gh+07N//uymVIWf20n7l/njtOhnAjfgS2F4wqhFO17sOKsRyd1kgZeWPV4tXFHCFrRfwYOBAGQ xfDCJSP/VwtQc7wkOxyGddvv6k= X-Received: by 2002:a05:6000:41e3:b0:461:9459:874c with SMTP id ffacd0b85a97d-4623fe7ddfdmr468263f8f.19.1781630918303; Tue, 16 Jun 2026 10:28:38 -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 v4 4/4] x86: Split .init section to satisfy UEFI CA memory mitigation Date: Tue, 16 Jun 2026 18:28:30 +0100 Message-ID: <20260616172830.111393-5-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260616172830.111393-1-frediano.ziglio@citrix.com> References: <20260616172830.111393-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/1781630919-F5983CF5-CBD32945/0/0 X-purgate-type: clean X-purgate-size: 1873 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1781630942358158500 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 -- Change since v1: - update comment style. Changes since v3: - Added Acked-by. Acked-by: Jan Beulich --- 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 749d9719cc..8fefda1816 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