From nobody Mon May 6 13:01:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1589310710; cv=none; d=zohomail.com; s=zohoarc; b=j+7XpIpAK+mhkX0yaFNbWKx8w8HCXbyapnzAuHgOpSYDgR/7FbxdnI6DOyo31ZzmLRDW4WR8ez0H594modf9j2XUi1+rvi3RrCJeAC98Wsr6z66ikgeSyv2DNcfWmP+BKguxeRIXNjt4i2KmviffSVs0uZyRB7pdmGMR1PtZGfw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589310710; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=HGEC+R3Kcrdi01FF/LzhdJpI03JexdIOHpyt8FCb2NA=; b=b6e9IJxmAaje62EtlZ4k9jsfMZeyh7CciLWXXTej96qRFNATlOL60X8cFmDmDEBjwbiDJfOnIfZ3c0bMGv/xpM1glFklhlpxssm+vP2gqquBKEg4uFsjCbF5XLD3l2wGGpkEkIU//P9n4JPlTDrgnCIk0AlIhL3sU2E8gGgUk5g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1589310710318559.9504497283039; Tue, 12 May 2020 12:11:50 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jYaJM-0002OM-3y; Tue, 12 May 2020 19:11:28 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jYaJK-0002OF-Q7 for xen-devel@lists.xenproject.org; Tue, 12 May 2020 19:11:26 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 5fc2edc2-9484-11ea-b07b-bc764e2007e4; Tue, 12 May 2020 19:11:25 +0000 (UTC) X-Inumbo-ID: 5fc2edc2-9484-11ea-b07b-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1589310685; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=koGuhiMVnPOG2QDwjwN95ApMyENVW3xkRxCOG8gCMLs=; b=Gpuqk/C/RYoMkkwbFHKdLRPz2by0FkgDeM5JM4i97kJX7MvvGp5UXRpg VdCu2eKLo1tJsiSuiCB9x+wIutB2xnWjgyNIrQeCjB3sNo/cgvI11X0gt 9w6tavJXvDVxD4Ea7me+z9rpthex9GXTP5Wh52zOw3wGhCWp/Lh6DAsSK U=; 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; Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com; dmarc=pass (p=none dis=none) d=citrix.com IronPort-SDR: vkZGNXi74RKObYukMDCiIiiczA99NXOOM5tOGNdVz5UCWqCqkESy7Eb09Kn1B48dCU9FMQlwS9 cV/PotgV//XMYenCdaor1+BjiR9qh33dAwn0uNQESH7uOPEFQAPIB3hT/fCqyOslXn+HWMiPuQ YAhghx3PnDB0YCVzeLezYRpTqyB/nphxgexIfpWtJ54Hy5BwyL6Qv0njrj2Jn6ZNF1+8gA2/hk zirupSWBh2BM0SO/qeaRMdpMj5CLvNv3HlrifGvNbpqCTw1BZi5HtZ03QSX5sOr9ay9VbfONMt PeQ= X-SBRS: 2.7 X-MesageID: 17376180 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.73,384,1583211600"; d="scan'208";a="17376180" From: Andrew Cooper To: Xen-devel Subject: [PATCH] x86/build32: Discard all orphaned sections Date: Tue, 12 May 2020 20:11:08 +0100 Message-ID: <20200512191108.6461-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Jason Andryuk , Andrew Cooper , Stefan Bader , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Linkers may put orphaned sections ahead of .text, which breaks the calling requirements. A concrete example is Ubuntu's GCC-9 default of enabling -fcf-protection which causes us to try and execute .note.gnu.properties dur= ing Xen's boot. Put .got.plt in its own section as it specifically needs preserving from the linkers point of view, and discard everything else. This will hopefully be more robust to other unexpected toolchain properties. Fixes boot from an Ubuntu build of Xen. Reported-by: Jason Andryuk Signed-off-by: Andrew Cooper Acked-by: Jan Beulich Tested-by: Jason Andryuk --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 CC: Jason Andryuk CC: Stefan Bader --- xen/arch/x86/boot/build32.lds | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/boot/build32.lds b/xen/arch/x86/boot/build32.lds index da35aee910..97454b40ff 100644 --- a/xen/arch/x86/boot/build32.lds +++ b/xen/arch/x86/boot/build32.lds @@ -31,7 +31,7 @@ SECTIONS *(.bss.*) } =20 - /DISCARD/ : { + .got.plt : { /* * PIC/PIE executable contains .got.plt section even if it is not = linked * with dynamic libraries. In such case it is just placeholder for @@ -47,6 +47,14 @@ SECTIONS * * Please check build32.mk for more details. */ - /* *(.got.plt) */ + *(.got.plt) + } + + /DISCARD/ : { + /* + * Discard everything else, to prevent linkers from putting + * orphaned sections ahead of .text, which needs to be first. + */ + *(*) } } --=20 2.11.0