From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2086.outbound.protection.outlook.com [40.107.21.86]) by sourceware.org (Postfix) with ESMTPS id 502DE385BF92; Wed, 1 Apr 2020 09:23:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 502DE385BF92 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Szabolcs.Nagy@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9uBxYHIpMqelygiBOvjM2nxEbKBboYFPaGtRV+//R/Y=; b=skeNCHAB6oI8sAIz/gw7jNixZN0G3LIJQzYwz1UYvjfvlqzEk6u6dpdSm02Ji/R24dNaRjS5jN8oaVrNobE/v3dhg3wHf2S1p/eURBR4kqkvYN1BfDDD1qi9USxHmJaJC+R+BxtzaxfwdlBdjoOw3KPCclGAeM0edcJzOldoK7c= Received: from AM0PR0202CA0015.eurprd02.prod.outlook.com (2603:10a6:208:1::28) by AM5PR0801MB2017.eurprd08.prod.outlook.com (2603:10a6:203:42::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20; Wed, 1 Apr 2020 09:23:06 +0000 Received: from AM5EUR03FT009.eop-EUR03.prod.protection.outlook.com (2603:10a6:208:1:cafe::47) by AM0PR0202CA0015.outlook.office365.com (2603:10a6:208:1::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.15 via Frontend Transport; Wed, 1 Apr 2020 09:23:06 +0000 Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; sourceware.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT009.mail.protection.outlook.com (10.152.16.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.17 via Frontend Transport; Wed, 1 Apr 2020 09:23:05 +0000 Received: ("Tessian outbound e2c88df8bbbe:v50"); Wed, 01 Apr 2020 09:23:05 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c1089d75f2157d64 X-CR-MTA-TID: 64aa7808 Received: from 3d4051ef5b3e.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 8DC7D3AC-CF23-47A0-8D7E-11AAEA08A152.1; Wed, 01 Apr 2020 09:22:59 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3d4051ef5b3e.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 01 Apr 2020 09:22:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CzbDyasnxFLorY6pvxWjxS2S+u+2OE3bSJuEihHTQVa/0KfX6edTB6qSHijJHUcpm24G8I2yv/oSqtek/O3lbiKLMHBOS9AZ0epCjm8cCY+5G3Lfh+ARKLRxqmVvzYWd90/N4LJaY4tiplvub6olLAOXQwiU1DyANOD3Vt3jskURecG1ONQ6pgNTOoyrnjbyyz3MvpB1M4VpblcMvNJ8/iMs6BNR0y+qVfU/lz73y0PhrtXVGSSmazZ98GI3OJOkl9T/y/Cy+Hy4GVn/AmOSN7utn55mzuvFQVUyLrL1JeB6FrAffumMxFEyurMNaaxgZPRCckV94ayIvki/1T9W5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9uBxYHIpMqelygiBOvjM2nxEbKBboYFPaGtRV+//R/Y=; b=aI1wEm7D87VUOrZm0uXhnEpst8vHcjOie6iZvAHUrtucXzjX4TLR9MnnYvT0PCdEay4y9jHYiKskHmFSZSVL/kIofsGTI0LGMJz/+0FUU1u4jRpgLtR1Dmnadb3A6fXofuzN+QsweqjlcFNa2RRLH+vdvYnkKr2xqk5kY73R9ONBNcsI2/KycABBKEOIkNB1Kuo5vRtVQzifhFjBWcw2aRfQobqMP5EO5ycdze6GOyd1J6UYUvrkWU+IlxhfQgA4xjNCxFjgq2TP7MRt5KvRWwRVbdRIUVTkxrdSdWYqt1gaKDUIv3Sqq0QRmo7kNN1vJcB6PytwBnbJ5idL1tvHVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9uBxYHIpMqelygiBOvjM2nxEbKBboYFPaGtRV+//R/Y=; b=skeNCHAB6oI8sAIz/gw7jNixZN0G3LIJQzYwz1UYvjfvlqzEk6u6dpdSm02Ji/R24dNaRjS5jN8oaVrNobE/v3dhg3wHf2S1p/eURBR4kqkvYN1BfDDD1qi9USxHmJaJC+R+BxtzaxfwdlBdjoOw3KPCclGAeM0edcJzOldoK7c= Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Szabolcs.Nagy@arm.com; Received: from AM6PR08MB3047.eurprd08.prod.outlook.com (52.135.167.23) by AM6PR08MB4183.eurprd08.prod.outlook.com (20.179.0.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20; Wed, 1 Apr 2020 09:22:58 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::8937:3724:2930:ee81]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::8937:3724:2930:ee81%3]) with mapi id 15.20.2856.019; Wed, 1 Apr 2020 09:22:57 +0000 Date: Wed, 1 Apr 2020 10:22:55 +0100 From: Szabolcs Nagy To: Florian Weimer Cc: Fangrui Song , GNU C Library , gnu-gabi , Mark Wielaard , "Zhang, Annita" , Binutils , Cary Coutant , "Liu, Hongtao" Subject: Re: binutils ld and new PT_GNU_PROPERTY segment Message-ID: <20200401092253.GM27072@arm.com> References: <20200219182701.vrtzwhgtpelmpaub@google.com> <2e29243995903cf2d52975543675f2b92fa1e201.camel@klomp.org> <20200222051913.meiied65a5daylvk@google.com> <87tv231tkt.fsf@oldenburg2.str.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87tv231tkt.fsf@oldenburg2.str.redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: LO2P123CA0047.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600::35) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.55) by LO2P123CA0047.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20 via Frontend Transport; Wed, 1 Apr 2020 09:22:57 +0000 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d1c9b73e-6abc-43ef-ffad-08d7d61e4912 X-MS-TrafficTypeDiagnostic: AM6PR08MB4183:|AM5PR0801MB2017: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-Forefront-PRVS: 03607C04F0 X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(136003)(376002)(396003)(346002)(366004)(39860400002)(6916009)(478600001)(44832011)(86362001)(26005)(81156014)(8886007)(956004)(1076003)(16526019)(81166006)(8676002)(186003)(2616005)(8936002)(54906003)(55016002)(66556008)(316002)(2906002)(36756003)(4326008)(66946007)(66476007)(5660300002)(52116002)(33656002)(7696005); DIR:OUT; SFP:1101; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: OJqBJ64EYik+CISbODZHbzdgBuBqlLrCWGa31bnMyUJFQIezNRS6zELPPu1TwpVrxLwsfvymy0HPNDXL85mNzWVdYANzKGTTuDebvlWTU0rFuigwqIGJGk6j7PQGdL5H0a7la5NfctVdPzpNj1P/ha0k3ERxe7jug0TuUDL+QhP0lQPM3NcEISoZR8BS7Py1v6ysjNerZs70mXFmcJp953TJMQSXx2B4zwzaYNT7VHDsLwp8HrEMKoo81kfZMMWaCa71fKAyuPFEF9HFcs3u83d+FTAKHg+QdR4pmnkuN+oItHV3LUeBALjNwr4SBCV1XhLbg+L4EqvyRvRMpYQKUjtRUtKKpD4794CWL5sQ7Kjz3qk8FCQQwMSHo/RirsweF9DrQSw+XVLvDTRb3VuGaksNS6Ydv8DIRuSqADf40myhFJdow/EJRTQ/e7DQRAU1 X-MS-Exchange-AntiSpam-MessageData: xmahgquiS4HgGG3eiW/afMcpRAJ7Ip3KPtUH1t7cFQX28yImvt1RyepoI5d05MXH9VimzOkfhGGkOWOh7/VaSMEsi9udngTg3YoSXd2vqJS9LKHsSbICUfYnrxIfAICFSxCs92nOFEWqdoE8ixn8ig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4183 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs.Nagy@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT009.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(396003)(136003)(346002)(39860400002)(376002)(46966005)(36756003)(16526019)(81166006)(186003)(8936002)(44832011)(336012)(5660300002)(86362001)(26005)(8676002)(55016002)(2616005)(956004)(70206006)(70586007)(81156014)(8886007)(33656002)(107886003)(450100002)(1076003)(36906005)(6862004)(47076004)(26826003)(478600001)(4326008)(316002)(54906003)(2906002)(7696005)(356004)(82740400003); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 8f22f115-115c-4652-138c-08d7d61e4430 X-Forefront-PRVS: 03607C04F0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XoBWNIF8iu3dCv4nUfkorpCTwPsbtLQSMUwAxpkKCOqks/F7rOGkFVhDcseDejSIbstf6Ibp6kJ6ZVGyIpTSq/S6hR5kzzYci/Oumh+iMQmWksPSJq85j7KXCmFyfUwXLsx12iBxWlk2o3tCkF8yGwPDsnsaa1jJNwiVQ1KKkd8q9NoCCtzWXL8dN7yW92kvTNRLovNj9un96ROCyU5C35Gwyoy3EkGVPkL0vox2o6RvFx+se4iKxHQCtmsX/KeEfqQTwQSeJ9eq8DwCHPcO10cZZkTnXyWLYK8Y8ETKhe604TaXYNdphIJEQ2lQCdi+jWoOsvl0OFcUFJWdkP7HH7EZLd/0Ry7nSEa6jMfH3SvSu70ptqB6wiZx8UD/tSjJR8p5rvW2FzckmngbUffQcVFV0tcNUZYaizkyRp1eJHlcQnQ+lV9ev0bMzhzvvDpBHMJ5syth9//S+vQlOTV3BfRusL9sPOBpBrRnsRIsiNo4iQMXhAzSS4v75Qzms9brKZ8C00H1CY/UH2mTHxZntg== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2020 09:23:05.8468 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d1c9b73e-6abc-43ef-ffad-08d7d61e4912 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB2017 X-Spam-Status: No, score=-15.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gnu-gabi@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gnu-gabi mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Apr 2020 09:23:10 -0000 The 04/01/2020 10:46, Florian Weimer via Libc-alpha wrote: > * Fangrui Song: > > > Below is my understanding of these matters. Hope they will be useful for > > interested stakeholders (for example, AArch64 devs, though PT_GNU_PROPERTY is > > currently driven by x86) who don't follow the discussions so closely. > > > > 1. We need PT_GNU_PROPERTY. > > > Old linkers don't know the special processing on input .note.gnu.property sections. > > The output .note.gnu.property does not take -z ibt/-z shstk/-z force-bti/-z pac-plt into account => > > invalid. > > The produced PT_NOTE may contain multiple NT_GNU_PROPERTY_TYPE_0 => invalid [3] > > In practice, we can recognize binaries produced by old linkers when the > object has been linked on a CET-enabled distribution because the > produced notes are always invalid. The glibc dynamic loader already > checks for this and does not enable CET in this case. > > ld -r involving exactly one CET-enabled object and one or more non-CET > objects is still problematic, of course, but it seems an unlikely > outcome. The only way I can see this happening is with a CET-by-default > GCC (such as the one Ubuntu uses), but then you still would have to use > another linker (not /usr/bin/ld). So even that seems like a fringe > issue to me. why only -r is problematic? i thought linking exactly one marked object and other non-marked ones with an old linker will have the (incorrect) marking on the output that cannot be recognised as wrong. this is why my plan for aarch64 is to only check PT_GNU_PROPERTY in glibc (which implies a new linker), i believe the kernel patches do so too. > > In short, we looked at this situation, and still think that it's > supportable. > > > Also note that sh_addralign(.note.gnu.property)=8 on a 64-bit > > platform, while > > sh_addralign(.note.gnu.build-id)=sh_addralign(.note.ABI-tag)=...=4 > > (ancient mistake made by at least Linux/FreeBSD/NetBSD/...) GNU ld > > before PR ld/23658 may create corrupted PT_NOTE. > > Yes, we ran into some of these issues in our distribution and had to > rebuild a few objects. > > > For at least the above reasons, loaders are better not interpreting PT_NOTE. > > glibc/sysdeps/x86/dl-prop.h is currently interpreting PT_NOTE => it > > should be fixed. > > I'm not sure we can do that for backwards compatibility reasons. The > ABI has been out there for several years now. on non-x86 targets it can be still done. > > Given point 1 and 3, this comment deserves a reconsideration: > > > > > Binaries with .note.gnu.property section have been put into many > > > OS releases. We must support them. > > > > 2. .note.gnu.property behaves strangely, unlike a regular SHT_NOTE. > > For a .note.gnu.property aware linker (newer GNU ld, newer lld), > > .note.gnu.property input sections are dropped. > > > > (We have .note.GNU-stack and .note.GNU-split-stack which both require special processing, but > > they are SHT_PROGBITS.) > > > > 3. We need SHT_GNU_PROPERTY. > > The output .note.gnu.property being SHT_NOTE causes linkers to place the section in both PT_NOTE > > and PT_GNU_PROPERTY. > > PT_NOTE, as explained by point 1 above, can cause trouble to old loaders. > > Have we proved that "older linker-produced concatenated PT_NOTE cannot cause trouble to loaders interpreting PT_NOTE"? > > > > SHT_GNU_PROPERTY does not contribute to PT_NOTE and will not cause any problem to old loaders > > interpreting PT_NOTE. > > Yes, I agree that it's desirable to add SHT_GNU_PROPERTY. +1