From patchwork Thu Jan 7 11:01:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 41664 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3F664396EC67; Thu, 7 Jan 2021 11:01:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F664396EC67 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1610017293; bh=AJjRKVVaPVbqR+IT22N7OI0Zk+9N+Gh1NCsQ184p9CE=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=nstIHngfjZ8D7immAC4Ea/t+dbdTxLbDkeFB7RI4SLMaCS3aNaxFO56HoVzD4ZCul 8IU7Ov6zbs9cOu9xb/DFfeeqGKdS1aB9ZozPW06HeP29oNiUusGsfBDZPZFSL7FioS OoPVCfFFbhyF+03HXudtJw8qmiEFkcgqJyDBXe/M= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70075.outbound.protection.outlook.com [40.107.7.75]) by sourceware.org (Postfix) with ESMTPS id 470D0396EC61 for ; Thu, 7 Jan 2021 11:01:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 470D0396EC61 Received: from MR2P264CA0024.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:1::36) by VI1PR08MB4224.eurprd08.prod.outlook.com (2603:10a6:803:bc::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Thu, 7 Jan 2021 11:01:27 +0000 Received: from VE1EUR03FT012.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:1:cafe::c) by MR2P264CA0024.outlook.office365.com (2603:10a6:500:1::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.23 via Frontend Transport; Thu, 7 Jan 2021 11:01:26 +0000 X-MS-Exchange-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=pass 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 VE1EUR03FT012.mail.protection.outlook.com (10.152.18.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Thu, 7 Jan 2021 11:01:26 +0000 Received: ("Tessian outbound eeda57fffe7b:v71"); Thu, 07 Jan 2021 11:01:26 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e60edd44ddb1b21b X-CR-MTA-TID: 64aa7808 Received: from fd0c542fd905.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 94FA249D-09AC-4FEC-98F5-CC3C8FFC1C9A.1; Thu, 07 Jan 2021 11:01:20 +0000 Received: from FRA01-PR2-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id fd0c542fd905.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 07 Jan 2021 11:01:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=awMLbFqKycm+oUme1YNMyl6fDoTtJoFC16QDYF0zwp18AlBS8zC4hJmxdEXhy3epit7lMbWuyxNFm77gC39UlScO74GQJi5vYItjRSvGLmNnTiy4/oUdDC+1HAHn/a/jMoFuXk9WAAkaqi/G4exsYEQ3mn2+ysJetHH6oO44GMA7lMC8tq+Mf1RDf5E2dj7dFKasnYNAuFlzh90RJfPhZijOMbBpQFbpIisigutXF77q1kGw6dqN/pllj5IMquZGh+iE+vqeS5csOvmSI2b/whqi/FPHbWXPHQh5yJa1fxPBvbz/jdM6XuxQLxxLehQFGphCx0a4TX6tDecY7XyNAg== 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=AJjRKVVaPVbqR+IT22N7OI0Zk+9N+Gh1NCsQ184p9CE=; b=GlH0zdQnGO4Im7XZO6ybTb7wa4Bz3S6XgZORo3z4OFlZUoPMedR1QtjxTLRxzq7J2qApS/F+UZZ3m508BUk1H0FODFHmf+9IcGAg9XXXeP68H8wMBDQik1z3meG34veQzFBnboc1kD7V/bDbpXHWld9QGEoyj5uQDWXSregz9bb5pSO2Px5NDg6GC+mEO1FxuTM05CcITYK/mjQnRtG0Qz+ohhc93m5KyrAIQhrmlweDpNE8OnS1ycvTqWFxdKCzpEG1YwGQ0qyLuJ1YbgTI4W+/hzEeflMH/Hy3VQcQvR2ATaPmczOUpM0xLFdOE8hxOa3EIguJpgKShDJQMu2e3g== 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 Authentication-Results-Original: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com; Received: from PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) by PR2PR08MB4809.eurprd08.prod.outlook.com (2603:10a6:101:1a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.21; Thu, 7 Jan 2021 11:01:18 +0000 Received: from PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::700f:ddbe:a347:ee4f]) by PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::700f:ddbe:a347:ee4f%6]) with mapi id 15.20.3742.006; Thu, 7 Jan 2021 11:01:18 +0000 To: libc-alpha@sourceware.org Subject: [PATCH 1/3] Make libc symbols hidden in static PIE Date: Thu, 7 Jan 2021 11:01:06 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: SN6PR16CA0054.namprd16.prod.outlook.com (2603:10b6:805:ca::31) To PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.51) by SN6PR16CA0054.namprd16.prod.outlook.com (2603:10b6:805:ca::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Thu, 7 Jan 2021 11:01:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6e64f9b8-b556-414c-9a1a-08d8b2fb942e X-MS-TrafficTypeDiagnostic: PR2PR08MB4809:|VI1PR08MB4224: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: XVpvZ5ZrQ6Ll2KO5wsIi81S6jRFcM3rzwRP9P1R9rKd5U2GbQIJYurbCciDvd971kfOA/bRGn2ornwX1vdo1WtNPTgY60gjOBU8S3iJnQWwOJ54aBOmY7kZGnZZW6s42YpF2S81jxSz9+sKi3r6lfX1AUF9975hyk6XHdIY0DM2rBLiPzQcHL8dyp4S/hJtrepNfpN6JgcyJEVBVW8LrlxYSVYo/TwjJFZajlLsWn2NkjHhJFN8uwpz0MfGkLfC92Yu23JxxIRN8HKvhEYoTxCtvA4rDQI1KGlR49Puy6q5XO1aZSknvS0u3lfRlGx30niWLnQbX9j3rcUv2U5Ix1BCRxWpeXRE5zIPDp1mlSOeodDQZpbbYeIiYak+z3u/qPIlpnJTfOT6r0GqTNFehUoyZFH9P35YbRvRRf7ee7o4Weww1vy9dsm+ehz9ilKapNtV2XhTttPziBAo8ET3NMw== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PA4PR08MB6320.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(396003)(39860400002)(376002)(366004)(6666004)(2616005)(6916009)(86362001)(44832011)(69590400011)(52116002)(6486002)(956004)(8936002)(36756003)(26005)(2906002)(66946007)(66476007)(16526019)(5660300002)(6506007)(66556008)(83380400001)(8676002)(316002)(186003)(6512007)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: G+4bw/oVjdS9P8GlAgm935OTn6OlnWJNjaXNMMY5sqJG32qIT2nBQH9wasUSq3upVj6hG4Au097dJmvkT77VOgcw09+ug5Wlaq1CDwTv2IROLa1AsDatRTI//7JMQqycFJ92wzd2unnYES9amoyec2k+oEwpHMz4pNsbBBGOavTFcAJ19oFW9EB/MR50oflI/TCFJsVZB8x9jYT/gdz8VRZzFi47cqWG0KgK5UiW9Vm8tS8bhRXQMenJzovVFaxQDuVpYlJxdJCl8AarWG3gz4oDEbJxMYylpBO0JeJA5RaaafPfDKzZDLVv44oAJYsmFN+W8YN57ljamz6kvb/HZqUenMkv3zRfG/LRluW6Du1d5XCiZsOa+r7oRyQGxiBc1+7K9gcv1hkvwBxYjM6urhS33fiaMhv8GjIL766V3kUOpFYsqi0iNdM6kAm7zjrFkHP6pfv3zW9WIzYFJVy1VfA4yh/SS800XLKeh5x7Ey4RDuSy32doztWtG9xNBNy7KnqAXcTqNYPhWDzd4fYVjugF7nHsd2TVHMIkqCBWS0fWNARi+CjoI2VTRNmw1ANfYi8FFXQ7rktdondpNTuLPCLdm3jr2zMaZjRRoTTEQWz9V17lzC2ltrqx3nzFyB6ZbBBgGhbuPf5zp6aai7rdccjv0ghEm6fB7PW4VE3E/1NiCsWAui3Lot67DiqGK4UkEdS1s3YPXhhXCxgac2pc4idc2qbwDZPQ2MmCUmnjSkqNewK+60zoKvd5HPvf2aPCvFA0qMUa3EC2yrsXpRJafItmmxQBJZjDy5oC+8wP2OJr2TVs+U+KUhhm33e1vC5RtNXL3c2e0bFCfXoEho+VAgo32AXn6uQQcjZy6awUj+Ro8eMaBWCDOfr2uYerRDa+RMDa4I0Zjfrirhi6TGraIV4t9w6NPM+JGZCWJRdKJo4C1bMLV6GxUZXdzy0wrJNECcBcUdUQZFNbTowBkXoLEhaxPhVW00nleWrLkSyK3El9gx7aRRnRdc+/MAjDDzcy X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR08MB4809 Original-Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT012.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 8eb15e62-a5f9-4584-a4c2-08d8b2fb8f31 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /V2XIeIE7o70lKVuzvZZh3antXOvvC7WsZ0oEFz3rqmJD26VmqJvh9f5jGc4G0w9vL/SHIn12G3/NZulX2uSgsm3Ld3+4QJvc2NrjyH1O3yt8M6WG+g1QtETK6/LJarixlvNWnt3pEUw3lMEUovp8IrLpIIDt2TZ8lUX4/Iw5x6WvCNjnUK17z8Tj4rmRH4Ggp0q5/1CWpiFHkCa6M9IG/Ve0TAuhCV6yVCIhE129vpidEpPTrBnQREWVK7NuDBYdIrB1GE437NRx1EC+wcGdSVZoWE4/fDW3sJbmGCJ64KbzGcjppSqPeMqnaS+69QqtbgPBiqpphWuT+GEXuwO2oz16DRe6ih2VIHOLYbutYk/rxw6GR7cjKXNQO7jtmWor6z35wUU74RMVCV2Pu5rkSzPNd78uTWyofJZQrCLOH+888Osa2Q8vmwcCUoLGZ6JZLy3P0tp3pHy8a3Q0AoB7CvDwUWoFMZ1u3vg8cHAYUSEJGWWbwTHTdqEsfokrYStq7dZWPcjrzpiPEp+ieMxKQ== 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; SFS:(4636009)(376002)(346002)(136003)(396003)(39860400002)(46966006)(86362001)(6486002)(6512007)(36756003)(6916009)(44832011)(956004)(478600001)(336012)(2616005)(83380400001)(8936002)(8676002)(6506007)(2906002)(16526019)(186003)(70586007)(5660300002)(70206006)(47076005)(316002)(356005)(81166007)(82740400003)(6666004)(34020700004)(82310400003)(26005)(69590400011); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2021 11:01:26.4253 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e64f9b8-b556-414c-9a1a-08d8b2fb942e 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-AuthSource: VE1EUR03FT012.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4224 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Szabolcs Nagy via Libc-alpha From: Szabolcs Nagy Reply-To: Szabolcs Nagy Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Hidden matters with static PIE: extern symbol access in position independent code usually involves GOT indirections which needs RELATIVE relocs in a static linked PIE. Using So hidden avoids indirections and RELATIVE relocs on targets that can access symbols pc-relative. The check should use IS_IN_LIB instead of IS_IN(libc) since all static libraries can use hidden visibility to avoid indirections, however the test system links objects from libcrypt.a into dynamic linked test binaries so hidden does not work there. I think mixing static and shared libc components in the same binary should not be supported usage, but to be safe only use hidden in libc.a. From -static-pie linked 'int main(){}' this shaves off 73 relative relocs on aarch64 and reduces code size too. --- include/libc-symbols.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/libc-symbols.h b/include/libc-symbols.h index ea126ae70c..93e63ee889 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -434,13 +434,17 @@ for linking") strong_alias(real, name) #endif -#if defined SHARED || defined LIBC_NONSHARED \ - || (BUILD_PIE_DEFAULT && IS_IN (libc)) +#if defined SHARED || defined LIBC_NONSHARED # define attribute_hidden __attribute__ ((visibility ("hidden"))) #else # define attribute_hidden #endif +/* Mark all symbols hidden in static PIE libc to avoid GOT indirections. */ +#if BUILD_PIE_DEFAULT && IS_IN (libc) && !defined LIBC_NONSHARED +# pragma GCC visibility push(hidden) +#endif + #define attribute_tls_model_ie __attribute__ ((tls_model ("initial-exec"))) #define attribute_relro __attribute__ ((section (".data.rel.ro"))) From patchwork Thu Jan 7 11:01:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 41665 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 77121396EC61; Thu, 7 Jan 2021 11:01:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 77121396EC61 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1610017314; bh=1AiopfpcgMhG40uhCCdx2IKOgB/CiCg4PSIj8VpC/yk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=rqKED9UycQVf1LXLzrqeTkaw1VQx5Arr7USGBn9HDmAKTd4B2m5wQV/v7yxvPGxf/ bTFEHLiKQiJsmiAwqmy6YHKGL9L7t6DI7RpN+W7aQqCLQZJp+oWrMmmsaZYlrvCSqn Y6qD8VP9p+mOmmYVcC4T0PhDzPbTNOUOTLAlVWow= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-eopbgr90088.outbound.protection.outlook.com [40.107.9.88]) by sourceware.org (Postfix) with ESMTPS id 5D8AC3851C03 for ; Thu, 7 Jan 2021 11:01:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5D8AC3851C03 Received: from AS8PR04CA0050.eurprd04.prod.outlook.com (2603:10a6:20b:312::25) by PR2PR08MB4907.eurprd08.prod.outlook.com (2603:10a6:101:17::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.23; Thu, 7 Jan 2021 11:01:49 +0000 Received: from AM5EUR03FT033.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:312:cafe::6d) by AS8PR04CA0050.outlook.office365.com (2603:10a6:20b:312::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Thu, 7 Jan 2021 11:01:49 +0000 X-MS-Exchange-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=pass 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 AM5EUR03FT033.mail.protection.outlook.com (10.152.16.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Thu, 7 Jan 2021 11:01:48 +0000 Received: ("Tessian outbound 6ec21dac9dd3:v71"); Thu, 07 Jan 2021 11:01:48 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: b3497b064af08a29 X-CR-MTA-TID: 64aa7808 Received: from fd345ba63953.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 608AA130-2512-482E-97E7-C48BE0D0F08D.1; Thu, 07 Jan 2021 11:01:42 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id fd345ba63953.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 07 Jan 2021 11:01:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XCgApqfWV+KL9xDAb37BEUBz0+knVAmJGqfD0BeNMdext2lCKarI5kyHC18dfbyddwj0fjhL7TGQbQuL2A6EM7ybXDuxmn4CRWYoNnJdTaiWOu+I5A0jIRNOm02jrK5JMqoqxO/Ws/Sr2FOBmmDBMN0fhC+4KgtsXOeBoXb2Ysq9R95CVwdqOHb7Kq2RybYuDYuUAooek3RwYQLI+FeCw991TlloX1YgOeCXptByHPSf2sVsD4r/Rxq1WxPOGX1KZ0eMyyDQFz4gGZN795bp5MfTM8mWtZ+nOqBpdAUCRWhUVx2zE78+idIKXbfyib6awpFTHgtagzvQowP8pqhHdw== 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=1AiopfpcgMhG40uhCCdx2IKOgB/CiCg4PSIj8VpC/yk=; b=YnUW7y1jGcJFGxFeOyj859gLPaGnhYGC7htsefHq+9LIYztdY4cqsSR6X1vWyGt9OHj9DkIBVWKSsExX7TcBlunZhu314X6tPX0DeVgf/lyGehYFRp13sToSNkJYT5SN3Fs1fMfI905ODLreqQ1hq+m6h6ZFIPsHKROYk3dJKzUYfCfwSLfW5t25+cc4WFTI5K4XDk12SSH//w88UmV2LAKduJqT4Ix4YckOHA8gNYbljHUyxHChI1RuhG5DSR9Y0XVRWI4iF+nN1uGm1/kLE6fFABdc7OSyMpllmKT2R+YH/n1EDZUmyftjjw2k57FJ0qG5y91JoAc9Bee1aeXugA== 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 Authentication-Results-Original: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com; Received: from PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) by PA4PR08MB6271.eurprd08.prod.outlook.com (2603:10a6:102:eb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.23; Thu, 7 Jan 2021 11:01:41 +0000 Received: from PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::700f:ddbe:a347:ee4f]) by PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::700f:ddbe:a347:ee4f%6]) with mapi id 15.20.3742.006; Thu, 7 Jan 2021 11:01:41 +0000 To: libc-alpha@sourceware.org Subject: [PATCH 2/3] [RFC] elf: hack up tunables to avoid RELATIVE relocs Date: Thu, 7 Jan 2021 11:01:30 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: DM5PR07CA0030.namprd07.prod.outlook.com (2603:10b6:3:16::16) To PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.51) by DM5PR07CA0030.namprd07.prod.outlook.com (2603:10b6:3:16::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Thu, 7 Jan 2021 11:01:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 18c1fc92-76fe-40ad-0e51-08d8b2fba184 X-MS-TrafficTypeDiagnostic: PA4PR08MB6271:|PR2PR08MB4907: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: MHR8tW9LE3nBvMepEeriUzNsvf2a7Lnidr1a2TTigZ6duAtyYwuFpDPqL68uqL5oBtBgZzIk9UZhUHH8vNv/FJ76LYh0z7qAdVz8EuQanLvGTFBcE71WUdkAYbI1f24wkxEjEtWaIzNcgZK79iktSsskTyE/GpCB0J9TGLxHfea+xQiF5E1CR18byOvc1DO+Ig2TtMmC7DP9/KEsRIpKIbgOMvUPJg9QKsPsi9GZDdM9orIxxa4GmC7NMSdamuXY7T1opPkIaxHxeInZ1f6y5CAWBJbsDxEzykmn1G46ACwAHlG6oQX0M4hAK9LXZHeZU7FpS/uO2h19um/g7a7RyEBzIlEFkbdc4x1T9lmMh2Tt1qNY0OdbkZO9pZGE/Qh1zGqU5S2NRpbV34BFTmfjJqmFuF+HYC6XolilGtf24t1s6OLDy2GJ9C0Bc8JHOW5ft4u6er9G6s/uoj7FuA7GWQ== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PA4PR08MB6320.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(366004)(39860400002)(376002)(396003)(6666004)(2616005)(956004)(26005)(16526019)(66476007)(66946007)(66556008)(6506007)(186003)(8676002)(2906002)(52116002)(6916009)(8936002)(69590400011)(6486002)(478600001)(44832011)(83380400001)(5660300002)(36756003)(6512007)(316002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: +sHCbrAGKbaMRLoSHtYwdaSIiteS0ve+NzkO/J9EzAhtjxj0a2KUl+a8veRjdA+/qDX+XrekLU/CM+d44acXQ2HKQQ/nYC2bxwZ+JPJs9Tbrj0rMRvUI4X+bRvBiLZzjkXLSskdEiOiqK43QzHBOJpeuG/8LrIRipB5aaFZk98b0RJFoq9P2SGI833fI6kBI/cdo84MYl1B0WQiP4umBmwH594w7ljhPqXTjOnlZaZeq7pwU+7dWTsPXk9pQRvxU3+fMvDXuYuaUuxv201REG+6x4b0aOnPV6BvJF0I2uIfmY9tcrPHT5bdqYtMsyGmzoNW/zZjnijb6XJFF053NqUCsZUPqQ9pNNLWrrNfDwDs8Q2nzaZOE/JK8IBF4aYStW/KuDb19x7cbZJ8RDNJcGNObhDTk8vhgWJvlv5Bb6eozPQNzHMxREPyccfjznoXH4HLsX0P0XswMaDFe6flb1dp7SmR02ZvmqqfqUzpSLdzUe9K37mp/Jbs69lMHSB9f3azs0A8F+/Nwn72xy8gg1UyNc5JMgl7MEtTbKPWuvtn5gw4RCN1lt0zTgJwi614FK99ybhgWPPzQdZqmf5mi5mzqx6955efXfOA64sykktrWO4n1tnj+tgUHQQc688uwhwFgFHkEFj/YG2OPosJYBysa8bAeGW8bEJmqYkFHq9/juTsKl3dc3/hnQHAUjU3Z4cwvGOIaIUluNgokplKurecUPQpcpLc7HYF65sfCHZeqsZxXXq9xKTMdSd3RKcBuH1OnWhgdziBzalo+FNWrO7oyPLwopq05nFYfC3QijEDwShwX4jXO+rdMb5JHprfqdv0FiSkuizHW3d6Y+j6687dRO2QRuJSfxObUoOxF+Mf4pDyEKhDYd49x6dhjsPtPnWnk8sG4sNJttBaaPgDNKl9/sCSneNlqJ8Fri7B4I7ek2O66oQOS+auqfaqfLW0emRowoH3Qdt53AkbpmfHVVE34kbpzyOV15rOKFpMcUmJUCoRc4TP000vV6tk4Jjce X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6271 Original-Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT033.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 9e493a80-03ad-4649-b4af-08d8b2fb9d3f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rQDtpykHNyFrnXi8Nz7rJFtYktmjdJanN2HPUVLab9EodctKHu60iQnqLK6zoZ55W431jiRj5+G2uvtVon3C+d4KFgP7Rfgm5/isEUjxGH3mO7E9jwn8GDyuedpYyHG/MIPqmlvcc6m45TJeWviQQA/S32bWtPKvubgFSDqJokx4WgSFMqLFyEJVOKPgPpYzwtcI6h5NWQpLyiUJpfsxOKyhKWueXzNWajgB0Z3xj4Q6RGGQWKvD2f/wrJRO3DB/JN4Pdd0eMoTdfTtCLHHvD5toa1XYqgUmmvTCkOnDZhIO0kO/6F7m2AtHITbOdsoZnvPR/cQ+HB9sBxeABPH3WgTfmNxgOWPeDtH5sso29Kel+gBgU/Jnry8PFkiZVv5XHqo4dGdf06Pryh8dqKo7TrkXulYbKbMGxzRLfza41gqNb6jgV9YsYf+Et9Fw84GoM4h0QB9h6oJXgIRXm5L0o5arKy0MxwAJD/7ZzX3mOITCUYqn3hxiWPbO3CJ1/9XMps/p3NiKzLJhwc0srfzC+w== 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; SFS:(4636009)(39860400002)(346002)(376002)(136003)(396003)(46966006)(70586007)(26005)(6512007)(6666004)(69590400011)(8676002)(478600001)(8936002)(36756003)(47076005)(16526019)(2906002)(83380400001)(186003)(82740400003)(6916009)(70206006)(6486002)(6506007)(82310400003)(316002)(34020700004)(336012)(5660300002)(356005)(44832011)(81166007)(956004)(86362001)(2616005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2021 11:01:48.8677 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 18c1fc92-76fe-40ad-0e51-08d8b2fba184 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-AuthSource: AM5EUR03FT033.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR08MB4907 X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Szabolcs Nagy via Libc-alpha From: Szabolcs Nagy Reply-To: Szabolcs Nagy Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" With static pie linking pointers in the tunables list need RELATIVE relocs since the absolute address is not known at link time. This is a hack to avoid relocs in tunables so the static pie self relocation can be done later. The longest tunable name is currently glibc.elision.skip_trylock_internal_abort and the longest env var alias is MALLOC_MMAP_THRESHOLD_ There are likely ways to have a compact pointer-free tunable list data structure with more gen-tunables.awk changes, but before that i would like to get feedback if this approach for bug 27072 is acceptable. --- elf/dl-tunables.h | 4 ++-- scripts/gen-tunables.awk | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/elf/dl-tunables.h b/elf/dl-tunables.h index 518342a300..0196867676 100644 --- a/elf/dl-tunables.h +++ b/elf/dl-tunables.h @@ -38,7 +38,7 @@ __tunables_init (char **unused __attribute__ ((unused))) /* A tunable. */ struct _tunable { - const char *name; /* Internal name of the tunable. */ + const char name[48]; /* Internal name of the tunable. */ tunable_type_t type; /* Data type of the tunable. */ tunable_val_t val; /* The value. */ bool initialized; /* Flag to indicate that the tunable is @@ -54,7 +54,7 @@ struct _tunable target module if the value is considered unsafe. */ /* Compatibility elements. */ - const char *env_alias; /* The compatibility environment + const char env_alias[32]; /* The compatibility environment variable name. */ }; diff --git a/scripts/gen-tunables.awk b/scripts/gen-tunables.awk index 622199061a..9e7bd24e13 100644 --- a/scripts/gen-tunables.awk +++ b/scripts/gen-tunables.awk @@ -57,7 +57,7 @@ $1 == "}" { maxvals[top_ns,ns,tunable] = max_of[types[top_ns,ns,tunable]] } if (!env_alias[top_ns,ns,tunable]) { - env_alias[top_ns,ns,tunable] = "NULL" + env_alias[top_ns,ns,tunable] = "{0}" } if (!security_level[top_ns,ns,tunable]) { security_level[top_ns,ns,tunable] = "SXID_ERASE" From patchwork Thu Jan 7 11:01:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 41666 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1D0C4396EC6C; Thu, 7 Jan 2021 11:02:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D0C4396EC6C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1610017336; bh=4O5/Z462ld6sHUvdnvdeWAas8EtVOmhZJf2PjNA+Cy0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=U63NIofkAz2bWdm8sVDZcaew84Z2w1Q1/y7wAkxJ44ZPePKsgMRFWK0LWKA86w5cU lpKqrYiipFnjBXBtKY6aT01dpAlf4Kk8WpWOMbU3DzQVrKIcJH9ggaJ4RQn/MwF+Ox 478c04wf+vgG76fAj5WW4rDgNMmYGWZ7i/PZHCLY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60058.outbound.protection.outlook.com [40.107.6.58]) by sourceware.org (Postfix) with ESMTPS id B84EC396EC4C for ; Thu, 7 Jan 2021 11:02:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B84EC396EC4C Received: from DB8PR03CA0021.eurprd03.prod.outlook.com (2603:10a6:10:be::34) by AM5PR0801MB2084.eurprd08.prod.outlook.com (2603:10a6:203:4f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.20; Thu, 7 Jan 2021 11:02:11 +0000 Received: from DB5EUR03FT051.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:be:cafe::2) by DB8PR03CA0021.outlook.office365.com (2603:10a6:10:be::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Thu, 7 Jan 2021 11:02:11 +0000 X-MS-Exchange-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=pass 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 DB5EUR03FT051.mail.protection.outlook.com (10.152.21.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Thu, 7 Jan 2021 11:02:11 +0000 Received: ("Tessian outbound 39646a0fd094:v71"); Thu, 07 Jan 2021 11:02:11 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: dbb824716ae570f0 X-CR-MTA-TID: 64aa7808 Received: from 8cecfecdd3db.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id FD489339-DEDB-4694-A0C0-D8D0EC05440A.1; Thu, 07 Jan 2021 11:02:05 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 8cecfecdd3db.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 07 Jan 2021 11:02:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UHMuv8L0lNZqVv8tBtHFJLm8sqOYsPgM63dCXyCUsBbepDr0sY6c1ZW7nVmlarT/u1ouufkxxWF5D2iDBl0MB+GFOVSkLes3nmKfoT38hFLM3HwxYGXno87oo0Zq+5796k7adRYkl/n3suGmOzIhFqaXIFawYKBlK8XtCoflwL9A3SksQvHzSV62Bw+HF83w89aMdhh2p/Q3znprE+PvXTuw1kjxqzGpb0K0R8ntiilDgrEiRBIsWH7sqqf87dN4eyryY3v6I28+QCNjiwj1Y5E7S9l3QVcs4vFDgI5FAphZNfY/OSxtNRB16T+0nIjblLz79M/SCCfW8Ahg81zSvA== 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=4O5/Z462ld6sHUvdnvdeWAas8EtVOmhZJf2PjNA+Cy0=; b=BH34dPTObOi4wuzDKbCfqZxdtbbKavZA/OwhP96yW+eSsZ5gkIAtbKyaM5FW/qzlUiKdZb1y7uGdSLxed09/sTgc+fr0s7g5L48FVbzFVKz605VcwD53fgVRzrvlZNsrPmRuF6NAdmvLjCNo+ArOz6C7E/I8AOCfYLTgGZq8kh65X0MDTAHeaUv8zKF9CVCSpxuKzwRj+GYYo4nLnyv1rdYzIq3N87cnB+P3DhSFCaY7lBG1q2HVJynLWcAhyhDsGbTvHdt4zYxfl+zzIQtT3ww1uvraQaRftDPR+RY/lP7S7gQ/MDISr8oxTr7Vtafzm6J4gJOMIYOFktr13Zc3+g== 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 Authentication-Results-Original: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com; Received: from PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) by PA4PR08MB6271.eurprd08.prod.outlook.com (2603:10a6:102:eb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.23; Thu, 7 Jan 2021 11:02:05 +0000 Received: from PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::700f:ddbe:a347:ee4f]) by PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::700f:ddbe:a347:ee4f%6]) with mapi id 15.20.3742.006; Thu, 7 Jan 2021 11:02:05 +0000 To: libc-alpha@sourceware.org Subject: [PATCH 3/3] csu: Move static pie self relocation later [BZ #27072] Date: Thu, 7 Jan 2021 11:01:54 +0000 Message-Id: <1bfa01e6e92073b30c02cb76a209656b9d97b675.1610016590.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: SA0PR11CA0098.namprd11.prod.outlook.com (2603:10b6:806:d1::13) To PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.51) by SA0PR11CA0098.namprd11.prod.outlook.com (2603:10b6:806:d1::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Thu, 7 Jan 2021 11:02:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1f5d6487-4eff-4ed7-b6aa-08d8b2fbaebb X-MS-TrafficTypeDiagnostic: PA4PR08MB6271:|AM5PR0801MB2084: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: XWeiTG/TYAu9tiq5d/SZrusUfA1Fqln6Mk2Lxs6T5Qz3CuxMdGf5Uop4yqfA1vQ1fpADeHEZ1pymUbCLN0OSwiXmAWTto0xw/CDMZ4dsWnqvcLmdWEobSekWzIx3/YOqgWRVB0GhrcR9gOC1+3G9FTvSHT6gHplDd+PoHPiiQ8JQqVtc7xT/INyU3Hd8i9hm/m6uCLX9YQLrvPiDCy/gzeUOsf6/uJBcu8m9vNkKCZjjWDuQbDAI2NxCXzBjHDO2lg1WN4TVZnXt5E0YEvlXoKG6w8EXapgVnnL1UgDnB5EVBCLaRWJbFylg6PBgiYY5dpx2L6C3saNDGdI71oqihjjqELq+uJrTYMAP/lIEOu6MZARoGWiH2HMME6YhBHhKfVe0fU1M899jau3yI9bZv7/dHrB4PMzkAHmGsyc3GNU2s92AClJiXUa7lWeQOToPK5yG/kHep9q4w+L+hmFDrg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PA4PR08MB6320.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(366004)(39860400002)(376002)(396003)(6666004)(2616005)(956004)(26005)(16526019)(66476007)(66946007)(66556008)(6506007)(186003)(8676002)(2906002)(52116002)(6916009)(8936002)(69590400011)(6486002)(478600001)(44832011)(83380400001)(5660300002)(36756003)(6512007)(316002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: /RkVKRpMX6Z+EzVpe+7VhtasIzd/ot4rbGgfA2gxU4VtTtltuNLAKfxpFN7fDYBcsqbwW/8JM/4n1cWE0zDIxA6AGsINs6QVMl6eAPckae+C0x6s81diUi1+lUXsKsddHnid7ClCD1P6j4mV/Q6MPVP5drwCC6aBUECjvrPn5jSF8iIig5VJiJEkMliZaLQ+CEVCrlS51jnJ9YUEkAshd3X3M8Ytd++lA9aT0YBpXBxzEFmkh7+KVXzKuvrBvX7BBN3poZKLMOnknD6H7eCh9urKmAVpcZi3P0JHeWjJA/mYcJg3XZoWxHbzAMkcX0P2NbiSnaW5ua1+Rpn3047A36RSvoI9IlUUEapiuNxbPouDNZzKF/AGac/Hf7K008sYBfawBOGhjCWJLc5l8dz2pC8bK+VHdnHiTIvvIc/jOb8NESh6nd037mzoiR7Yu9QSPEHu0wxOLnMPGYdS5AwpHWlrDEZ7v2ADrn4WY68d/+Csnap18rmejSov+GageFMGneCeGh0SdSZHfK5HDPcIBUDbUmYHmMkFcfT4NvLSTnrHWZVlJtDaO4snlbhpj6XAix16P/QfAVbY0Sx1WIR2kn3G/wuM65ASkuIoBulu3c46EkUiibn8Q80J8wg6Xt/Z0AslyzF0NmpeAxRihjhvCJdLPnjJJhtxeJ3tQyLT69s6z07Pnw80xv9qNZi99OxsuqLKx0McXT5sAjQQKeER8R1oNyetd3pbspB0MswoTFdlgNYYNHpcOiliPfpt3zJCSfzBsLX4Hek79xprPLTXcwQIbrMwFVQdNEZifKnf8jATrkA9paM9qgqqiUs1ZgpQnj3w3CHcsZ+rAUfMP17YxQelxieusXO7bN9CJUiMAUGQPdXCrUr8iD4cF/QbePve3Cwlzt8fGKML0+/2ltzkzB8pU6HNfJRKXbiahCohf2MnnaKbC4EHl8weXzGw46nMfbcTpT3MPs5z+aWeVBcgyh0w9JBDkgQNs7lvs1cWyoCun+hXWx17kdxYFKjxLuuq X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6271 Original-Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT051.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 4b555cd0-f296-43d4-444b-08d8b2fbab1a X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bcezjAxC234ZVKwZr8g1xqJ0jg9Oh7Ah2kwFJRoJDhRaA/33TfPhCShDhlByQetQEiHz5lfBG169XMmZ7U+XHLk0oNu6ehHSU7CMqauAFLKWvS/gpOq+8BPbBj/0W+RL4oLt4sd+ecngk97k3Hlvqj9S+YArEw3tnowJ0rNoJJJLL9Ljy2t09DwsCatRyTsoHkQcGlEms4qYcL9tjaIIuw+BqNB6dngkuswrHkAH8je0nLQhIXa1yyS4NgBxQF/eagiWFZkJCQ9Scv8KuLny2iohETFtF1LhPUU9DXONm9J3lWktXQxOpNfTVh/HDVaxW4pSB0bzCSYw5qLn5fpO91EhrhA+v5LVs5eKVGNxIiU+QyZQJA7Ql75qwNGq45lV3Py9zRN1q1/9za0QdSNslnAQ2LvWdmkL9jmv5Elpf/JIGioSEjJ9EIT9w920KZ96Yje1C5pOrKw4uvYqJGE5YJR2DALKzEw7RiDkz/XIOtKZ6+gsULMOR/cawLL0DeeLFptX3O7R1ANegtjBMdrv8g== 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; SFS:(4636009)(376002)(39860400002)(396003)(136003)(346002)(46966006)(69590400011)(6512007)(82740400003)(478600001)(6916009)(8676002)(36756003)(34020700004)(82310400003)(8936002)(2906002)(44832011)(70206006)(316002)(70586007)(26005)(83380400001)(5660300002)(186003)(6506007)(6486002)(2616005)(16526019)(956004)(336012)(6666004)(81166007)(356005)(86362001)(47076005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2021 11:02:11.0928 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f5d6487-4eff-4ed7-b6aa-08d8b2fbaebb 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-AuthSource: DB5EUR03FT051.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB2084 X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Szabolcs Nagy via Libc-alpha From: Szabolcs Nagy Reply-To: Szabolcs Nagy Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" On targets where hidden symbol access does not need RELATIVE relocs, move the static pie self relocation after tunables and cpu features are set up. This allows processing IRELATIVE relocs with correct ifunc dispatch logic. Unfortunately it is hard to guarantee that there will be no dynamic relocations in the early start up code, so this is a bit fragile. Ideally the RELATIVE relocs would be processed as early as possible and IRELATIVE relocs after cpu features are setup, but in glibc it is hard to separate them into two steps. --- csu/libc-start.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/csu/libc-start.c b/csu/libc-start.c index db859c3bed..b8d22bd59e 100644 --- a/csu/libc-start.c +++ b/csu/libc-start.c @@ -142,7 +142,10 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), int result; #ifndef SHARED +# ifndef PI_STATIC_AND_HIDDEN + /* Do static pie self relocation as early as possible. */ _dl_relocate_static_pie (); +# endif char **ev = &argv[argc + 1]; @@ -191,6 +194,13 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), ARCH_INIT_CPU_FEATURES (); +# ifdef PI_STATIC_AND_HIDDEN + /* Do static pie self relocation after cpu features are setup. + Code before this point must avoid relocations, which in practice + means no initialized global pointer or ifunc symbol access. */ + _dl_relocate_static_pie (); +# endif + /* Perform IREL{,A} relocations. */ ARCH_SETUP_IREL ();