From nobody Thu Jul 23 22:26:32 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=1781604854; cv=none; d=zohomail.com; s=zohoarc; b=ZkOo3PYq5I/FVsGVdBVaRFC8icXiWeCqofoxqHUEeyMcSmbX5ipWvPGHaaJ1J1jMROUsw2v/A+Lo1zD4vsBW76FNfYMuutLrGxLDdcJK5cj+217wUhx5GolktL8FrrCzz7mhsX3rVh8GzhuiB42vqqW3xLPI3WHZqrrakQ13zjI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781604854; h=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=+S0H/QLubDb3sFgEIhvI4x0YN8vi9tpwyxDi8HASuUs=; b=KYUBDm87O5uoK7QSG3jjtRw0tGD2jAYpBS7d9tEdVV4ATgXs0UmG0wNNGepWbJ52sSVHueuiQ+fpZsQnbLrkXJsTeT0gO9j33dvHXGPQHWqQM0BhpoVeuC2/FuUz2xTb8lkXTx/VJiIXhVRHD4Rzto/o8Ldgif7auI7+lNFnUWA= 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 1781604854501992.2355821637859; Tue, 16 Jun 2026 03:14:14 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1339036.1600153 (Exim 4.92) (envelope-from ) id 1wZQnl-0003ie-E7; Tue, 16 Jun 2026 10:13:49 +0000 Received: by outflank-mailman (output) from mailman id 1339036.1600153; Tue, 16 Jun 2026 10:13:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wZQnl-0003iX-BB; Tue, 16 Jun 2026 10:13:49 +0000 Received: by outflank-mailman (input) for mailman id 1339036; Tue, 16 Jun 2026 10:13:47 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wZQnj-0003Vf-HZ for xen-devel@lists.xenproject.org; Tue, 16 Jun 2026 10:13:47 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wZQni-005R6q-AO for xen-devel@lists.xenproject.org; Tue, 16 Jun 2026 12:13:46 +0200 Received: from [10.42.69.10] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a3121d3-5cb7-0a2a0a5109dd-0a2a450adce6-18 for ; Tue, 16 Jun 2026 12:13:46 +0200 Received: from [209.85.128.42] (helo=mail-wm1-f42.google.com) by tlsNG-4011c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.1) (envelope-from ) id 6a3121da-56b3-0a2a450a0019-d155802ad449-3 for ; Tue, 16 Jun 2026 12:13:46 +0200 Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-490acbb0f89so28236405e9.0 for ; Tue, 16 Jun 2026 03:13:46 -0700 (PDT) Received: from localhost.localdomain (5.116.208.46.dyn.plus.net. [46.208.116.5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490ea94f5b0sm295160265e9.1.2026.06.16.03.13.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2026 03:13:45 -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=1781604826; x=1782209626; 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=+S0H/QLubDb3sFgEIhvI4x0YN8vi9tpwyxDi8HASuUs=; b=siiGdRLpMsI4Syy8sMkON7gq6nvVKeCPs1m7SVDIJleK4nBrRQwxqLhs5iBRCQv9/W ev+fuug2XypuU5rdsgGMYEFldk4luB4sKxzQwjHMtJfREi/lQbIlNfXhZhc+FpzY+bUs jUFxuaR9MWL1hRGgqBd6hPBK0P4WaumrMsqGp6puT1hEvTURc9l5IxPUt96bD8gExajn 5AbsJGx84zjt2/4v50w2O9WUbIfP8SBqGKmHt2MMILTl7Epr6xdInd2zCP9hAynlM1YK yet76cqPTnZNhbdKgnLnn0fjHqp6dwcU9RAfs55PYc7bNZb+pPpf1n1j2QOwBduYDBjN sKiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781604826; x=1782209626; 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=+S0H/QLubDb3sFgEIhvI4x0YN8vi9tpwyxDi8HASuUs=; b=h9HOzeWsP5aAcr7vBUiuBhKx9LnSHm5fUKeBp42j1PGFl0vOfs/vMcy1xn+FxSICva o5+T7+AZNQj5IiuQTKpfUw5F9G/04w/tXoUN9J1Il79B50RiG44qGjXW7unJksNNyPxV 5GRKyxCcxXoWCYKkmZrAiFmG16x4s+32HAAwpABDZwHYDI5RmZ2orAyZMP9Keu1K+Z5d LfwEg4akEenGUN7wULZYKopJ9b+++MzaBxqdLKtSqe/d33GespIcBM6IBtPTPBKTmqQ+ ddE8rux7++8bYJWTCztU5s67sv7J1Gjb8PvlksGU9cRXEo/Hv275W9jDIy3aNh0ZfUcH 0Lkg== X-Gm-Message-State: AOJu0YwWUH5+whKmHC2HdQ8H7y9Lnb9ggx5lEHscn/CbjF0gO8A/GqED LhAYSIJgQLDdfDi7K/zo+sBTtCNJOF10n+aWWqhkFel/mlMFggeJuJm0NbupbNBS5QM= X-Gm-Gg: Acq92OEUbqzKl2soN8q1GVguHlrU35dBgQVP70q0eW/CSPfBNAN1tlXr4uWZ5ecyajK VxIZrxrDdGD7/eCRfHqPR3PHWciX5suxbwOzYftz5r6KUlo0Wjdijd2DcODhgTZF+dq92Xe0QAf Nnb6nQ3DpAxjDnQLMTfb/SwZYaXD0x9iHDuSPnwXem9EBGF9up6Cx87YfzvVWadzi+e1y9XuNEb wuluvE7It8DGA8hRzw582dD8VTjP6DagOqpC7N3UZ1CzdxsrwhR3umMExqyAAb8eq3QtXIuSO4b R0uPer8AjcwQu/vqRPQ/oScBHMLr2GR+CpIOnO8tiMCGkh5VPYBzp9k/r7qnRQupbRfJmM9/yRE NwlL5Hz9ZY9+lbuVDsmCUrfmPPuR2E2A//A5HdquoMZWozTqQ9M6zPDn0gjLw/yp+GT7CJvDwE+ p8mcROqgm/5QiIou5AzPAmft8jXSKGoYWdLHUbr5jC9LaivV99ZK1HBNoXXgnv0Q6Ldl0S98jUa jbfjASphOfaucjoClGmckK3z29yJnOTZZzGqg== X-Received: by 2002:a05:600c:1392:b0:490:a646:9d75 with SMTP id 5b1f17b1804b1-49220091dbemr176687055e9.9.1781604825392; Tue, 16 Jun 2026 03:13:45 -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 v3 1/4] Align relevant sections to 4KB Date: Tue, 16 Jun 2026 11:13:33 +0100 Message-ID: <20260616101336.44009-2-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260616101336.44009-1-frediano.ziglio@citrix.com> References: <20260616101336.44009-1-frediano.ziglio@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-4011c0/1781604826-731728B7-EBA06A78/0/0 X-purgate-type: clean X-purgate-size: 1606 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1781604855310158500 Content-Type: text/plain; charset="utf-8" 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 so it's not an issue if they are not aligned to the page. Signed-off-by: Frediano Ziglio -- Changes since v1: - Change subject. Changes since v2: - Improved commit message and subject. Acked-by: Marek Marczykowski-G=C3=B3recki --- 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:26:32 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=1781604851; cv=none; d=zohomail.com; s=zohoarc; b=KSeGLZ0faziCmzIe5sIX7i4bSMBLpN3QxHP75GvsS2cmslaxnrhgbI6z5XYhrDNvAK42JMV3j/DSyxefh9PbRGLksHBSJOQwDv3MIPBjQ1oXkj51/rJAZbqiJM0ddRLoWxx3lc1qpaC7sx6bTRH0CDYXHDViaQHTapkGyeflL34= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781604851; 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=SOWAHlvQ+YJJWAhAsIp9IubNkCtKgClYad2d4nRRdf8=; b=cr91DPpI9OiTMnZW279pjGsVjB4aMj0LTcxUD/KvopSo1pxaa3Fin7IbamcyuLeS5X+HJDf43KJJvdtm7YJBO9jXQ1qOKYHQUT7FGl68mWcOyRHrjrN4MqJKRNbv3karyDQ9u1PS/KR9/cpIFnusCwLMeLogD7HAO6kjHHNSuJY= 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 1781604851622829.3333317324552; Tue, 16 Jun 2026 03:14:11 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1339037.1600159 (Exim 4.92) (envelope-from ) id 1wZQnl-0003lg-Nl; Tue, 16 Jun 2026 10:13:49 +0000 Received: by outflank-mailman (output) from mailman id 1339037.1600159; Tue, 16 Jun 2026 10:13:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wZQnl-0003kH-Hx; Tue, 16 Jun 2026 10:13:49 +0000 Received: by outflank-mailman (input) for mailman id 1339037; Tue, 16 Jun 2026 10:13:48 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wZQnk-0003Vl-2y for xen-devel@lists.xenproject.org; Tue, 16 Jun 2026 10:13:48 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wZQnj-009AuV-G2 for xen-devel@lists.xenproject.org; Tue, 16 Jun 2026 12:13:47 +0200 Received: from [10.42.69.12] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a3121ce-e002-0a2a0a5209dd-0a2a450ce268-32 for ; Tue, 16 Jun 2026 12:13:47 +0200 Received: from [209.85.128.54] (helo=mail-wm1-f54.google.com) by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.1) (envelope-from ) id 6a3121db-62f1-0a2a450c0019-d1558036b8b8-3 for ; Tue, 16 Jun 2026 12:13:47 +0200 Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-490b7866869so44860905e9.2 for ; Tue, 16 Jun 2026 03:13:47 -0700 (PDT) Received: from localhost.localdomain (5.116.208.46.dyn.plus.net. [46.208.116.5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490ea94f5b0sm295160265e9.1.2026.06.16.03.13.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2026 03:13:46 -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=1781604827; x=1782209627; 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=SOWAHlvQ+YJJWAhAsIp9IubNkCtKgClYad2d4nRRdf8=; b=Tvxrh8lc3i2W8ouLvmQOav4at5VaSlwtgAUOF0PoJgSgaosnsMUkpa6GdxkbxF6HvB b29+astsAAICWPaARk2khz/jy82tYVaYtwWkzPT1hvRgO9OGmURR/R1aiMAF59F7AjYp ZTxAavcb9TGrtHCr01v6XuOQLUMAha/nPZdpYUyaYm8x+BTlWW0cKDzvktcMs+Hs6PxN 1fl16YcyLkBS42uR1YauxuEI95rM4gUnlx4Y90TfIulh6ouLBFeXzVSh/rPDwRCBV7Dv MqongXKBKJATu9ElfHmd6ELVa1sNW+yf2Ix+JeYvq5jkz/+jLPCaHVCb48f85E2au/1/ qFlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781604827; x=1782209627; 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=SOWAHlvQ+YJJWAhAsIp9IubNkCtKgClYad2d4nRRdf8=; b=FEmZpdPsrW5kgwwIyFAhsqKgoKdBk1tAuUiWkOA0gQRfl2gwR3m72/r7K+h/7UwPgp mL/ELCs/a6TCDChb4Q8QjRPyVamB0L+NcU2tMEll0Yc7KkMxda9hPmDJhBAYZ9g1RuUH iRLdIoVPPcAWTtpYDA3+xOZqtMfP7VTINEIYOYSqzOeT4fkVq0vv38wqYB7JyaJu9/o3 luJB6rr5MIwWjX67BKLgXQs9BnkbDrkvypQnUlNEG+QT3qjJak9iaJaFxASyyw3EtSWN 1fsqZptzkbsl2HTHpsJqAjCul3z4eMgLJ7+RRBqrm24bavyGtwggrhCNv1RZe0uk9UYQ ApLw== X-Gm-Message-State: AOJu0YzIBWARU24eaD+ysi4XYSMFQPyzlrKzK5eWR/+aphqjfftk6xpz G/jJaYntUi9na4MNooaFhToU/W+Gqba3UsY1Ldv0LFMplFieij4wrbFNjliAMV5zWkU= X-Gm-Gg: Acq92OGsyQHnAPD/Y4eEW4kg9vAMb8QBuc9JC1W7IteTcTLRYlFPgijOzScNSBXl5Y/ zl/dm08taMEGImBIz95GzoUdLem29HagoWCVaOGzDot8/7rBsAI9SYn1V6loXmKZUEhhKgi4/Xi dorij7dROEhbRQSgs1dEilx9KwpzlXuoTa7cgXlwXaMKHiSFAVBfRYU2OMxqPeLcvdPrQbDR/Xi wkG3+ijcaP3w5PiifnV/y57kJZpjNlZIBxQ/bk0Wy4OYUkPzl2HAcc+hC+jrMKlAXGHTpv8K1j0 DiEcAhMqC3jur2lIBEYTlpm2+jDacOAVfTGaXlbtyYp2Yzcm9b/TuODLfNTnqxm34eNxO83hNCT Ibr8OIccVYn/45xWBMRH3leuKZQotc/oyylXj0hlHBFC54ap04TmOFz25egUh/RVzjkCvcGxHq1 P7lLngOOEtfgxjUexGlcWBK92TBoTNmmUNn7N16Ych0LzkPQmL7s2G1bU3nPTa9jVjRX77Hj65o 7EjApAsGE92Ya4BJJjH5Q+AxfE= X-Received: by 2002:a05:600c:8b86:b0:491:91cc:d12d with SMTP id 5b1f17b1804b1-49191ccd322mr215094085e9.25.1781604826714; Tue, 16 Jun 2026 03:13:46 -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 v3 2/4] x86/efi: discard multiboot support for PE binary Date: Tue, 16 Jun 2026 11:13:34 +0100 Message-ID: <20260616101336.44009-3-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260616101336.44009-1-frediano.ziglio@citrix.com> References: <20260616101336.44009-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/1781604827-E1161CF5-6BC97658/0/0 X-purgate-type: clean X-purgate-size: 2917 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1781604853324158500 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. Acked-by: Marek Marczykowski-G=C3=B3recki --- 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:26:32 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=1781604846; cv=none; d=zohomail.com; s=zohoarc; b=UhMUyBRc1TdSx3mj+vx+qpmlY5BwdkYMI1eu3pQg4QZ+dkqgpoS6ZcLRKXtM3S5UYWdysn5f8tSWFF6CMIOhOVJJVmiBrn3B3PHQWtAOFU8fQ+KlvDecACaBJOPXyGzMdPwQgTQfvGUfj+7tV6sZKqFWeNP5wU7cDfI94n7m/q0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781604846; 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=aV50E1szkTOwyhMutswlcW3BTksNdLPvcC4004D+T/Y=; b=TeG4OY/MCbh6nKvNmOksv1EVFNbdqiZZTiyMF3umzYBzfAH0RZzS308kGMN+r3JpS8ML1d3Iybg1/LTytjmIE71iXn24y0QahBLBJ1JlGj9UfQi7OzExqtesIDA7oIWGglcmJkd8us/o9mUPQqa9eGM8q/8eReEH6ovftmNRoYk= 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 178160484615977.89584099213425; Tue, 16 Jun 2026 03:14:06 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1339038.1600170 (Exim 4.92) (envelope-from ) id 1wZQnn-000496-1M; Tue, 16 Jun 2026 10:13:51 +0000 Received: by outflank-mailman (output) from mailman id 1339038.1600170; Tue, 16 Jun 2026 10:13:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wZQnm-00048z-Uo; Tue, 16 Jun 2026 10:13:50 +0000 Received: by outflank-mailman (input) for mailman id 1339038; Tue, 16 Jun 2026 10:13:49 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wZQnl-0003iW-EN for xen-devel@lists.xenproject.org; Tue, 16 Jun 2026 10:13:49 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wZQnk-003Fzp-R3 for xen-devel@lists.xenproject.org; Tue, 16 Jun 2026 12:13:48 +0200 Received: from [10.42.69.11] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a3121da-bab6-0a2a0a5309dd-0a2a450bb25c-4 for ; Tue, 16 Jun 2026 12:13:48 +0200 Received: from [209.85.128.49] (helo=mail-wm1-f49.google.com) by tlsNG-42698a.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.1) (envelope-from ) id 6a3121dc-212f-0a2a450b0019-d1558031d873-3 for ; Tue, 16 Jun 2026 12:13:48 +0200 Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-490b9318997so31384255e9.2 for ; Tue, 16 Jun 2026 03:13:48 -0700 (PDT) Received: from localhost.localdomain (5.116.208.46.dyn.plus.net. [46.208.116.5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490ea94f5b0sm295160265e9.1.2026.06.16.03.13.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2026 03:13:47 -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=1781604828; x=1782209628; 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=aV50E1szkTOwyhMutswlcW3BTksNdLPvcC4004D+T/Y=; b=CY14pm6C7Btf+ZwQ2tL5bp5gurb559V8T6ftJhTZqxw4mEjMEO45HtVVev68mwWsxr S9YAlwWfH3uIkAgmleTwmYPM9CN2zgtWovr/2E8BzfpqBPi9q63Fpclo7bCVtQEmUd5V KuXOKGUAuSbl3LgnbN1Pefn7HoSHwmZQWIKBo3rRL5Mz1lphjEtO3+aYcXondK7OuXwT /oJIJjkSQgYefBgu/qHVafaUehi6o97eq2uFFC5whp82PP1F8wo64w3EY7JaEd7N0jgo 16TmBT0BQPT4cWjPvUYn2F7UlyCm5SXrQc80pI0VsgAvRrZzqNq3b46d/eT8SVh9Ii0V /nNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781604828; x=1782209628; 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=aV50E1szkTOwyhMutswlcW3BTksNdLPvcC4004D+T/Y=; b=KMecy2dsN9T2ERoJsTkp6XfcOSZxl+FvubniseyqfF4oo3RAA8Gf9yo+HF2Wi70/EP 23zvsYtmD6ZerefCd55Nm9f/S3IChboiu5VcEyXe1PCG9th/6auisvmlUNpCagXL9BgO yppWI5iIoZ/rWU7r8TMWWBwTP8guxB9uMn/bI50owySQeGHDbz0KxP173ikJqIz32+Ts LJKni3WXNoug4bB5K5LXGo9LYhtAzwEqvWm1Ds2rIye8oM7lZGHaT24HSrnVuaotNlBY RUa53a4IQy/mLQo3nTu5RCmPVGXxa2LgyVaOGW/JNZSC9xSn4xXIaiROPc47MqO2mTs7 DgYQ== X-Gm-Message-State: AOJu0YyXzAWNTfKrONmtOMMmEgb4rVYN3h56eryzBh/+4gHEMYSp4lDX pfZlwzxq1L0CKZAMb50M4vWcnlxg2WbA2Tw+PHiWOhqSHM32suOheGdvCGIX/c1vnHM= X-Gm-Gg: Acq92OEYMMWrCnTqNJ8qDIcifYUhhuCnngqUNg59oewgSlmLEUQHmXTQTBkSv/VoYJU Y0EiB5RI/eTZ1zQ4pGM9zkSl8RkFbemzE6GrNgxN4nNWfSikC+rAz4p5iXwhUq+IoKUfUp3/qON KTxEFlrAg8K39aP2+ig4bLX5eVa/8mJ3WJi+u+CfJScgNhaIAgDfmV3PsvXW82C4LxQVgLVYGwF H5HxlhNXDrQmVXDIFYqhRfxM39jsmPOlZ8PkyfVlKKKro6KVVCAFL0KSy9dCd9FMibmIdPyTTVK WGi36ny6M7pRAHh95d/t6nCGAMGi8HL+Kxek3mxAc/TaLPfgPcblUXpAMU0izbjv+So8RK3ST/5 1Bd2J2NEP8fxgfOyRsNSyypx1vhBbpspuJf+Nu6hVAwdYuGCQW6anEOUNs+4DiOO7WEq7ww6lm4 Gm/ClBH10e19PMriO92Qi3Xv1KX2uhhpoPmQmkn+oMiPprkysWok7A4QXyHzCfiB+Vz7CG9KuMN EcPvBRdfxsWCpaQCJgo0LwIRBY= X-Received: by 2002:a05:600c:3495:b0:490:e18f:d112 with SMTP id 5b1f17b1804b1-4922011df49mr193686985e9.21.1781604828155; Tue, 16 Jun 2026 03:13:48 -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 v3 3/4] x86/efi: avoid a relocation in efi_arch_post_exit_boot() Date: Tue, 16 Jun 2026 11:13:35 +0100 Message-ID: <20260616101336.44009-4-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260616101336.44009-1-frediano.ziglio@citrix.com> References: <20260616101336.44009-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-42698a/1781604828-19969F3B-0B315A27/0/0 X-purgate-type: clean X-purgate-size: 1810 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1781604847463158500 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 -- Changes since v1: - Improve commit message. Acked-by: Marek Marczykowski-G=C3=B3recki --- 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:26:32 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=1781604861; cv=none; d=zohomail.com; s=zohoarc; b=F9tZiqTYvnjlLkFb7fz1+n8BaBTnjq/MJG0W4gpKnfwLsbLvI/TlpZWqTODKFKyQatB5EiWbQEXmTJ6/wz4ghJ3b+IAHmFPfochCB5AgaeyiJSBqlYToh1bNkDP1z8eNkwGvJFIzMJkUYthByqBO1zjFktwJaLpe1UcxTCx0UBw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781604861; h=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=xFITs22eOFRWlUIcORe3IAjkHztBHE2ao+BX4i1CqUw=; b=eqJU2S7IIYBIC044pgcgRwG+FK7oG8R2xl5MQITs/U3kIXEBASfSTgGXInKe0PUQU9+/36lRr/prtug5OBLyudek9egb587mL7bOADoeW97t6tUF3+sAYtZrJI0Mc/wy1m2o9/4zfWmEVhxjQzzAIwAcs67VNILPQVwDIxbd0iA= 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 17816048615051000.302129560695; Tue, 16 Jun 2026 03:14:21 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1339039.1600180 (Exim 4.92) (envelope-from ) id 1wZQno-0004NN-B4; Tue, 16 Jun 2026 10:13:52 +0000 Received: by outflank-mailman (output) from mailman id 1339039.1600180; Tue, 16 Jun 2026 10:13: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 1wZQno-0004NA-69; Tue, 16 Jun 2026 10:13:52 +0000 Received: by outflank-mailman (input) for mailman id 1339039; Tue, 16 Jun 2026 10:13:50 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wZQnm-000409-FM for xen-devel@lists.xenproject.org; Tue, 16 Jun 2026 10:13:50 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wZQnl-003Fzp-SE for xen-devel@lists.xenproject.org; Tue, 16 Jun 2026 12:13:49 +0200 Received: from [10.42.69.11] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a3121da-bab6-0a2a0a5309dd-0a2a450bb25c-6 for ; Tue, 16 Jun 2026 12:13:49 +0200 Received: from [209.85.128.46] (helo=mail-wm1-f46.google.com) by tlsNG-42698a.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.1) (envelope-from ) id 6a3121dd-212f-0a2a450b0019-d155802ed87a-3 for ; Tue, 16 Jun 2026 12:13:49 +0200 Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-490b9318997so31384405e9.2 for ; Tue, 16 Jun 2026 03:13:49 -0700 (PDT) Received: from localhost.localdomain (5.116.208.46.dyn.plus.net. [46.208.116.5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490ea94f5b0sm295160265e9.1.2026.06.16.03.13.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2026 03:13:48 -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=1781604829; x=1782209629; 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=xFITs22eOFRWlUIcORe3IAjkHztBHE2ao+BX4i1CqUw=; b=irXgKyTXES0FSnXHsPUhd+XSNaMNIlTmEX3V/HM8hT2F2bpwb/Fbbmo1VAglXdjkRM bzHMYDPQA4/D70pnDoHoeG+NgcdM3oWX8WscC+BSiTBbzFFUt5sDtHghX/pramg26aW7 g44TaW+3+kiGJVY4rdtEfog9X6Zd2zQ+2bJo3B1VyHT+4okbZBC6lPMI2Eo2jIaaYSAv prHQBX62G0SPnmiLuCPmAaXViX5TgtNww7xW/f5ii//hJ3MzxDrLk8HQxMRCC/wMsA97 DpVV4B2vId1Xpbx1H0YNHL7k5vlejpw7DYoRU+gXAdy9GzaMSUpogbF2xrJiuotqzVBU 7A3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781604829; x=1782209629; 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=xFITs22eOFRWlUIcORe3IAjkHztBHE2ao+BX4i1CqUw=; b=BsUmhcjt82j8SMDFNvGIavnt/dROA/rL3rdFXSoq9D/607QNKy4ECd4nj83PJKyM2Q UH8fCnSrdCW6YTkbXOtIEMgIwZNcfD98mqocvB7DkM5CCV/GwqX4VguVkL03zGACI5YG 0zG2wF4H5uvpo/Y0Jt6CLQgXikv5ai0zZ95q+O5MlVoj6Jwqq6qec3BHSM48WtWeiBXM wSTJ2MH7k8V3GQJi1Msf5lGWuW3EpaItoTmw7OTm++5AtD0Y5eTt38CFs4xo6Tj7iUdZ rW9z+rn09y6HI+oE+jiOKY1YLMsXHHS1Oah1VvHwwn5BSUUyJ4pI4BqzY5JvWuYCSemb IgDA== X-Gm-Message-State: AOJu0YwZQICY0hdikKmvh195Ayfg1b0v/Y9nsWEB8ndzdfYR/TMzupfr sQtKCmAxJxUoZ8jduV3+EBc/M092Jm/JI1s9dDGnHOBtlNoAYuzIpIZ7lXLarilq4jE= X-Gm-Gg: Acq92OHMwikSqfFaxxtZfmUJlHeU1sBt7+FoYHT8tuNeVOKR8AHIz9W0P7A5wB2/hj7 Jeeoz5vjn4ETNVpPAkFSVG4pcHgJ5tjUx8yi7HHNz8zmgK6i/GXcRZJeD4VzaYDSLSo0Y2cKhvd Q5zo7K0IBICe6BiTYidCqRsZ4eVgdnx/a/kK3Pg5RbdufDBeB59DOIP4u9w3IUb412tmFjW00l+ tyW9SuaJyx6Aao3JIMh3Ct6/kTUN7JEfdsKt8z6tqcodM45tm1UtAhLKb58oQP0zXusET6cYGG3 a1vwikrBCPpNcMrZOJHrbsSmQmbDb1i3S8E2QNyNlbuG3V5fgpagL/lNOtm88GcJ5e3s/0RS3uJ znZyYGKERI/W7vPY+wodpxFC61wu4Uj/0eZ9F1HQqFujbOAWxOWs7DEZ1/cj1miMI8AaM/ODasQ Xr+f7a0gh3ue+cELczMcqyJ4wPbSVYJVyCPq4CK7t4GTzBVfMcZawxQAuAHqdrCo3+6yAaTNHmV sBcc5qUEmftc8JWU4uZ4B1g35tx1hBtBrugFg== X-Received: by 2002:a05:600c:4e90:b0:490:b724:5085 with SMTP id 5b1f17b1804b1-492201641dfmr197752535e9.33.1781604828879; Tue, 16 Jun 2026 03:13:48 -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 v3 4/4] x86: Split .init section to satisfy UEFI CA memory mitigation Date: Tue, 16 Jun 2026 11:13:36 +0100 Message-ID: <20260616101336.44009-5-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260616101336.44009-1-frediano.ziglio@citrix.com> References: <20260616101336.44009-1-frediano.ziglio@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-42698a/1781604829-12D77F3B-0A3F6D84/0/0 X-purgate-type: clean X-purgate-size: 1760 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1781604863356158500 Content-Type: text/plain; charset="utf-8" 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 -- Change since v1: - update comment style. Acked-by: Marek Marczykowski-G=C3=B3recki --- 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