From nobody Thu Jul 23 21:53:05 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=1783334804; cv=none; d=zohomail.com; s=zohoarc; b=PLoTVQvdtZX5EuyAC0TUnALeTNkBInkt7IbnSBoSVBCoU0HyyhOMAejHRvLk+jQRzy4AgWDpXOPBEcdadP5gKUscWEZAyVLea+/yriXZX559k5vPMFbBbUDnctB0NhEElAc4IQCLOS6bZrBBosOlff8YCtOJJxWwNfXroVHFA7s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783334804; 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=O9llCp8OKniapEpgBE6m25teZ3APjt4LXXOa9h+qne/bwFDRPUFgn57qwsaSqb9QZ0/ys0li23CimkjMMyZ+enQ7XvvVtLahnX7dk/rnIZ+WiX6P5P5wu9UtZ7PBTz8HyzyXvTVbAoHINzuHF8c/eX/A7+TluhjJoEoOHixufZY= 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 1783334804884773.4844327494875; Mon, 6 Jul 2026 03:46:44 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1355301.1610063 (Exim 4.92) (envelope-from ) id 1wggq1-0002UO-Dn; Mon, 06 Jul 2026 10:46:09 +0000 Received: by outflank-mailman (output) from mailman id 1355301.1610063; Mon, 06 Jul 2026 10:46:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wggq1-0002UH-Ae; Mon, 06 Jul 2026 10:46:09 +0000 Received: by outflank-mailman (input) for mailman id 1355301; Mon, 06 Jul 2026 10:46:08 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wggpz-0002Tu-Uf for xen-devel@lists.xenproject.org; Mon, 06 Jul 2026 10:46:08 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wggpy-008v6e-Qe for xen-devel@lists.xenproject.org; Mon, 06 Jul 2026 12:46:06 +0200 Received: from [10.42.69.9] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a4b8761-5cb7-0a2a0a5109dd-0a2a4509a9f8-18 for ; Mon, 06 Jul 2026 12:46:06 +0200 Received: from [209.85.128.48] (helo=mail-wm1-f48.google.com) by tlsNG-bad1c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a4b876e-97e6-0a2a45090019-d1558030b820-3 for ; Mon, 06 Jul 2026 12:46:06 +0200 Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-493c2b3dc8bso19813285e9.2 for ; Mon, 06 Jul 2026 03:46:06 -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-493c63ba97csm349823985e9.12.2026.07.06.03.46.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 03:46:05 -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=1783334766; x=1783939566; 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=IHVYOHTvrVFjr9fT3MFu16T0q8cr7HeZNsuqpJ3YeBy4rdCkrSzZCxIdl4sBAyB5h7 96f82zINis75KaIq0MwKyICFHEtbBfEtAnyfF+Do1+xVjWj8U7roE/6RulbN6YPVwKCy dAIVlqWv+LOvSIP8Zut9OJJSC3GLVkrl4dk4IJopqDU+Q/BHdH9zf/NcZfdnpZ9sbvOO 27axMr1mrqfgDTdXs6wOyOXIw9/P0Tn/tfesrhQZuP11CSEX9LX/oQ5mW6UpQGvPdxJd YuTc3agrcoEaoxI0J7IfgHp+ufn8aL7qYRxAnmmt0/0ZTQMkL0w+IGvCTLby0TSCn7y8 Ds0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783334766; x=1783939566; 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=fJhlfTxKSJnNXZYZVCoqyD1WrWD4+dLkYe1jSdx0rmPv7nBLoV4tuTMuWV66gJkMF/ 5vO72D31sTWQGVYWhIXnxu/h9C6zIFytwi4ZH77/crM+0EAcpTuppnkkGqJMVft1wrPc QoN/8RsE4cYG9C4VkUVUkSikRwrIU0vvADc2WxFeu+67tN6dQeOAOPJabTDk7ojmLlFh WH+McYZFJ4IIlrmcBNHCynfC5f7Y/aVtXIfUc+I6XOypG3c0GFsCW3cgX81wvXbIBpBM btaS5QXfIeY0+KtFMbUlp5Y9hnhbim3A7JHE3qW4UxU10M8e4rwNYomGG6UNnL5Ox445 HntQ== X-Gm-Message-State: AOJu0YwD3wZyoWMw+aVlT6DJfsIEIteUYO05WVxc/wIw214l5cdGxYsK UT32JZZA9OhoS2SCnTHGgvLwAUlrUvyqlQk8C4uiWz8vOoXNdVO2BcIUqcjafx+ezgQ= X-Gm-Gg: AfdE7clYTsMU8SKRUALTwquyy1wN7jTFcd4ir5HFK6sPoqA4Hx3a4eccX/3n63jOleN z/pNCB3vN/3m2RmnECR5mWXw7qFGP9ryunqJ5Pye8JFEygoharWfE+mfSmLOef/Srj0jv0gFswa M+670mbyGGRuLRwlQXpbwFpa5/gNNf6b5BSLOQ8Z6XRvy1ZxW637srMNBNsfvcRiL7vUwX4oQFc RmP0LnYlHYBzUQMnyyAvBuaMQFayfxRtPzA9EJojglsjFEByjRPRKD1LdYv+X5h+wBuZHPFOANO PQqOBKdnfVMzfHBa1VCXXWPYCoYxWkp7jzsTRf/t3FS0TS05tsgZHq3kYmrGZnMZoYpwcWz9Py+ Pz9N9VZczHssWDLzeNecUtfHBTXxJ1gpL6/WLAm6WO9Y024XgZCc+0a+c215E5HTZRw8UVXF5/r ZkeHAnQHYJZjPltw05c4GPxr8BCtJ/7HXfgcN5iuquI8k6cr8VzujJ70bmzCii8B9ksml8YmZLN AHn7LklMkplc4kI9HY= X-Received: by 2002:a05:600c:3110:b0:493:c8c6:4989 with SMTP id 5b1f17b1804b1-493d11cf312mr130290115e9.6.1783334765621; Mon, 06 Jul 2026 03:46:05 -0700 (PDT) From: Frediano Ziglio X-Google-Original-From: Frediano Ziglio To: xen-devel@lists.xenproject.org Cc: Frediano Ziglio , Frediano Ziglio , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Jan Beulich Subject: [PATCH v7 1/4] Align relevant sections to 4KB Date: Mon, 6 Jul 2026 11:45:54 +0100 Message-ID: <20260706104557.430097-2-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706104557.430097-1-frediano.ziglio@citrix.com> References: <20260706104557.430097-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-bad1c0/1783334766-577AD986-70FCADD3/0/0 X-purgate-type: clean X-purgate-size: 2076 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1783334806334158500 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:05 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=1783334809; cv=none; d=zohomail.com; s=zohoarc; b=YHNZHXiNSf+ZxiEGmIWL6quPfUAVhwbKTD6awQg+vcWNyjPfcZMfFdOTTeVWgK5mEWvCSU4126qXZ1fgsIJUOUiVJL4b7sV5E+akD6BpiBpfi+dfZPJsEZEpFNuU3wBrFw4SptjK7e2Et7OP8hAHZFU4UQnI/dVxUS+SHktnwvM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783334809; 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=m9B0ArUitijRUw4qSBCDCV9oLIH5+U0INwoqfnPeLmTcYQr2Tc4U08WgF1jSR11dEpz5ejFxPymCV2drs/Xm0rAiPvaDhnnK5pJtU9v3e6U0nYbBry9QsKeCP03IX7bPmQyFo1gqgVGCdnM24TYjUpAt/URZ1mihvH8JbVZOXNY= 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 1783334809189520.9808942952416; Mon, 6 Jul 2026 03:46:49 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1355303.1610073 (Exim 4.92) (envelope-from ) id 1wggq1-0002cV-Ul; Mon, 06 Jul 2026 10:46:09 +0000 Received: by outflank-mailman (output) from mailman id 1355303.1610073; Mon, 06 Jul 2026 10:46:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wggq1-0002ab-OW; Mon, 06 Jul 2026 10:46:09 +0000 Received: by outflank-mailman (input) for mailman id 1355303; Mon, 06 Jul 2026 10:46:08 +0000 Received: from mx.expurgate.net ([195.190.135.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wggq0-0002Tv-9M for xen-devel@lists.xenproject.org; Mon, 06 Jul 2026 10:46:08 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wggpz-00HA6J-Da for xen-devel@lists.xenproject.org; Mon, 06 Jul 2026 12:46:07 +0200 Received: from [10.42.69.1] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a4b876b-e002-0a2a0a5209dd-0a2a4501c908-10 for ; Mon, 06 Jul 2026 12:46:07 +0200 Received: from [209.85.221.47] (helo=mail-wr1-f47.google.com) by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a4b876f-400f-0a2a45010019-d155dd2fb15a-3 for ; Mon, 06 Jul 2026 12:46:07 +0200 Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-47ddf7b09aaso653562f8f.3 for ; Mon, 06 Jul 2026 03:46:07 -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-493c63ba97csm349823985e9.12.2026.07.06.03.46.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 03:46:06 -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=1783334767; x=1783939567; 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=X0/pd4NebReOi1u00xuUMPx7iuXllyYVM7OCMuJ2B44=; b=B0Z8jrOXkZol00KL1SpDpFTKS9vWY3gULjMbRrPXVoOJT6eWi+obwwDyvU0Y8azLyB WNN1WXT5h2Zb6Cjw8n0/UKlxMJZBex2ROy0tObXBYmogajcXmS+7vAHBxG+dX3H4+ddC 9ieS6ljC9Ga05ZvarY05mnkL1KsWet3aQNz0ElaCLXf07CocBiGLws9HFMgT8vqaJ4RW VUrZewhQCtOj59ycETSuByp2vZORDyN+vIlKS1PA7mifJ4VHykFzfjS0U8EPvb9QBUj2 vd+JOTLvOEprw1lFET1c4SArq1TOQuaGm3vkrIlZ4phK9eoBo7l51PRdEovkSg34/Ypk xwkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783334767; x=1783939567; 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=X0/pd4NebReOi1u00xuUMPx7iuXllyYVM7OCMuJ2B44=; b=BsWF2IKFHDgQxGfvxGPIZhsOHJ1F5Ojp/x9Et7wjiAsy4sud8qAcOcqCiG77WRju37 RLyVrj2qcOevUFBUDzaEwVmEUQ7v6SOREZgtyowUN0nO+tSFpru9XfVwwWzrOiQCKlmn 6AMYJb404SFE5K8/Ee1dmnm8aft1+nnGzjCIkQyB/WWlmS8EvEF2CGLrXxF7JQ+gKBNK JcpvNSE4CQ+jfcbdtWBao+9WazBW6/GArueRxfmKjcsdUUq9kVejI269/9h+97QXzRc7 pNV04fE0beQRfHf/QMazX4mFLz+n7nVFxnWxEga4mtpAn1Zb1X0WqCJNjFlX7iIVUMmy AwuQ== X-Gm-Message-State: AOJu0Yy3cSZ3G04czcsvaOxlv52gwKCtKThPUfR3WfhxL5c3CQ0rXfjW ZcKAM8i5zPWZqtIZWBy17oiY11VemwXOt3iZKyiiMDw0jsYMQ/Xj/kQ4fFek8XHvDuA= X-Gm-Gg: AfdE7cmTNszuYrldJHpxPUAPUU5SaFbz0pYC4xep6hbIfRdQNW1a+e8RRNSHDNP04n6 HBowAabfZuQXcSWpCcpfvITRzmGPyVAnrK1C9Upsa2rxxH4JWwPrCtAziE1uSDxV3sFnfh0sCfj BW9MmMCuvHMqQdKnG+gxYgZXm9lcnh3VmozshdYzrBU2sa+Y5iPVnBaKhRaiQEJlFGomK/DzL3a nbUtcWKevH+0iEYWbOJ7Yc3jzKcs6yes+D+ztxmo2esBmNN8bdVoU0iLeXoSEJu628g+yh0Gc0s Fk3p8GuBAfKqYzFnr/vqekdN9CGvVT0IvOnKRnPnlm2K2PX1LJBaptklpt7Gku6MBPiY9ZLPZvY h3k6TMnRpLBku5yvgNCe01K1H7OfpQ4EIgsMnBij6J6e/xWIhh5NNRz40L6AxAwXISViyQG0rYx unR4j47+uy7ou5sjEpCRfQiGY+62aCo8yyQZ4I2aNFE4XceH8Q7pw4hmSf/I99+TbKttAx/S5HN c+DotPB3B1I2M2eJMg= X-Received: by 2002:a05:600c:3acb:b0:493:cce0:3757 with SMTP id 5b1f17b1804b1-493d11cdd57mr108272465e9.4.1783334766457; Mon, 06 Jul 2026 03:46:06 -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 v7 2/4] x86/efi: discard multiboot and PVH support for PE binary Date: Mon, 6 Jul 2026 11:45:55 +0100 Message-ID: <20260706104557.430097-3-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706104557.430097-1-frediano.ziglio@citrix.com> References: <20260706104557.430097-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/1783334767-FF2C51E0-B5FA0B47/0/0 X-purgate-type: clean X-purgate-size: 5049 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1783334810188158500 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 Reviewed-by: Jan Beulich --- 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:05 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=1783334806; cv=none; d=zohomail.com; s=zohoarc; b=kcvPewAllCQQe6YRr1VVP2l6o4QpNT3x5Kwcur+blldk67wVwlZj/2SQy8uz4vepGvf8h97b4y2SFQv5BOSBCCH/L4NPgwCNv2IA3DpgsHZsX43nRuBvuguzHwztaN/w6Cv6wIhbIOcuuVMbXqmLSN6qfxtKD720GcYPXbvur7k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783334806; 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=HzSJO6a2Zt2m1n1ujDT4uRTju/cRsXyLEg5Me9ypANU=; b=R8IgJz5YVmz5IpcGDcJICbBIDeI5zvAX/8CNu+XO66oZxCX/Qj/3XUQVTwk2V+hj3zu6LubWiSP1xtZnPEa0ApZJxFuDONnpZ8s1jepaAaTdkd77tQKrT6S1777G/wKMQzATLDnapKQIul9cZ234ZmvfWAxml7Eicxo5xxKHVwY= 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 1783334806890764.444542289033; Mon, 6 Jul 2026 03:46:46 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1355304.1610079 (Exim 4.92) (envelope-from ) id 1wggq2-0002f4-74; Mon, 06 Jul 2026 10:46:10 +0000 Received: by outflank-mailman (output) from mailman id 1355304.1610079; Mon, 06 Jul 2026 10:46:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wggq1-0002dl-VD; Mon, 06 Jul 2026 10:46:09 +0000 Received: by outflank-mailman (input) for mailman id 1355304; Mon, 06 Jul 2026 10:46:08 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wggq0-0002UB-Te for xen-devel@lists.xenproject.org; Mon, 06 Jul 2026 10:46:08 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wggq0-008v6e-A4 for xen-devel@lists.xenproject.org; Mon, 06 Jul 2026 12:46:08 +0200 Received: from [10.42.69.2] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a4b8769-5cb7-0a2a0a5109dd-0a2a45029186-26 for ; Mon, 06 Jul 2026 12:46:08 +0200 Received: from [209.85.128.43] (helo=mail-wm1-f43.google.com) by tlsNG-720697.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a4b8770-5a27-0a2a45020019-d155802ba82a-3 for ; Mon, 06 Jul 2026 12:46:08 +0200 Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-493b27c7451so34907015e9.0 for ; Mon, 06 Jul 2026 03:46:08 -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-493c63ba97csm349823985e9.12.2026.07.06.03.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 03:46:07 -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=1783334768; x=1783939568; 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=HzSJO6a2Zt2m1n1ujDT4uRTju/cRsXyLEg5Me9ypANU=; b=dBmh5XMP7MOppMWRL6M1dvW8MkO2W9q1yKB5m8iPiQCLGtqGTAfT7sCPrxzJ5KhL5V eZXuL/S24r4X9jILGkqeqWXUAtPeQT5N9h1xELsqYZY3XPzcs9Rl4LI+29CHK5fFGYcI kYoW5GFjaqwVPd4Ga+iIIq/40EM/cbr6iz+G+Hj9tqA64gEVdhz5LWEZXRNS7zSTJdNQ uJMcpVuol44U8bDQAMnMj9Gv6D4X4BwUvrFF5Kzs4Heq1MEz17SPgKQZ2sPQysQRIzsb cdn5run4/FFEncseafTz6jW+AMkVQQYUNolu5RDo/MS+HUU12fLZ631x5qpUAgANm3X8 Dk8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783334768; x=1783939568; 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=HzSJO6a2Zt2m1n1ujDT4uRTju/cRsXyLEg5Me9ypANU=; b=XSAtulQ0RWhE6qZZDPkAsvuGPdS3jR63E7XyJQrhSEsbKzJPo0nEtGvsbQGA2g9EFj PlBPfbQleTZyLXcrHOvXzA0apuo38h7NAlus3k3EAWTEpBe/Owe2EFUz2XBrUYlzst25 WtDgB9vo6riiyTscowa5YbkgztbN6KDBu+XMlUbH76hcYnctAmerz/3P4lKPbkuckzcz HMSya5X+ynZt8RBXOmwxwQK9KLjcVEKtOhnz4ok0Mcg5Tj3f+7zRImbX7G0Ug82EbpmH NIjayXUW4Seiqug+34PFH1DEZQqc5C62Bdbc3XYTABzS99h5BssW7KvFWD9kX/lqi+ar zxlQ== X-Gm-Message-State: AOJu0YwnyFK9q7EUw+U3JJoj2kiCFPppxnTseg5Q4VCK0+GatLnXO+Hp efnBhgCw9hBNk1cOzAgl5iECd1wS9oI4FxXqlOu6zZdjlLfyxat9Hfky2eIR81bpRaw= X-Gm-Gg: AfdE7cknSL2SZ040ub6XfwIv6l/FrGYme/nX2PCmYRZIgat4wv3fcyaU4QCEKRfjSmc qlzdcm3DiNjS33evP02A3Iy3gmFNJ+OcDkpXlELtmXh4iweZvVAPXXYlZBsj1AyaYh7oXzJJ3E/ EO7VWYB7rnEJB6vYobbZf2Qu5mdcm2glTKRfb167tl+lyLQ+Q72SsWvCfScwi3kysruhGFDE4IK 1MmJjFlW92UbhI6ZilkXVoO0FDddZf0WaIF8KfUxIdjvWbsjAPw8y/oCz/scc1QPWHEL5EkcjPW H7tp0kpVufk588ZUD6TeLeotXZn5LThqyKpVSNHRdUHhYDn3oCmLShCfPQgpBCfmWwalgxD9av1 0TrTahzByKB+o1ulOuQBY4u8EL52Jq7Gt9EqCqkgEYxox5mmY6KH/JdUWRNS2+Vsg75ybMK6m6+ VxWGPmJNKWMrMmE4m9UGd5eMuJgXZRZgJIhveWEb5IojogkJJTlZJz8T5qNuESvdW61JQkbJ20Y GJZE21xXRxEag9fyIY= X-Received: by 2002:a05:600c:4ed4:b0:493:c600:e1a6 with SMTP id 5b1f17b1804b1-493dece4adcmr1187235e9.12.1783334767437; Mon, 06 Jul 2026 03:46:07 -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 v7 3/4] x86/efi: avoid a relocation in efi_arch_post_exit_boot() Date: Mon, 6 Jul 2026 11:45:56 +0100 Message-ID: <20260706104557.430097-4-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706104557.430097-1-frediano.ziglio@citrix.com> References: <20260706104557.430097-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-720697/1783334768-4E5147C5-3B7912CC/0/0 X-purgate-type: clean X-purgate-size: 1970 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1783334808143158500 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. Changes since v6: - remove spurious quote. --- 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:05 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=1783334803; cv=none; d=zohomail.com; s=zohoarc; b=aJeX8ig+r9X9qAQabeP/m8GeG8t/QNccNDOZraNUobGA/hP32+Hz6xuYz5P6vRjGkQxUgZtrG3zLu0ihzZFmWtL/J1rGrGWytHA7H1VCwN60RlK+/fi6aZ3CC/EojXPk7Gri+bB9n+6QLGXVz7y2RjXPSKxiT3eYN7Txrp1GpcM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783334803; 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=hsvb/9G17fMJH9asCQ3irstZa4RRxd23k59PRHfh82DI2+Y04HZ6jfArV8NjhMdFQkhEyIsto3PNswK4rOhjY06qWFWFkkwLpVU9tOHd9hrKgH4jNHgUx945MFJvzf1Gf/wTapCM2YcjBifXBwcGCkTPaBwXCLzUhWbqKdjf/K8= 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 1783334803895565.6712840841566; Mon, 6 Jul 2026 03:46:43 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1355305.1610099 (Exim 4.92) (envelope-from ) id 1wggq3-0003Hx-DL; Mon, 06 Jul 2026 10:46:11 +0000 Received: by outflank-mailman (output) from mailman id 1355305.1610099; Mon, 06 Jul 2026 10:46:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wggq3-0003HZ-A8; Mon, 06 Jul 2026 10:46:11 +0000 Received: by outflank-mailman (input) for mailman id 1355305; Mon, 06 Jul 2026 10:46:10 +0000 Received: from mx.expurgate.net ([195.190.135.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wggq2-0002ch-0b for xen-devel@lists.xenproject.org; Mon, 06 Jul 2026 10:46:10 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wggq1-00HA6J-DT for xen-devel@lists.xenproject.org; Mon, 06 Jul 2026 12:46:09 +0200 Received: from [10.42.69.1] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a4b876b-e002-0a2a0a5209dd-0a2a4501c908-14 for ; Mon, 06 Jul 2026 12:46:09 +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 6a4b8771-400f-0a2a45010019-d1558032e1f4-3 for ; Mon, 06 Jul 2026 12:46:09 +0200 Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-493c83474ddso26424155e9.3 for ; Mon, 06 Jul 2026 03:46:09 -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-493c63ba97csm349823985e9.12.2026.07.06.03.46.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 03:46:08 -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=1783334769; x=1783939569; 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=ia93IaiRGnVFsVP6/iZrBYXvaYw/rZ06cLV16cU84oM=; b=bL2qnVfwcZJ+nmzugoVfEsDe0ytVgSdT0xg9GvcGl02/kuvCWbGAczdqU0p1XTfrI8 ApwuedtLgDV9Toyx6imse19CxjRwwp/4nmz54BxvK/pEH58i0v+p0vihyXUQqBTF9v20 KvBy7QaojIsyY3TABb3qsftPpkbQ9TKTY0sueEqxa3wJAMGQ79XA5q6WR0EhTY3kQtT9 wP/K2bI78VDV0+QvJZdoZ862wZ4VymTBe4LFYI98qeX5/o7d6cmuMzV/76QwFKeipiPg PsBlW1MelgsWLgmvwg6+H4IYfgc1MSgZzVTCLeHDAiXH+qR51ZYxLi1RKJH7kGZVEnYf KrKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783334769; x=1783939569; 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=ia93IaiRGnVFsVP6/iZrBYXvaYw/rZ06cLV16cU84oM=; b=b/Id4pi2U/je3R8Id6vZ2PkyLoizxVkQOHaQJHVpGrySfOcpTV5UpT7mbtKsP6fp0C 3QXBWzU3+ipkteAP3HDKCkng4zuqWTuBJy+TMpnn8WQoPYM2XNs09MTqdfZFuuzUFjNh E211riUHHm6NCjAUGpl4usDxqmXSUM/XTRoeVLIGLt6NCc6S7gheh9XMHfwA0PP5hroi soYwRYmF3nlYdmC5IZX53F5QvWggXztNr2yGyf92PcX6mJnhBS5JNhDqk+fNu9EGtfVz y8D1zIMId8xFB82Zh9vGN5W20I1sQkEFTOH0vD8Ob1GAUeBt6XVwXRyh62XM3YSTmO1S L1fQ== X-Gm-Message-State: AOJu0YyHN8w0BLRSVhVIDB5dp7vBt7AYTrvffniIc6grvNSwTId1YUuz sCXRNaL3KUO3dalcARQ8mOiqpC1GE2n9Jn+wuPwumylHW7J4wzY81UB7Ly0BO94dBDY= X-Gm-Gg: AfdE7clpLDTlgz2zlMKGYSxQHseczWymL7Ei/jVqxUTuwsWfHtXXaDVUtoos7Qd0+9c kYGEw3PyfLPtm+rqh2VhvRsE5pcVriqL69q560umetucflF11IAPV+rz+64kkAdUpUjXE3MnQ2E G91AyTVRA2Z1nOF+82DZqhK5E5wuwYlEtk7exdNXR+I64qzlRHTGnQ/ts9eNmq+dDVZgJALjvC9 P9f0spSlPCWk8DVxznaHT/cew4o9NHnIZDzAbyeoghV2e1/JY13sdRWJeB6CK8QsAV/DNJ9T4Bx SSPSvmd0f1pfrWk3KpMY2DnBnFFin20Qt7+ujfCLVcx48ZgrJe+7RruslbvMNQYzRTAWBDaQlqC yiM+U30/tWwV2XMDgAY8tTmaTN13F1MZWwoFc+K/q7GCL/HOBsZq+1Ga2rVCp2/uf804YfhDLg9 pVjSr01qFwAd0cQFvHT2puZB23v6+y/xHE7zyk63gOxmY3npAjVY1PQLsgN7DV2ijEWGnlj8gHO Z/YVFCBsWne3zEsCs0= X-Received: by 2002:a05:600c:2282:b0:492:5bb6:6d4b with SMTP id 5b1f17b1804b1-493d11fb775mr86459585e9.34.1783334768506; Mon, 06 Jul 2026 03:46:08 -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 v7 4/4] x86: Split .init section to satisfy UEFI CA memory mitigation Date: Mon, 6 Jul 2026 11:45:57 +0100 Message-ID: <20260706104557.430097-5-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706104557.430097-1-frediano.ziglio@citrix.com> References: <20260706104557.430097-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/1783334769-82CC61E0-829AF86F/0/0 X-purgate-type: clean X-purgate-size: 1957 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1783334806273158500 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