From patchwork Tue Mar 18 17:35:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 14021366 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D4723C35FF8 for ; Tue, 18 Mar 2025 17:36:30 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.919603.1323996 (Exim 4.92) (envelope-from ) id 1tuarL-0005ma-Nm; Tue, 18 Mar 2025 17:36:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 919603.1323996; Tue, 18 Mar 2025 17:36: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 1tuarL-0005mT-Jx; Tue, 18 Mar 2025 17:36:11 +0000 Received: by outflank-mailman (input) for mailman id 919603; Tue, 18 Mar 2025 17:36:10 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tuarK-0005mN-5q for xen-devel@lists.xenproject.org; Tue, 18 Mar 2025 17:36:10 +0000 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [2607:f8b0:4864:20::1032]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 792d9148-041f-11f0-9899-31a8f345e629; Tue, 18 Mar 2025 18:36:08 +0100 (CET) Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2ff187f027fso6963388a91.1 for ; Tue, 18 Mar 2025 10:36:08 -0700 (PDT) Received: from localhost ([84.78.159.3]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-3015353462asm8485870a91.27.2025.03.18.10.36.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 10:36:05 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 792d9148-041f-11f0-9899-31a8f345e629 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1742319366; x=1742924166; 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=E+u7NHU/X16iy++y53dW2+AUGd16GJzW5/oHUY54RX4=; b=H69e0itFBYgoTaV17GcWR+5xySgE9HJqHgiBrrYDcRST0NokVTAhsfOzQ2H09Ywb5a 7fCIA/ye6lmjH7hDK8rErytIfQVfb0QwC3C5jkv9/B5rQA5597x9/fQcvyAoFSRNVF7/ COpg289hZPYFYf5Zs1kKLbukVR3OIda7t2HcA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742319366; x=1742924166; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E+u7NHU/X16iy++y53dW2+AUGd16GJzW5/oHUY54RX4=; b=Kt3VEg9dPNen/G3flJEczyKunt3BIwdx99SoDEZv8lL7BdokwUiR1UW1Q4gfMeGee6 KIzhzW/O/P2kFoc6dH28obOhzt5wldn/AS2zzfNe3D8/qpA6MAtj245HHYxwCiYqhyQ0 741wpUUqQI8toRa5s5oo01o9O2hgid9PyGGJDcrtdiiimjiAvKKmWX2uk95Rrx9wzaZR UTBXle6RmeOTFB9WO1iQCOPVf64qCwNRQQ12Qp+pX4rPmfeLw4Sjwo7E1iu8I+PY2ZyJ hkryXK6IpNbliKscLOUP9bAomNnGHSQM1y6Jt5zJFvRm3oSHp0dtk6REH45MTWIpXPqY /blw== X-Gm-Message-State: AOJu0Yy2wVKF0E5Hz3gM4Z+V9hUA94Q7WBcz50FEEFC5eE1U3Nir0EtV tzmF357fpQSMOchBPUlDcUn/bz0f2pw21mZ5NSgKww0Wpvs3se1kD3iJmaM3KN0EBmFDtZtETl7 0 X-Gm-Gg: ASbGncsLvbDyJwNJT1pjn7Zwd6mBLMWEjQLky92gQHOb4vyUoQYZrWLwKOKZmd/91lu +3P30cpXtcA/S4gsMUmK+A6U0oHq9H+wm8VcqIQgLZuVqqLAQxbP1Hb9N7SIrzg2Su44bBLqpUf XSNUuIeTN82+qLHkXKksMcJcxu+JkDniZ5VrDi1yfFX2bDA5D6yNGxB4QmyJuZWF4xT4F/Dc278 2j688GXZC7oOlrn1p/SKrpstEI1fVSog397OZS7TGn7WoBpBSTHIDxF11xJkP49FgnazxVkTJCO 34pSseIUX/qqEJ0OO9H9YxV1MKLVkbRIxazl5HmndO2E9vdPnA== X-Google-Smtp-Source: AGHT+IGZ0a0IkzU8VfqH+3YjJUK76MeRcDdv2DFylgD5njJCqv53PKuapRzr69eNNqyed91HUZuS6g== X-Received: by 2002:a17:90a:d2cf:b0:2fa:42f3:e3e4 with SMTP id 98e67ed59e1d1-301a5b0443cmr4840403a91.3.1742319366153; Tue, 18 Mar 2025 10:36:06 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Andrew Cooper Subject: [PATCH 1/7] x86/boot: clarify comment about trampoline_setup usage Date: Tue, 18 Mar 2025 18:35:41 +0100 Message-ID: <20250318173547.59475-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250318173547.59475-1-roger.pau@citrix.com> References: <20250318173547.59475-1-roger.pau@citrix.com> MIME-Version: 1.0 Clarify that trampoline_setup is only used for EFI when booted using the multiboot2 entry point. Signed-off-by: Roger Pau Monné Reviewed-by: Andrew Cooper --- xen/arch/x86/boot/head.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 1b3bd16fe575..59a2b5005cf6 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -505,7 +505,8 @@ trampoline_bios_setup: trampoline_setup: /* - * Called on legacy BIOS and EFI platforms. + * Called on legacy BIOS and EFI platforms when using multiboot (either + * 1 or 2). */ /* Save Xen image load base address for later use. */ From patchwork Tue Mar 18 17:35:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 14021363 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 85A9BC28B2F for ; Tue, 18 Mar 2025 17:36:28 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.919604.1324006 (Exim 4.92) (envelope-from ) id 1tuarP-000613-TO; Tue, 18 Mar 2025 17:36:15 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 919604.1324006; Tue, 18 Mar 2025 17:36:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tuarP-00060w-Qd; Tue, 18 Mar 2025 17:36:15 +0000 Received: by outflank-mailman (input) for mailman id 919604; Tue, 18 Mar 2025 17:36:14 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tuarO-00060R-LD for xen-devel@lists.xenproject.org; Tue, 18 Mar 2025 17:36:14 +0000 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [2607:f8b0:4864:20::634]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 7c5a6872-041f-11f0-9abb-95dc52dad729; Tue, 18 Mar 2025 18:36:13 +0100 (CET) Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-2241053582dso17555595ad.1 for ; Tue, 18 Mar 2025 10:36:13 -0700 (PDT) Received: from localhost ([84.78.159.3]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-73711559fbdsm10188371b3a.59.2025.03.18.10.36.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 10:36:11 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 7c5a6872-041f-11f0-9abb-95dc52dad729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1742319371; x=1742924171; 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=uUEaJN3qk40R1uwMWELSbGR36i1jo84C4OMy7cnNyV8=; b=hG1fMqZze26zORus0LgCQMTROFWgcJROkpR3hPnC92xyeCsCYPu6b9R8aKnkDIoh0B nX0sjqwEC7BvwMy7qCrA7F40gwXfVUbAqodfbMwsIDEEzZ9wsvheVzq7Ex9mu2t7g0uf vaE+7Esk3aKyA1i4l7sU/VmjAxpvKd2dXOEBE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742319371; x=1742924171; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uUEaJN3qk40R1uwMWELSbGR36i1jo84C4OMy7cnNyV8=; b=A4scnvx3G8qsAd7bikcK667hCPCV4EQzkaSl4oer/v2gCO9g3GMXWK6qprjmFl7Rql zUG0CSUgN0cnBVausNAD4FXGSVCYPlt0OxoybN26dKHMzYiXY+X2Od8swCLT65Ho/2b/ DfQbs01RWsI/G9dkFpdAixHOzaNYnIYEdBZGMyjkjKFlKayk5GqUS91tbYoyqkeG0zM6 RNt8SNPbNQf44PNhr2EDMgVP1p0HWUy0sbRUDDqTqlW4ZUMpAuQ+iN2wNy6mDgtK25si rsKgCOoo9cLQYYp+SD+FpSRjE10b5fKyj4hX9N7B4vvvfU3PFHbdhifU3cstZ/4vxM3v O2xw== X-Gm-Message-State: AOJu0Yx6NB5gSWCaj+KJFwihHnlZuUSvjaphh0+rjTwUsbb6R09VATCt m9walrolgnfNZEVhvUTchPqEsKp/Us9E8dyc+b6zHYGGSMa7Ca0jdXrHekT2J55u7i5lqu7TCNx X X-Gm-Gg: ASbGncvTCo+OTiuvSrMHIEkULD7jGKq0MSjTuWslX7kcSf6JZrdiuWDVnebgUZDm9XU lzoFQLMpeI8wrL2D1YUlAP5QwqedmOWqnGfR11sd15H3h2/roiivrRnLwUtWUaX+17ECwVm2IA0 F/2NDNVMZfL42wFAAxgde3yIbft3x85MaD5Jz3LqL023tbA2bR+cvXytogIG9cMil+RNdptp+pB ZzUsTHocD/OQaSaule/CG6s2+TN2OdKyTCpYQfHGLgFe6VRlecTd3fdWdabpDwOevG+Uy9pqLiU s4QRLJWAYpWxP2+qEJTuInEVqjzqQSrfoY1QryGF8iPYCCNanqts36rHXFhk X-Google-Smtp-Source: AGHT+IH2R6siyXGAz8aZjbViKwajC/tho9oLL/4Wb2zYe1yWYtyAyqk9V90VPcsDu6vuIALGOLdFcw== X-Received: by 2002:a05:6a21:682:b0:1ee:ef0b:7bf7 with SMTP id adf61e73a8af0-1f5c118e79cmr23419070637.19.1742319371488; Tue, 18 Mar 2025 10:36:11 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Andrew Cooper Subject: [PATCH 2/7] x86/mkelf32: account for offset when detecting note segment placement Date: Tue, 18 Mar 2025 18:35:42 +0100 Message-ID: <20250318173547.59475-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250318173547.59475-1-roger.pau@citrix.com> References: <20250318173547.59475-1-roger.pau@citrix.com> MIME-Version: 1.0 mkelf32 attempt to check that the program header defined NOTE segment falls inside of the LOAD segment, as the build-id should be loaded for Xen at runtime to check. However the current code doesn't take into account the LOAD program header segment offset when calculating overlap with the NOTE segment. This results in incorrect detection, and the following build error: arch/x86/boot/mkelf32 --notes xen-syms ./.xen.elf32 0x200000 \ `nm xen-syms | sed -ne 's/^\([^ ]*\) . __2M_rwdata_end$/0x\1/p'` Expected .note section within .text section! Offset 4244776 not within 2910364! When xen-syms has the following program headers: Program Header: LOAD off 0x0000000000200000 vaddr 0xffff82d040200000 paddr 0x0000000000200000 align 2**21 filesz 0x00000000002c689c memsz 0x00000000003f7e20 flags rwx NOTE off 0x000000000040c528 vaddr 0xffff82d04040c528 paddr 0x000000000040c528 align 2**2 filesz 0x0000000000000024 memsz 0x0000000000000024 flags r-- Account for the program header offset of the LOAD segment when checking whether the NOTE segments is contained within. Fixes: a353cab905af ('build_id: Provide ld-embedded build-ids') Signed-off-by: Roger Pau Monné Acked-by: Andrew Cooper Reviewed-by: Jan Beulich --- xen/arch/x86/boot/mkelf32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c index 5f9e7e440e84..91742162bbb1 100644 --- a/xen/arch/x86/boot/mkelf32.c +++ b/xen/arch/x86/boot/mkelf32.c @@ -358,7 +358,8 @@ int main(int argc, char **argv) note_sz = in64_phdr.p_memsz; note_base = in64_phdr.p_vaddr - note_base; - if ( in64_phdr.p_offset > dat_siz || offset > in64_phdr.p_offset ) + if ( in64_phdr.p_offset > (offset + dat_siz) || + offset > in64_phdr.p_offset ) { fprintf(stderr, "Expected .note section within .text section!\n" \ "Offset %"PRId64" not within %d!\n", From patchwork Tue Mar 18 17:35:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 14021364 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D74D1C282EC for ; Tue, 18 Mar 2025 17:36:29 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.919607.1324026 (Exim 4.92) (envelope-from ) id 1tuarV-0006Z8-Gb; Tue, 18 Mar 2025 17:36:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 919607.1324026; Tue, 18 Mar 2025 17:36:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tuarV-0006Z1-Cg; Tue, 18 Mar 2025 17:36:21 +0000 Received: by outflank-mailman (input) for mailman id 919607; Tue, 18 Mar 2025 17:36:19 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tuarT-00060R-MJ for xen-devel@lists.xenproject.org; Tue, 18 Mar 2025 17:36:19 +0000 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [2607:f8b0:4864:20::102e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 7f7a932c-041f-11f0-9abb-95dc52dad729; Tue, 18 Mar 2025 18:36:18 +0100 (CET) Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-3012885752dso5851081a91.2 for ; Tue, 18 Mar 2025 10:36:18 -0700 (PDT) Received: from localhost ([84.78.159.3]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-301539ee99fsm8508710a91.20.2025.03.18.10.36.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 10:36:16 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 7f7a932c-041f-11f0-9abb-95dc52dad729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1742319377; x=1742924177; 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=afzNQQfyUFyqOTFTLz1B2r9ofknuhIv9O17Klkth97o=; b=lifBCOgDLXmXzjieJwzXM8i07p6tXolTF/L0smXhkJEn+eVv7FkL9NHdLPjwoxXeoN XwSz9vC48vnhlQl/A20A2O8juB8e2b6HEhEMtR4cs+nyPNoBBi7ETaNzDPQTa1ZjpRru UOI89PebaXPFIhoKrXXOvN7VixvX8MXU35seY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742319377; x=1742924177; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=afzNQQfyUFyqOTFTLz1B2r9ofknuhIv9O17Klkth97o=; b=sRhZT0hVZCMbHEEe6HGmi3i5TjTSOeQ59gce52NZSWIQ5KIQ/8IrMLCb1e92zzIyjm Lrs/dOi+inY6XW1SePBzxHukkVKD3Ojts6geLO2gFgXYNJP7F0CZyK6rYKn+Y5dx/DOH xUH72rC+NRfw1UOIEFckkofILmc3ehdgzlf7lnau0XKqFdOU1sGgqhHLHQ0nvshD++VG 5BJ/CliAwrMFFR5Dgy4R47yTlG50kOV2aGmGE7+5cM8g4ccOKTH5ctD5A6Cw09CsaT1Z ZlVOzV4CRW0dlQAUasfM40pyByf05TLsyIJU9+MsTfkVkc9kd32FEp0gET1iuatjPVle lU6g== X-Gm-Message-State: AOJu0YwzmQksfW3ccDnUAYT1NPTZ1HKJMNCRUQBuHSA78KmL/K68WgTQ dljtC8XPRf2qNICmEonSv1XoNKe4qE2iusMu+br+bj4lw2fAtQGugsjTDcTI1vt/DZ63Z8uHZE6 4 X-Gm-Gg: ASbGnculEn9axSnoK9r5ztk2A5WeVjg7vqCzRKfwmYJLmgYsb7nh1ykJRmf/CerdIzH CpuRTeLOt8L5z/FJTscvTa2ccBjiNY3xx4cZ3wUaEOQhrRIjNUFkHjGyzRuxofWSnjLLycZr8eZ 4dCrjxmEwVIjFEjOdexbbErikNTCPZuG6F1LSfteeMeqwVxRE2mboDd9VBDnMvI70Xd2rn66WgT TVH29vC3/cJRFNkIyVdDeP3N1uCSSyPCN6kudM/2WjXoXP4ELwS0/SK9Sc7UX/l6+idwCXR5ONg X39ehtCnXyftu1Otg2UohtSB/rKqD8hG1j3BMDy9Hn4N6B8QEQ== X-Google-Smtp-Source: AGHT+IESs8x8IkAZxLTS2lTF0bIBzqhtjNgD7seROnQX8yskfy18JdOKC2rIeOv3cDoBuyZ2imJPkg== X-Received: by 2002:a17:90b:2685:b0:2ff:7c2d:6ff3 with SMTP id 98e67ed59e1d1-301a5b9615amr4801160a91.35.1742319376826; Tue, 18 Mar 2025 10:36:16 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Shawn Anastasio , Alistair Francis , Bob Eshleman , Connor Davis , Oleksii Kurochko , Jan Beulich , Andrew Cooper Subject: [PATCH 3/7] xen: remove -N from the linker command line Date: Tue, 18 Mar 2025 18:35:43 +0100 Message-ID: <20250318173547.59475-4-roger.pau@citrix.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250318173547.59475-1-roger.pau@citrix.com> References: <20250318173547.59475-1-roger.pau@citrix.com> MIME-Version: 1.0 It's unclear why -N is being used in the first place. It was added by commit 40828c657dd0c back in 2004 without any justification. When building a PE image it's actually detrimental to forcefully set the .text section as writable. The GNU LD man page contains the following warning regarding the -N option: > Note: Although a writable text section is allowed for PE-COFF targets, it > does not conform to the format specification published by Microsoft. Remove the usage of -N uniformly on all architectures, assuming that the addition was simply done as a copy and paste of the original x86 linking rune. Signed-off-by: Roger Pau Monné Reviewed-by: Andrew Cooper Reviewed-by: Jan Beulich --- xen/arch/arm/Makefile | 6 +++--- xen/arch/ppc/Makefile | 6 +++--- xen/arch/riscv/Makefile | 6 +++--- xen/arch/x86/Makefile | 12 ++++++------ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 4837ad467a06..129a109d6ec5 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -97,19 +97,19 @@ ifeq ($(CONFIG_ARM_64),y) endif $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \ + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \ $(objtree)/common/symbols-dummy.o -o $(dot-target).0 $(NM) -pa --format=sysv $(dot-target).0 \ | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \ > $(dot-target).0.S $(MAKE) $(build)=$(@D) $(dot-target).0.o - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \ + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \ $(dot-target).0.o -o $(dot-target).1 $(NM) -pa --format=sysv $(dot-target).1 \ | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \ > $(dot-target).1.S $(MAKE) $(build)=$(@D) $(dot-target).1.o - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \ + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \ $(dot-target).1.o -o $@ $(NM) -pa --format=sysv $@ \ | $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \ diff --git a/xen/arch/ppc/Makefile b/xen/arch/ppc/Makefile index 655d212f6687..cf27bcebb25a 100644 --- a/xen/arch/ppc/Makefile +++ b/xen/arch/ppc/Makefile @@ -12,19 +12,19 @@ $(TARGET): $(TARGET)-syms cp -f $< $@ $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \ + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \ $(objtree)/common/symbols-dummy.o -o $(dot-target).0 $(NM) -pa --format=sysv $(dot-target).0 \ | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \ > $(dot-target).0.S $(MAKE) $(build)=$(@D) $(dot-target).0.o - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \ + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \ $(dot-target).0.o -o $(dot-target).1 $(NM) -pa --format=sysv $(dot-target).1 \ | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \ > $(dot-target).1.S $(MAKE) $(build)=$(@D) $(dot-target).1.o - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \ + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \ $(dot-target).1.o -o $@ $(NM) -pa --format=sysv $@ \ | $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \ diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile index b0c8270a9947..516f5d505ca8 100644 --- a/xen/arch/riscv/Makefile +++ b/xen/arch/riscv/Makefile @@ -16,19 +16,19 @@ $(TARGET): $(TARGET)-syms $(OBJCOPY) -O binary -S $< $@ $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \ + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \ $(objtree)/common/symbols-dummy.o -o $(dot-target).0 $(NM) -pa --format=sysv $(dot-target).0 \ | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \ > $(dot-target).0.S $(MAKE) $(build)=$(@D) $(dot-target).0.o - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \ + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \ $(dot-target).0.o -o $(dot-target).1 $(NM) -pa --format=sysv $(dot-target).1 \ | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \ > $(dot-target).1.S $(MAKE) $(build)=$(@D) $(dot-target).1.o - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \ + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \ $(dot-target).1.o -o $@ $(NM) -pa --format=sysv $@ \ | $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \ diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index f59c9665fdd0..c2f1dcf301d6 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -139,19 +139,19 @@ $(TARGET): $(TARGET)-syms $(efi-y) $(obj)/boot/mkelf32 CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \ + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \ $(objtree)/common/symbols-dummy.o -o $(dot-target).0 $(NM) -pa --format=sysv $(dot-target).0 \ | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \ > $(dot-target).0.S $(MAKE) $(build)=$(@D) $(dot-target).0.o - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \ + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \ $(dot-target).0.o -o $(dot-target).1 $(NM) -pa --format=sysv $(dot-target).1 \ | $(objtree)/tools/symbols $(all_symbols) --sysv --sort $(syms-warn-dup-y) \ > $(dot-target).1.S $(MAKE) $(build)=$(@D) $(dot-target).1.o - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \ + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \ $(orphan-handling-y) $(dot-target).1.o -o $@ $(NM) -pa --format=sysv $@ \ | $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \ @@ -212,7 +212,7 @@ ifeq ($(CONFIG_DEBUG_INFO),y) $(if $(filter --strip-debug,$(EFI_LDFLAGS)),echo,:) "Will strip debug info from $(@F)" endif $(foreach base, $(VIRT_BASE) $(ALT_BASE), \ - $(LD) $(call EFI_LDFLAGS,$(base)) -T $(obj)/efi.lds -N $< $(relocs-dummy) \ + $(LD) $(call EFI_LDFLAGS,$(base)) -T $(obj)/efi.lds $< $(relocs-dummy) \ $(objtree)/common/symbols-dummy.o $(note_file_option) \ -o $(dot-target).$(base).0 &&) : $(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(dot-target).$(base).0) \ @@ -222,7 +222,7 @@ endif > $(dot-target).0s.S $(MAKE) $(build)=$(@D) .$(@F).0r.o .$(@F).0s.o $(foreach base, $(VIRT_BASE) $(ALT_BASE), \ - $(LD) $(call EFI_LDFLAGS,$(base)) -T $(obj)/efi.lds -N $< \ + $(LD) $(call EFI_LDFLAGS,$(base)) -T $(obj)/efi.lds $< \ $(dot-target).0r.o $(dot-target).0s.o $(note_file_option) \ -o $(dot-target).$(base).1 &&) : $(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(dot-target).$(base).1) \ @@ -231,7 +231,7 @@ endif | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \ > $(dot-target).1s.S $(MAKE) $(build)=$(@D) .$(@F).1r.o .$(@F).1s.o - $(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T $(obj)/efi.lds -N $< \ + $(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T $(obj)/efi.lds $< \ $(dot-target).1r.o $(dot-target).1s.o $(orphan-handling-y) \ $(note_file_option) -o $@ $(NM) -pa --format=sysv $@ \ From patchwork Tue Mar 18 17:35:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 14021367 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 16143C282EC for ; Tue, 18 Mar 2025 17:36:37 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.919612.1324036 (Exim 4.92) (envelope-from ) id 1tuarb-000707-Po; Tue, 18 Mar 2025 17:36:27 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 919612.1324036; Tue, 18 Mar 2025 17:36:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tuarb-000700-Lo; Tue, 18 Mar 2025 17:36:27 +0000 Received: by outflank-mailman (input) for mailman id 919612; Tue, 18 Mar 2025 17:36:25 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tuarZ-0005mN-Pu for xen-devel@lists.xenproject.org; Tue, 18 Mar 2025 17:36:25 +0000 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [2607:f8b0:4864:20::62c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 82cd6eb2-041f-11f0-9899-31a8f345e629; Tue, 18 Mar 2025 18:36:24 +0100 (CET) Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-224100e9a5cso115688115ad.2 for ; Tue, 18 Mar 2025 10:36:24 -0700 (PDT) Received: from localhost ([84.78.159.3]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-7371167e17fsm10144622b3a.104.2025.03.18.10.36.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 10:36:21 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 82cd6eb2-041f-11f0-9899-31a8f345e629 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1742319382; x=1742924182; 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=9KhreOqQURS5ztJK6NNrxpVchE7gIrRKS/GcpRSMP/k=; b=tfOaVlIMzKNSqtgl/jbRRmak2Xwv3h9JGkXX8vwmuN6XiNmGgCza5Ab+SjSzb52U/R bv9sJXK+H36EPHBZ3bNZvQ//fR4KmHqEL+CHNemeCx/zGg27gBAGvT/AaqQCW/eCuprV taKVOHHZNGp6favUPdg80ZwOF09Hh3Yc6Gtkw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742319382; x=1742924182; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9KhreOqQURS5ztJK6NNrxpVchE7gIrRKS/GcpRSMP/k=; b=lvD2ZyJO77QTW1Vxu7Au0IADmAdu4f3ruYJ5lYEGoq9N3oCZbBtW3sAe/poZT9yuBs 1ictJJFL03KnZG19IjjM9Wx+mkyE5XHDMgFk0y6DNrvaaItb9r9YURFFngn3Ic/SRsWw wMANJ1eO9l8tJX3s7gnQ31sCf5aSfcnOoX2YhDSw8xeUfyMuCSz/7pzsPz+bZ6uFgZBa 6TwuvL+iv7VmKXxijjxdHTrgMsKrIjVMgTaII43WjFT/XAFRR0acMJUKx1a//RU4+eYh eKpqRZl1SEsKLHP4Rp44/gIz8JTOiyO5ZX5bXf4Z1B4G/dynlYHh/ZW7lXP1ODSi9g24 ncxA== X-Gm-Message-State: AOJu0YxezHCMRrANCOKBH/prOxKWLgSXCVN02CoWR7gy72tJlL5vtcr/ n7iuQltEwm+NFtbxm2Tx59zi/B3mWLvlyRYt+yg2Hk26mJXEnq9pkxPDOazvr2X9TX3iHdl1x6e r X-Gm-Gg: ASbGncsAipvmiFH/gQZff26hvlhiAeB6TeRJRTBcMFKIvUdTabNLZB8+uMPxcK1aEcy ATA5RsVySlh1abaDM9452WmJiJhAYH/yRY9snuRF3qHpo2Rp0ng0VYCobECW0TEvXSs184yclf6 ftpPvnEx19CAyTyPuMK2/0Mj1kP0k990wngHJ93nVpNUOeMKeEvnKs4Gm6/d2WFVk3fVrIs6xSQ gQm13H0zX51pIo7o3+MTm8UlzIRS9fMcYOqB155LkaYNDRrftmaX7RAyusqhUSzXcsGA62aUwpb /pemsiRAJlfqZ5MQdG2KQECOEZW159L7/HaAapwxRnWLOW8D9A== X-Google-Smtp-Source: AGHT+IHDH8lpZJUcCK8W5dngcQSp989Qg7KHwHuCrLVEBR91aX9cw7ot+dlbwpRmSr8inDbPaZiTYg== X-Received: by 2002:a05:6a00:14cc:b0:732:5611:cbb5 with SMTP id d2e1a72fcca58-73722399d9fmr16971960b3a.11.1742319382219; Tue, 18 Mar 2025 10:36:22 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Andrew Cooper , "Daniel P. Smith" , =?utf-8?q?Marek_Marczykow?= =?utf-8?q?ski-G=C3=B3recki?= Subject: [PATCH 4/7] x86/boot: apply trampoline relocations at destination position Date: Tue, 18 Mar 2025 18:35:44 +0100 Message-ID: <20250318173547.59475-5-roger.pau@citrix.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250318173547.59475-1-roger.pau@citrix.com> References: <20250318173547.59475-1-roger.pau@citrix.com> MIME-Version: 1.0 Change the order relocations are applied. Currently the trampoline is patched for relocations before being copied to the low 1MB region. Change the order and instead copy the trampoline first to the low 1MB region and then apply the relocations. This will allow making .init.text section read-only (so read and execute permissions only), which is relevant when Xen is built as a PE image. Signed-off-by: Roger Pau Monné Reviewed-by: Frediano Ziglio --- xen/arch/x86/boot/build32.lds.S | 1 + xen/arch/x86/boot/head.S | 6 +++--- xen/arch/x86/boot/reloc-trampoline.c | 16 ++++++++-------- xen/arch/x86/efi/efi-boot.h | 15 ++++++--------- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/xen/arch/x86/boot/build32.lds.S b/xen/arch/x86/boot/build32.lds.S index 1e59732edd6e..92dc320b7380 100644 --- a/xen/arch/x86/boot/build32.lds.S +++ b/xen/arch/x86/boot/build32.lds.S @@ -50,6 +50,7 @@ SECTIONS DECLARE_IMPORT(__trampoline_seg_start); DECLARE_IMPORT(__trampoline_seg_stop); DECLARE_IMPORT(trampoline_phys); + DECLARE_IMPORT(trampoline_start); DECLARE_IMPORT(boot_vid_info); . = . + GAP; *(.text) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 59a2b5005cf6..3f81b21b5a7f 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -679,9 +679,6 @@ trampoline_setup: shr $PAGE_SHIFT, %ecx /* %ecx = Slot to write */ mov %edx, sym_offs(l1_bootmap)(%esi, %ecx, 8) - /* Apply relocations to bootstrap trampoline. */ - call reloc_trampoline32 - /* Do not parse command line on EFI platform here. */ cmpb $0, sym_esi(efi_platform) jnz 1f @@ -709,6 +706,9 @@ trampoline_setup: mov $((trampoline_end - trampoline_start) / 4),%ecx rep movsl + /* Apply relocations to bootstrap trampoline. */ + call reloc_trampoline32 + /* Jump into the relocated trampoline. */ lret diff --git a/xen/arch/x86/boot/reloc-trampoline.c b/xen/arch/x86/boot/reloc-trampoline.c index e35e7c78aa86..ac54aef14eaf 100644 --- a/xen/arch/x86/boot/reloc-trampoline.c +++ b/xen/arch/x86/boot/reloc-trampoline.c @@ -20,19 +20,19 @@ void reloc_trampoline64(void) uint32_t phys = trampoline_phys; const int32_t *trampoline_ptr; - /* - * Apply relocations to trampoline. - * - * This modifies the trampoline in place within Xen, so that it will - * operate correctly when copied into place. - */ + /* Apply relocations to trampoline after copy to destination. */ +#define RELA_TARGET(ptr, bits) \ + *(uint ## bits ## _t *)(phys + *ptr + (long)ptr - (long)trampoline_start) + for ( trampoline_ptr = __trampoline_rel_start; trampoline_ptr < __trampoline_rel_stop; ++trampoline_ptr ) - *(uint32_t *)(*trampoline_ptr + (long)trampoline_ptr) += phys; + RELA_TARGET(trampoline_ptr, 32) += phys; for ( trampoline_ptr = __trampoline_seg_start; trampoline_ptr < __trampoline_seg_stop; ++trampoline_ptr ) - *(uint16_t *)(*trampoline_ptr + (long)trampoline_ptr) = phys >> 4; + RELA_TARGET(trampoline_ptr, 16) = phys >> 4; + +#undef RELA_TARGET } diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index 1d8902a9a724..e4ed8639b9ac 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -105,10 +105,8 @@ static void __init efi_arch_relocate_image(unsigned long delta) } } -static void __init relocate_trampoline(unsigned long phys) +static void __init relocate_trampoline(void) { - trampoline_phys = phys; - if ( !efi_enabled(EFI_LOADER) ) return; @@ -213,6 +211,8 @@ static void __init efi_arch_process_memory_map(EFI_SYSTEM_TABLE *SystemTable, } } + if ( !trampoline_phys ) + trampoline_phys = cfg.addr; } static void *__init efi_arch_allocate_mmap_buffer(UINTN map_size) @@ -223,11 +223,7 @@ static void *__init efi_arch_allocate_mmap_buffer(UINTN map_size) static void __init efi_arch_pre_exit_boot(void) { if ( !trampoline_phys ) - { - if ( !cfg.addr ) - blexit(L"No memory for trampoline"); - relocate_trampoline(cfg.addr); - } + blexit(L"No memory for trampoline"); } static void __init noreturn efi_arch_post_exit_boot(void) @@ -236,6 +232,7 @@ static void __init noreturn efi_arch_post_exit_boot(void) efi_arch_relocate_image(__XEN_VIRT_START - xen_phys_start); memcpy(_p(trampoline_phys), trampoline_start, cfg.size); + relocate_trampoline(); /* * We're in physical mode right now (i.e. identity map), so a regular @@ -638,7 +635,7 @@ static void __init efi_arch_memory_setup(void) status = efi_bs->AllocatePages(AllocateMaxAddress, EfiLoaderData, PFN_UP(cfg.size), &cfg.addr); if ( status == EFI_SUCCESS ) - relocate_trampoline(cfg.addr); + trampoline_phys = cfg.addr; else { cfg.addr = 0; From patchwork Tue Mar 18 17:35:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 14021368 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D210C28B2F for ; Tue, 18 Mar 2025 17:36:41 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.919621.1324046 (Exim 4.92) (envelope-from ) id 1tuarh-0007S9-1m; Tue, 18 Mar 2025 17:36:33 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 919621.1324046; Tue, 18 Mar 2025 17:36:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tuarg-0007S2-UJ; Tue, 18 Mar 2025 17:36:32 +0000 Received: by outflank-mailman (input) for mailman id 919621; Tue, 18 Mar 2025 17:36:31 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tuarf-0005mN-Nb for xen-devel@lists.xenproject.org; Tue, 18 Mar 2025 17:36:31 +0000 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [2607:f8b0:4864:20::62e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 86011809-041f-11f0-9899-31a8f345e629; Tue, 18 Mar 2025 18:36:29 +0100 (CET) Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-22548a28d0cso10964035ad.3 for ; Tue, 18 Mar 2025 10:36:29 -0700 (PDT) Received: from localhost ([84.78.159.3]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-737116b378bsm9913768b3a.180.2025.03.18.10.36.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 10:36:27 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 86011809-041f-11f0-9899-31a8f345e629 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1742319388; x=1742924188; 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=65x9tIuo8RiSngh578dsqmv2cGZ1RIuqM9MS+sxM7n0=; b=iAUBWohT8KhapBBHYWs+uoTIi+6Khx2muYTkQeWnnhQvJ5MpU+hWQ1CM5RpER32pLi fvg+wnJBdR0/EL7Kog36rdlok5E6NOVeao8cZ16W8nOx6n4xhDRpr2/FwTjiXsMwspqg 6XA2R//AVYMsxcYi7Bo0xHQJjDOIWaPmh+Lfo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742319388; x=1742924188; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=65x9tIuo8RiSngh578dsqmv2cGZ1RIuqM9MS+sxM7n0=; b=aFf1Jtubc86CJxjccIystVp8DkPeEae/SRvkHxgWGk5R6v8aa2loWSkrcLg/8a+ZxT dZiZONpwe+nEdsQolhwIYyhuJWKYqKrkTjfbDbtl6ukqxA7z2bBV1aFLsny39/lXsLGs l7/2TksxzpBcCzbHfeb1kdNI25xyyr28JxM/FmcFyMNr/uD+gKtVTR6ZOJ6AtQvSU9ej LtF+946FHqNatYPVonF3hsSGn3ro6VZUG2phR2E4VJzhkcFUO7WI5w1aaUp4cQP7Czwm EGc8ETqoSiVwn/ZNruKdSVYuAnU112wWbxBB+Qjb6EjzHfBzgPey3yfFSwdp8FLdc6It Wegw== X-Gm-Message-State: AOJu0Yyp4htl0r3tlLZezUO+INhGSgX+qGzy2R6/v1wK1jzBFVp0atEx h4Oz7r8bGZ8kXJU89cF2DeZf/YUA0YxQIrP7u0varTOcVfyHz96a6UjckwcdRCf/fblFVfLOvTF S X-Gm-Gg: ASbGnctSo9Cq+d5dgHQoydqd/ygNUQMmmHP3FIq5RFmgImg5JOPbp7akPSXewH54in7 a1/GQ7Gi7IHZwZummFU3y1Bt12KkVkrfpwqv928MsJBGD3nxAJxEOSJsaTenU1ZtZX1MK0F60pw MZAyokEHHPoTM5i+R0CVDRMo4LsaI67OCU5bknMmZS0hEWgbLHoFqKkc8IdUVhioBaSUoLllOal ZNXrXVZ2ptwhJWQdfHtpek3ezcRUAj8kG3yp0uMsaztJ71jGqBajWnxnASlX27AS5N3fN9EKnRc m6MKriyJdB4MmHKt4FBg4YYj/yDGqSR9ucpR0Jf/oJPa/HvIdA== X-Google-Smtp-Source: AGHT+IHBmHeZPVhhAefSRXC16fWz8L91e4nLV5etg4aNZ5lIx3DY+90wO0OaM48da41HjeI/xoenuQ== X-Received: by 2002:a05:6a00:3d08:b0:736:ab49:a6e4 with SMTP id d2e1a72fcca58-7372236f104mr18793159b3a.1.1742319387599; Tue, 18 Mar 2025 10:36:27 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , "Daniel P. Smith" , =?utf-8?q?Marek_Marczykow?= =?utf-8?q?ski-G=C3=B3recki?= , Jan Beulich , Andrew Cooper Subject: [PATCH 5/7] x86/mkreloc: remove warning about relocations to RO section Date: Tue, 18 Mar 2025 18:35:45 +0100 Message-ID: <20250318173547.59475-6-roger.pau@citrix.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250318173547.59475-1-roger.pau@citrix.com> References: <20250318173547.59475-1-roger.pau@citrix.com> MIME-Version: 1.0 Relocations are now applied after having moved the trampoline, so there's no reason to warn about relocations to read-only sections. The logic that apply the relocations would make sure they are applied against writable mappings. Signed-off-by: Roger Pau Monné --- xen/arch/x86/efi/mkreloc.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/xen/arch/x86/efi/mkreloc.c b/xen/arch/x86/efi/mkreloc.c index 375cb79d6959..a5a1969f2ee5 100644 --- a/xen/arch/x86/efi/mkreloc.c +++ b/xen/arch/x86/efi/mkreloc.c @@ -216,11 +216,6 @@ static void diff_sections(const unsigned char *ptr1, const unsigned char *ptr2, exit(3); } - if ( !(sec->flags & IMAGE_SCN_MEM_WRITE) ) - fprintf(stderr, - "Warning: relocation to r/o section %.8s:%08" PRIxFAST32 "\n", - sec->name, i - disp); - printf("\t.word (%u << 12) | 0x%03" PRIxFAST32 "\n", reloc, sec->rva + i - disp - rva); reloc_size += 2; From patchwork Tue Mar 18 17:35:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 14021369 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3EEB8C282EC for ; Tue, 18 Mar 2025 17:36:46 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.919630.1324055 (Exim 4.92) (envelope-from ) id 1tuarm-00082o-Bo; Tue, 18 Mar 2025 17:36:38 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 919630.1324055; Tue, 18 Mar 2025 17:36: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 1tuarm-00082f-8n; Tue, 18 Mar 2025 17:36:38 +0000 Received: by outflank-mailman (input) for mailman id 919630; Tue, 18 Mar 2025 17:36:36 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tuark-0005mN-Ni for xen-devel@lists.xenproject.org; Tue, 18 Mar 2025 17:36:36 +0000 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [2607:f8b0:4864:20::1036]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 895a62eb-041f-11f0-9899-31a8f345e629; Tue, 18 Mar 2025 18:36:35 +0100 (CET) Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-300fefb8e06so6558622a91.0 for ; Tue, 18 Mar 2025 10:36:35 -0700 (PDT) Received: from localhost ([84.78.159.3]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-301539ed283sm9468305a91.18.2025.03.18.10.36.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 10:36:32 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 895a62eb-041f-11f0-9899-31a8f345e629 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1742319393; x=1742924193; 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=lnnJ3xUa+7L049ca6Sahnid1TE+CyJxFQ59zdbyMZxw=; b=rR5ke08HrJUomu+ykVjM3XBi134zBON6pTB6xFHqVztC4+k0vkyqggVJiQSpYGtoFW C/xuS75g564zJrZBkZdDPehwLpXxlz8ejXaxMV9GS42i5V4/+zhT8VnIGWTVulWwrcer xe+uOM6LiiDUzbtpay2Lfak2fD0TNqaOTSqtE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742319393; x=1742924193; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lnnJ3xUa+7L049ca6Sahnid1TE+CyJxFQ59zdbyMZxw=; b=gQvr/i2eV3PV9YdBtWZA683lYJLkLd+UE3DsVKISw4yKIaNtKYPqWscw/y66O3q1Et fB5Lme5C8/UgGTy3QEq4KdPOqDwVY29bRHvWNWfebWs9r1kYIleRM05fGZgocWv63tXq w8sIb13T/Nf/kpaEtTBDS9GRvR4jAoWbt9yol/U1hqIG/gUW+ZogWH4FWIqY/rpcFMC+ UbK3LnNXGXyBNd89HeMfFT54kwcpzDH3Ydf6WOMUUfvYRfppVhG6mheTQQ+zZzuQTXzj rh4Np88RtoC7y+G/QPbbIag3veNW1clw9CIHaHJn7dOg4F03ZMHBnmHqrOLdYVzLx5/H dJ5g== X-Gm-Message-State: AOJu0YxeCFiLje3GBIf7Os5ltmpQcXTZL8yR02o7l4tCHPjIgj8rjFw6 DoSJdrNssWR97H3UUm6+HLaQ1XhAhf6DpQpznwX+z9QE0tY/eALugG35VcYSCfwtlKqTYreVVdP d X-Gm-Gg: ASbGncutSNfk5f8RtuUfv62rhvQ4J3ZJNoE3e3W3vk4B7AZ7YGPJEubZEbIBgnRCTmD vOGNYsVEzqOqBY1GUToMY3FwnKcR7aaTTvSpS/uUwXEZ38RUSizYD04Cd82ZO+tKT+dEH/RgNVD DTSfRu/l7+zsF/u/SOvCLo9yA0aIJ/z5romwzpdeZQxXoN7Dke9+KPqbDeVyjqqNPsKmhVvm5Hr OgHcth1arjACYxnUoLrkG9Kgg7evMa8qfRs6cdovjvKy8aa7DbMccLtT2jS7xiOf1qNSpWe1krR 0trQ2wRjuPyaaTHfJxscQpdM29sZOjAYp7s7FWR4N7kGxXfLVg== X-Google-Smtp-Source: AGHT+IFXq7LlHxnBn4TlEJLayGWBPmrkETzsLxszrzf6fvzFGAVESafuRGRJtglAaac4Evwz9sRLMg== X-Received: by 2002:a17:90a:ec90:b0:2ee:d371:3227 with SMTP id 98e67ed59e1d1-301a5b1cf96mr4723168a91.17.1742319393308; Tue, 18 Mar 2025 10:36:33 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Andrew Cooper Subject: [PATCH 6/7] x86/efi: do not merge all .init sections Date: Tue, 18 Mar 2025 18:35:46 +0100 Message-ID: <20250318173547.59475-7-roger.pau@citrix.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250318173547.59475-1-roger.pau@citrix.com> References: <20250318173547.59475-1-roger.pau@citrix.com> MIME-Version: 1.0 As a result of relocations now being applied after the trampoline has been copied into the low 1MB region, there's no need for a single .init section that's writable, as .init.text is no longer modified. Remove the bodge and fallback to the layout used by ELF images with an .init.text and .init.data section. The resulting PE sections are: Sections: Idx Name Size VMA LMA File off Algn 0 .text 0019072c ffff82d040200000 ffff82d040200000 00000440 2**4 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .rodata 000884c8 ffff82d040400000 ffff82d040400000 00190b80 2**2 CONTENTS, ALLOC, LOAD, DATA 2 .buildid 00000035 ffff82d0404884c8 ffff82d0404884c8 00219060 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 3 .init.text 00052866 ffff82d040600000 ffff82d040600000 002190a0 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 4 .init.data 00059730 ffff82d040658000 ffff82d040658000 0026b920 2**2 CONTENTS, ALLOC, LOAD, DATA [...] Signed-off-by: Roger Pau Monné Reviewed-by: Andrew Cooper --- xen/arch/x86/xen.lds.S | 8 -------- 1 file changed, 8 deletions(-) diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index d4dd6434c466..5ab37cefa25a 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -197,11 +197,7 @@ SECTIONS __2M_init_start = .; /* Start of 2M superpages, mapped RWX (boot only). */ . = ALIGN(PAGE_SIZE); /* Init code and data */ __init_begin = .; -#ifdef EFI /* EFI wants to merge all of .init.* ELF doesn't. */ - DECL_SECTION(.init) { -#else DECL_SECTION(.init.text) { -#endif _sinittext = .; *(.init.text) *(.text.startup) @@ -213,12 +209,8 @@ SECTIONS */ *(.altinstr_replacement) -#ifdef EFI /* EFI wants to merge all of .init.* ELF doesn't. */ - . = ALIGN(SMP_CACHE_BYTES); -#else } PHDR(text) DECL_SECTION(.init.data) { -#endif *(.init.bss.stack_aligned) . = ALIGN(POINTER_ALIGN); From patchwork Tue Mar 18 17:35:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 14021371 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0A299C28B2F for ; Tue, 18 Mar 2025 17:41:10 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.919669.1324065 (Exim 4.92) (envelope-from ) id 1tuaw1-0002ir-S4; Tue, 18 Mar 2025 17:41:01 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 919669.1324065; Tue, 18 Mar 2025 17:41:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tuaw1-0002ik-PG; Tue, 18 Mar 2025 17:41:01 +0000 Received: by outflank-mailman (input) for mailman id 919669; Tue, 18 Mar 2025 17:41:01 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tuarq-0005mN-Ax for xen-devel@lists.xenproject.org; Tue, 18 Mar 2025 17:36:42 +0000 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [2607:f8b0:4864:20::636]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8cabb536-041f-11f0-9899-31a8f345e629; Tue, 18 Mar 2025 18:36:40 +0100 (CET) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-2240b4de12bso19139585ad.2 for ; Tue, 18 Mar 2025 10:36:40 -0700 (PDT) Received: from localhost ([84.78.159.3]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-225c6bbe8f9sm97045265ad.175.2025.03.18.10.36.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Mar 2025 10:36:38 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8cabb536-041f-11f0-9899-31a8f345e629 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1742319399; x=1742924199; 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=yEL7HWOclcVrzRnpzMMvw5ftkL6OMCSWHDm4UrTJlco=; b=s2ALeU5Oh9J2AJcu4LqEOMmq1tdMKJw7Jfl5g8D+r5hRsusB/22GmtCDO1cvgKh+uS iQn2NI8qVBTk0mE9Xw4srjsjlLPOxvxRR9RsZod9A4ul9/Nlp2o3qpXWDJTz667bNF2N wC6GIAsPgzZIX4vs9H7xXRqo7JV3WAt4aS5wY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742319399; x=1742924199; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yEL7HWOclcVrzRnpzMMvw5ftkL6OMCSWHDm4UrTJlco=; b=AbeXq7aC12GrO84K8AMMW2xdPUZDQfc/NIJPwEldqBrOoNNNcfvaX1aVZIf0dap/3k WUNQYjwfk9sUUvLIj5S9IXu6ce0RtKD9UO7XjHnlf4hBVgzXpkLnKmPGzt7uC1brOnsd xP7ljj1+TaCozG6ihOIr4aJcyFM6Pf6MFCjD/ILePfzt5IS4STn5C4rxuPf8Agxp93H/ BI2tiPH9udRKXFgG8ZHbVpTglIz/e9cSWYo3SUKKhYXnqO6YXWoAD5XiDLFAkfvkeflc N3giMnfXPKebHCCT7lRL/3/0FzxSym2ZRIQM0SxM+4RxCR4sSQyBCNiAXDh7uT109rCo long== X-Gm-Message-State: AOJu0YzhGwMo13Cq5FEK+Ej/Iis5R8eeWt9ZCR3WCoGjS3GZGwfwXjW1 5VXftLpcIMlM0PrORSgHQuEP/9fjCxIqLB/sOmhmhC7FfYMvABcbTarBqjCkM53j3/rAarjYieH G X-Gm-Gg: ASbGnct6Uev3K39M4w/Zm2Czv+54gAcWZXrDHy0miRuI+MnBW7wCfN9JAuxxmTnUab9 GdH4vdkR5W3UCgnGtoGkseUUxrQgWtoTfxGs45aRC3NMRJRVRLu5Oq1zVH8voie6YI8eXeT6+EN frlrivv928hTgo+rv/NCrA1CsNkJe2JuoaF+Ma0ITYro6fVexLU6dZag3TniSDyOucstP9J84YB PS8nCLOVdptPcvAjG6725ZSiOdXt3u5+luifaomYJAuuuzOXC3S3TTCo7NAqGUwcUnEh762ilb2 N+9PGtEc0Wg1ja8tNCQEW4pgXqlYkVwQWbQwm29iNjArsSDf9A== X-Google-Smtp-Source: AGHT+IGryaJt5eLOMVWZv5Q3OSb2wjTN14Pj/IJVXnvKMDc/TIBlHrZQ+wNIJ8Ghb3x14UCD0UuT0Q== X-Received: by 2002:a17:903:2793:b0:224:255b:c92e with SMTP id d9443c01a7336-225e0a62f23mr155212305ad.3.1742319398887; Tue, 18 Mar 2025 10:36:38 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH 7/7] xen/build: warn about RWX load segments Date: Tue, 18 Mar 2025 18:35:47 +0100 Message-ID: <20250318173547.59475-8-roger.pau@citrix.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250318173547.59475-1-roger.pau@citrix.com> References: <20250318173547.59475-1-roger.pau@citrix.com> MIME-Version: 1.0 After having removed the -N option from the linker script invocation, and also having removed the merging of the .init.text and .init.data sections on x86, there should be no remaining RWX load segments. Do not silence the GNU LD warning. Signed-off-by: Roger Pau Monné Reviewed-by: Andrew Cooper --- xen/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/xen/Makefile b/xen/Makefile index 58fafab33d6f..989285df276e 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -415,8 +415,6 @@ AFLAGS += -D__ASSEMBLY__ $(call cc-option-add,AFLAGS,CC,-Wa$$(comma)--noexecstack) -LDFLAGS-$(call ld-option,--warn-rwx-segments) += --no-warn-rwx-segments - CFLAGS += $(CFLAGS-y) # allow extra CFLAGS externally via EXTRA_CFLAGS_XEN_CORE CFLAGS += $(EXTRA_CFLAGS_XEN_CORE)