From patchwork Fri Jan 8 16:19:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 41680 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 63119398242D; Fri, 8 Jan 2021 16:20:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 63119398242D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1610122815; bh=MrNMtoQ+9Y/rhz+gdEdrPPKAx1z3RSmbi9/VYhOY99s=; 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=iZTQb7Nz0bp8ejOCkO0OY0eC06au6nvILcyWk40OGZ9d/uU7ydX2hB4//CrIuZs8O 4Vlq7aX4EO1RtBCoA7kULft6DWtIOAJm/7RhAqkDBGQtgenMAfNDzAoejVq+xDM55T FMbJRgeD4+AySIbWVHq3XfhoL2uHXt9voBT8tB48= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130072.outbound.protection.outlook.com [40.107.13.72]) by sourceware.org (Postfix) with ESMTPS id 1EE3A3982403 for ; Fri, 8 Jan 2021 16:20:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1EE3A3982403 Received: from AM6P193CA0072.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::49) by VI1PR0801MB2045.eurprd08.prod.outlook.com (2603:10a6:800:89::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.23; Fri, 8 Jan 2021 16:20:05 +0000 Received: from VE1EUR03FT005.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8e:cafe::5c) by AM6P193CA0072.outlook.office365.com (2603:10a6:209:8e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Fri, 8 Jan 2021 16:20:05 +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 VE1EUR03FT005.mail.protection.outlook.com (10.152.18.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Fri, 8 Jan 2021 16:20:04 +0000 Received: ("Tessian outbound af289585f0f4:v71"); Fri, 08 Jan 2021 16:20:04 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: f74799e98621a96d X-CR-MTA-TID: 64aa7808 Received: from 23c84cf0ca7c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A23DE1AC-8EB7-4E31-9D38-A598CDA69CE7.1; Fri, 08 Jan 2021 16:19:58 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 23c84cf0ca7c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 08 Jan 2021 16:19:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IuKOvuaDSStOExUgqGXv3ybRUL3l31FlFGf/H5oER3rx7/22tgdqiwe8Hfvf36nEmVWNHXgMxYt8joQHPBGm08YcgBJ1bEGJJs7k6rqlrNUt3r5M4CWOZBvREe8nh7LRkr+D12bwQe17r+0d7Yk04jTHX9GopztBY2p35DE7RfTOhzOfSjEfPpghqcPGBGrc2MyJ/MEW2yshkJJsgezuxvMW/Ri/z5Qti5C2H4txsLDu68oydkII8fOqav80U1W25aGPhTYvdrtZMs5jXOP1KMXdffWzrxR0vlD5txvldIZ17F4ePPqkrnGjTUih8skwMYqOKasjViQfx6ikw/5i/A== 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=MrNMtoQ+9Y/rhz+gdEdrPPKAx1z3RSmbi9/VYhOY99s=; b=aa5ueRUIU7y2CZhhgQrInrgbABrRC40t/CK7Y+2VibsgwSrCwbDo3bNrY6mHtB8OrSGkRFINR7iOu4JSUlaPbj26P/EER8Qjx17Okgu1zRbeMrkA0jYL+FvCdZECp9FsudnPvY9ozXqZ36XT2Dnz4AfHPspZ+94uT/uablQDu6tvaJYE6rEe8EzY7ITu5D1qjL7X0iTKZxlEA8IYoS0M4YtmJvdVj85rJK3Ux8m6vYz/l+0gd20FIg6tjawswHKBlsHaPoiIBhGXm8jZ3+yvsh8bDNwhwTrdysOotr2s9V6rlVdeaIABz/YNBTFjWSan/lWbWHDgoh+4DvIjtfXLkg== 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 PR3PR08MB5578.eurprd08.prod.outlook.com (2603:10a6:102:83::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Fri, 8 Jan 2021 16:19:58 +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; Fri, 8 Jan 2021 16:19:58 +0000 To: libc-alpha@sourceware.org Subject: [PATCH v2 1/4] configure: Require PI_STATIC_AND_HIDDEN for static pie Date: Fri, 8 Jan 2021 16:19:51 +0000 Message-Id: <0025e4350c3001b6721552aa8d5bc64711d028b9.1610121077.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: LO4P123CA0022.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:151::9) 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 LO4P123CA0022.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:151::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Fri, 8 Jan 2021 16:19:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6f9c2a9e-e3e1-4a29-4cc2-08d8b3f14218 X-MS-TrafficTypeDiagnostic: PR3PR08MB5578:|VI1PR0801MB2045: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273;OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: GPeWg9nNg0uzPXrO05hIYgo/QzjhLb4INpp6p+z5t+N3JXjiEZgpv1KyY62sUKB2lLO9dnSKuat7wYEn7fcR5IfNXY9q4r+SggtXMK7ixBxwv8+h1q6x3fa61yOLFBqjgLDLtgehldt5qtQm6zi0gXM8XbNma8KZ4G99ObyQjC2Cu8u3qiTu1FLb6oPgN/+myDPveRCQ7F3yjlYHkdsUuezaQMMRm7nXeuc1iox+u17SZBCQQDZJSn3B68UQxl4Yc+2nDLN10XNkcxXklVUSzCGMqE0uvg9gcv3V/G5+6QnS3T7gb22Y9nOK9btwz8knjn71ULKk7340gOE03b+Y+KtFPI3dlglDFEDohyW/yvgnwdp8axIJQTuLTtkASZRMjGoiXCFw8c8KnJbj9kJZ0QW9XQdfD5ygrgW12f25zDBttCl1pwjIuO0+dMqA2ATAc0d1AGJRYi+F2+JuKQ8PBw== 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)(376002)(136003)(396003)(39850400004)(366004)(36756003)(8936002)(52116002)(86362001)(69590400011)(16526019)(6506007)(26005)(6916009)(83380400001)(186003)(5660300002)(6512007)(6666004)(66946007)(66476007)(8676002)(316002)(66556008)(6486002)(44832011)(956004)(2616005)(2906002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: uP/9k1egYHGS+DaQ/+JVbqwUXmUTOZEp+nwMv68tJgHRL+NUjFtB84ajug1H1BZuSCSrOJUO7CTX4+bOZ2h1VpCEXhpNULqLfRoJSsOV3Q6HonDeyEHw/RQFEcDGP0SbaWjuugZKqkqLRM9BcjmFp1GcPA4A8YdYPQCJlsUNUz1LHKzjiz3cmiej8PixfJKHfSgITYPl89UHPiNIBhf5B5JxLW3Q3yVf4+TIHG4F0lA7CApq/QLfgI5bqjA1FiBpp87mdYREUk0c6FG0VaIoYZGOpfJStnbmfF8IaK4F/RV8odHmAMPdqllSKUSvI2kUeXiiU/47rrEgVddVVsG2lnF83TmGPTDrxQaCQBjqLIIeHiCCK1kd16fnbMbn+2Xs/FXZjbx2qbIIQdSKWqF7e99G1Bm21IWX9ji8HvhFb69nAP9+FVcH6IFIS6IJEo0W4mlpz3JBBtKXvtRR9uq8iR4fjPeZfB3EQYSG8AoOt5kldfIxpCp8H00WtP34mtBzHmkuGT+zzIVwKBuYkb/PIh7FVXjYwodotK3QhSi6swha/3lw/yu0K1kb8WT4igohQzQZQNXjqh51+dV1LJF26Hkvq6hQ6904NeHOmfhuy7/9tadnKckrB3HI+OS4RaFMFCbDGc7QF7XOD8Hz3LSN/jFknJYMf3TpyruMkBDVVWXYCX5kpJGeZ/ElpKGTMVUyZDSS8D2/wXEoCofzegC7wCSfayLAG7QUZWYFWKT5edbNeC8do8VDlB2AyayEpeZCDjHX2Z3AA3Alqiwr3d5Fa+96x27YmuNK5/tiG1C3hkdVGKS0pZ624Zi+6mhWqONCh1daGP6EVbUWAR7qgJddKIe9Vz0/YnrUjiRcligFY0t0j2oUXAG0AIETL4by6vbt/62VgcoMBebgVD9SReVUyd7OwHwSEId8zAxA13uyy6lnEqdG5bZUKgG5BHXdSLWeMJqVJia1jz3Ul+36Nkst/waGcgjNKrd+ABuyxSUd9jSVl13vyJvLpPZ1DC1J4bns X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5578 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: VE1EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 28456fd8-5621-4197-b9d5-08d8b3f13de7 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fYTDsq4KhvveagmfBbTW4kwI8Jhq1qhuCpDOCwVKcdr0e0YdssA+0aOf6oDHk81I5YLARf6rZuVzNW31QUgk+ErffApCfuHLiFaMAy0fx9LiExLkIRELW4E1eghx9fWQArEjlfsxZoFe4FszJ68lWc1IPN2an/GztbFu+XPGrD7CpmKcHTLjC5KGkIZp1B/BKdimRBsUfqGnzzNtzcrp0Ad7Kqn03p8PJuwj9Xeywqcoq225f7yEDtw6wS2H/kwubDGS2dO+hlvN/3szZhBu41l+g/OaEO7W8HGZKER4xq6v6IIJGY6MrwVBgkGnnOiuGsSAfSGD9fsthEqYIUUf2MNJSUQN8MF0m+gfrNUFyw4PUa8hOYqMcXuuNN+w72Kkj3bt8ZFMHLtvsAIb2yCLn3YUBGNjm54/pBXfRjt7OdHqDyNas9HktwxQVxJ9xRYyND2dA0PvxsbBOP3o6gL3jiSZOzWjyqD0tX0uIPrwX0PWlRpFIbDIyA3dKz7vRPbxe+jwQKQPzKdmbDTmhcB2vw== 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)(39850400004)(396003)(346002)(376002)(136003)(46966006)(82310400003)(16526019)(34020700004)(186003)(83380400001)(70586007)(6916009)(86362001)(6506007)(478600001)(26005)(6512007)(8676002)(6666004)(6486002)(316002)(956004)(356005)(8936002)(81166007)(5660300002)(2906002)(2616005)(70206006)(47076005)(82740400003)(36756003)(336012)(44832011)(69590400011); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2021 16:20:04.9024 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6f9c2a9e-e3e1-4a29-4cc2-08d8b3f14218 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: VE1EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2045 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" The glibc static pie self relocation code relies on that local symbols can be accessed without dynamic relocations in position independent code. --- configure | 14 ++++++++++++++ configure.ac | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/configure b/configure index 6a35553805..e9d88f007c 100755 --- a/configure +++ b/configure @@ -6837,6 +6837,20 @@ if test "$static_pie" = yes; then if test "$libc_cv_no_dynamic_linker" != yes; then as_fn_error $? "linker support for --no-dynamic-linker needed" "$LINENO" 5 fi + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef PI_STATIC_AND_HIDDEN +# error static pie depends on PI_STATIC_AND_HIDDEN +#endif +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + as_fn_error $? "the target does not support static pie" "$LINENO" 5 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # Default to PIE. libc_cv_pie_default=yes $as_echo "#define ENABLE_STATIC_PIE 1" >>confdefs.h diff --git a/configure.ac b/configure.ac index 43cfac9d48..aead4c44d7 100644 --- a/configure.ac +++ b/configure.ac @@ -1846,6 +1846,11 @@ if test "$static_pie" = yes; then if test "$libc_cv_no_dynamic_linker" != yes; then AC_MSG_ERROR([linker support for --no-dynamic-linker needed]) fi + + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef PI_STATIC_AND_HIDDEN +# error static pie depends on PI_STATIC_AND_HIDDEN +#endif]])], , AC_MSG_ERROR([the target does not support static pie])) + # Default to PIE. libc_cv_pie_default=yes AC_DEFINE(ENABLE_STATIC_PIE) From patchwork Fri Jan 8 16:20:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 41681 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 E8C323982431; Fri, 8 Jan 2021 16:20:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E8C323982431 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1610122826; 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=OlglIB2mZ80YjgSyF5DuiCArficrZf5CMu/CIIaejDI/04ygHY7zEc7f/YVucmUEm FlmdEYk+usQHgjjkA0BWV6it5a7Ou6v8X/ZAIBcvF2MmSHFzqrew2MMqA9lpGtq5/Y hin4GoY/ZxIAHJPjXD0S/UULDRFSgH7IZReIIsLQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30084.outbound.protection.outlook.com [40.107.3.84]) by sourceware.org (Postfix) with ESMTPS id 483E03982423 for ; Fri, 8 Jan 2021 16:20:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 483E03982423 Received: from AM6P192CA0061.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:82::38) by AM0PR08MB4275.eurprd08.prod.outlook.com (2603:10a6:208:140::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Fri, 8 Jan 2021 16:20:21 +0000 Received: from AM5EUR03FT062.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:82:cafe::d4) by AM6P192CA0061.outlook.office365.com (2603:10a6:209:82::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Fri, 8 Jan 2021 16:20:21 +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 AM5EUR03FT062.mail.protection.outlook.com (10.152.17.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Fri, 8 Jan 2021 16:20:21 +0000 Received: ("Tessian outbound f362b81824dc:v71"); Fri, 08 Jan 2021 16:20:20 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e739c6d036d51b71 X-CR-MTA-TID: 64aa7808 Received: from 3d12edb79078.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id C3A9A3E0-11DE-40CC-A254-3CF61BCF87B6.1; Fri, 08 Jan 2021 16:20:15 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3d12edb79078.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 08 Jan 2021 16:20:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QOVsnLyNlUcfCPbvd5Q3UkHGwt3OMPNyBxeC3JRoWdHNr2Nq0ejKOVW8DSkmusu/y7j14SBeZQ9u+BNv/U/70EFqNMNu9DGd0txNbvzExZxlF5P4QLKAczMoHNbkl4+p5qPapABWzf+X/6As0xuOiQyUiJS+sW3flzo9jCc3X9I5mCdnvkABlkovqg/ATj/UiY/ErhNIJ819E9C4hUQcR3rwV/yZZkiIjb9VnFHj+VeoJQXcErxcwkWw6jFfENH/rwNxXTRI7qf51WlLFJlDBPdzSsNfQ/+zf8W7YbYtTuwMsP8rApM+ZpTfMtEM5OBmMkcquGct0oEvTF/UDmwqAw== 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=arPZCPe4MgV6RpLK+JwEnHduIzu3xKtWIgcAMXguNVbnXQmaL4apGTfJe9R6FbM6wtMhpKHnwmn6cBqYdVbn34iygANf26L8WFvJF2bI3aXedV1TnKGwCfot95UQ/xIUl+k4eS5ZrelQA3tHnRrhBul61MNk1rHrqHW+dvswq4M8dPPGVBKzBzeI4chvbsd+2tpWgPtyYoWWS3UXUpvQY+1RXoaOw3d89gpIrX2P8ycPQC2rQEWsLq2Z3mT1ad/QEF5UG+wnOwJxbbYVdnj/g+9BB2DFkxawFrLsTJ+UAm+zthrM9ekdUou3kheuX5mdoa9h9It4OUfqa7F6mIMghQ== 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 PR3PR08MB5578.eurprd08.prod.outlook.com (2603:10a6:102:83::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Fri, 8 Jan 2021 16:20:14 +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; Fri, 8 Jan 2021 16:20:14 +0000 To: libc-alpha@sourceware.org Subject: [PATCH v2 2/4] Make libc symbols hidden in static PIE Date: Fri, 8 Jan 2021 16:20:08 +0000 Message-Id: <56297d0f9c00bd27901dc41ef20d749cf564def7.1610121077.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: LO2P265CA0062.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::26) 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 LO2P265CA0062.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Fri, 8 Jan 2021 16:20:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7bdcfb20-ffa3-4764-8339-08d8b3f14bd0 X-MS-TrafficTypeDiagnostic: PR3PR08MB5578:|AM0PR08MB4275: 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: RW0b24DTu6f2e0ZrPYfRuVIHb31ZSoMqsxZW0rcsCXGo60XqC4+A/vXYI/DUODUWSRNtzIJ2oiPyPIWiRSstAfRiQUjBHAwyocQJr6zp2gW8qrzl/VkBbgGcrp4TYxksdj1SVOZTZip9RO4rzxkwM6eQADwglHTPCupDHpZOGT8OiG1RIHxFzzeq4ouM+vPfOYVJwhD3Bju0QyDqcy+gGnpnIZ5WvWZH6xYSQinTf9MXyVf2BGlYzhsmIy9JdzaLwigiwdTulVUjq/qsmigjOLa3eYzZXOT+/OpK1a0DiMHx53iDtWP0u6qVTrp6+DQeORlmydSm9YrOq4GhaNzl6IckFHLn7oaLQHHtVeCmn+AKSUPZtxVe/TzeBISAvGo/UvdU7OXbF4cBdMwHKjvx7TNIMdlh+FjQcOAw4pG14pPHEoT/9M7gg7Iu2a2ZnqHIX0nQJc6bU6VQ64s+TcO/BQ== 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)(376002)(136003)(396003)(39850400004)(366004)(36756003)(8936002)(52116002)(86362001)(69590400011)(16526019)(6506007)(26005)(6916009)(83380400001)(186003)(5660300002)(6512007)(6666004)(66946007)(66476007)(8676002)(316002)(66556008)(6486002)(44832011)(956004)(2616005)(2906002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Z7MHBq6vEwYDtuYzw9xHF3vN+dNXmJ7ERuwTKBGdNkpRWb+F0wiRjDRXC31Ac5tETD+QJgjG5PvrWEDZAOyYRJ5L7hVo9kubCNlZkrbQQbFio0sU0Rd6a3cAsdvrTZWzNZ0Jwi2kk5i05r4HmcFFKXdWPzdEMWEtrRORBL14CuHuegm4DG3akMvcVjugfPFksygMW/OuoYG6vms7TaNDuNKPLI6nR6tpG9eJNk/bCYOdYWD0C/DBmfa5I4PemMjHSwB7vgfoq8K0O9BeF70x+S0YSeBB4NXh3q+FZaSE7W4ImEHTRPxeTIeCi9+hfUdhbL6csm9i+pj8j9d7LeNE7NFrVBs4MlssKVEqz/JkPywIafXOY7LxGxP5P2yLBMg21XRgAzsqbP3wn3UVR9RXgITFEcVGoUgWmsvDYE6O34E0xhdpXmq4+dlLrlQ5uUIQnAV2eQzu6HxYW7sulvyOTcTQrGZEO7qF3H2BupnwTPzxz97Y5myS6iDzwdqRotr/G9jHF7+bDRra1ETt1CoILpfy/u7kWFZEmDadH97TtwMaFGF9i596CuYCP8yVhWqhzUcvC27SmhuCLVxdgpbJmtoTgoSFMZKHNlx9neSwjPTNw7eXjW3+fbCgA3EG5HevgDxExAdvirAVi68IMzNEDSIzs/UHFBz/czzrWRAgGL3op68EBt4a4yg6MBt+gPF/YPrragL0662kQsxQ0IHGwkvx7V1Jh9vFgxCT3GF6ZY45jkR+umFrZsleCi1/fZvfKQ3mePbCdCab82X4sMIePtg+vaH0g9wPOerL44OAf3ZEnF9WMdLuCYsuoBStNgSp3t2po0lN1IQmcX8rgGPi1HGptTVbi8g5D1pqYTIFrVDFi19zXyRQies6y56CcllEtTaUg+iB4N1MQ+yseLoSKpJlrqKlv+p4Qd3dtG7iIg1dJjdhynggVv9qV2bLOZw+DsWXYe/MJ3Nkgt+yUdFgFRqqcsDi9BzMiMWqxQRjQNuWVVVxiIuAakHIyY7UlWpZ X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5578 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: AM5EUR03FT062.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: a3a311fa-5456-48e8-f0c8-08d8b3f147e8 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YkHtyKXtcmxVuAsf5HD5Dhv0wf/T/pb2dNZkwaZStFRcdO/A/YaqYdO9BLCBw2j8QcwqQFLvQfGmkvAwtiQvtYUi3sljxNQ/7grWSe+qDrqNu1gEyOOufv83QxpWE5tDKf1PwTAin0Lh9AvoCEXTplReku8wHY8Ch+2nKhxH0bH0MW92zRtkqrq3NQV8GKD0F7YW87wU1+r3HmwBjh3KTGYlXaoT28JkC7hyKfWLShIhkGRd+BgZI5ewOX9U13qzaAjd37kPYmuEYQAixW6PvuA/AeMvwC1q5AQr88llX/zKg4aMSkMcWfAMTfnAONeDV4vJyTEy5PGQimJXGx3PzgOKnYuf1lZkkfTDsaTD2dmoBMCHkfbCP2NX3hw1AIE8a1etY2zBo4G6PE8Ha8TGv5wZEkDtJZVuwkENZT/GnDNgqF7KC139R/sH5zQNl3sREOCEujZzXL7g8mxUI9s7G9lh7gEucD15G8qvLJDF+Ri5fdfIC6M0NduWGQICoCCYQIciPRuiEi1N63niXcP8Kw== 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)(39850400004)(396003)(346002)(136003)(376002)(46966006)(34020700004)(6666004)(70586007)(6916009)(8936002)(47076005)(356005)(70206006)(6512007)(82310400003)(6506007)(336012)(6486002)(69590400011)(2906002)(478600001)(956004)(36756003)(8676002)(82740400003)(2616005)(86362001)(5660300002)(81166007)(26005)(16526019)(44832011)(316002)(83380400001)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2021 16:20:21.2811 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7bdcfb20-ffa3-4764-8339-08d8b3f14bd0 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: AM5EUR03FT062.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4275 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" 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 Fri Jan 8 16:20:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 41682 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 E45B83982423; Fri, 8 Jan 2021 16:20:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E45B83982423 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1610122843; bh=PL8drRQcuMwzeTxnFgV4hwfYDIKyYtPniGJFhG4I1g4=; 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=uHEL/mDqYKr5e5mZPrmm8V8GtTjq8+FyZfgVeavBsiWgCrLAd6XdFOoebZfd7s0lt U6C1FUwz/UZmH2Ow7F+5TqzIWcIQRX+Kci1CvgFDbAeWlrY8FUqeiT0DxoIZqop5b1 hCeAUGY3X6P5LryRkGQ8aeNv9g1PLFPauu9QV5nw= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04hn0240.outbound.protection.outlook.com [52.100.17.240]) by sourceware.org (Postfix) with ESMTPS id 7A8123982423 for ; Fri, 8 Jan 2021 16:20:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7A8123982423 Received: from AM6PR10CA0099.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::40) by PR3PR08MB5850.eurprd08.prod.outlook.com (2603:10a6:102:92::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Fri, 8 Jan 2021 16:20:39 +0000 Received: from AM5EUR03FT034.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8c:cafe::bb) by AM6PR10CA0099.outlook.office365.com (2603:10a6:209:8c::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Fri, 8 Jan 2021 16:20:38 +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 AM5EUR03FT034.mail.protection.outlook.com (10.152.16.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Fri, 8 Jan 2021 16:20:38 +0000 Received: ("Tessian outbound 8418c949a3fa:v71"); Fri, 08 Jan 2021 16:20:37 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: caca8df2c82cb125 X-CR-MTA-TID: 64aa7808 Received: from 13142a515bea.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0765D699-BB0B-4DAF-A7D1-E173E7408E68.1; Fri, 08 Jan 2021 16:20:32 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 13142a515bea.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 08 Jan 2021 16:20:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C3EOoofy8BwytpFFR0RscA8lU4QAUD++1Tmbv67vZZ6Z6juYqj8ZjG6M2iUydf3SDjpTEYXJO2NE7cQKPYAv0oCTJhXju94mkVwa1lQWEwnDRnRNjWHx/FOlIyH/alJttbamlIONtUhBcJtD4Y6lL3qfe1AX/mmQjDXV1vuF4lgJEK9wJO5d7yh8oGS2D6vrDoeLMfEZSeVYze/In1/I9LQhH5MOWidenXtlsryAD30Q2hPfll0dpXxzBOn2rGD+HHzWWsnvMrRTIN/woqxvZnO2utd09CFilkCa4FRlq5Nk7JMrF++92dWFDOj/cWMt253Nf1dD0s8IAWP1kH02ag== 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=PL8drRQcuMwzeTxnFgV4hwfYDIKyYtPniGJFhG4I1g4=; b=LnSwhOq2t1Cu2f3a4aQo3BcTsiHXPvdg9//U2xQMH0UpQY2v/zei6Dnrf4Mmv4G98diE1zMwd23XPkmRRhO96IHazQxFo9TS5E7oiAewo7K1joMjuOooc+/mJGmtXJiY/CVxxrVa4QknDeG0q951jL6anJt+j4HUR+553jKZxWqmZIsFuxTqqpdJ4Z7GxUTk4DFXTe+1UkD39SGn3l3KbO71V5UZpJioW4fvB66nsvFIVoLH93Q2LyJRjz4CQhE68K6IDePvdxu9p5rzrP4omhSRhxyM00OSbWVkqlJIP9OnZzEqAoL0uDmqmioOnZ1UQAkKNUuMZl514IvCGL609w== 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 PR3PR08MB5578.eurprd08.prod.outlook.com (2603:10a6:102:83::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Fri, 8 Jan 2021 16:20:31 +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; Fri, 8 Jan 2021 16:20:31 +0000 To: libc-alpha@sourceware.org Subject: [PATCH v2 3/4] elf: Avoid RELATIVE relocs in __tunables_init Date: Fri, 8 Jan 2021 16:20:25 +0000 Message-Id: <69ef59c70daa586fdda61fd818506c1f9fab06d0.1610121077.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: LO2P123CA0013.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:a6::25) 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 LO2P123CA0013.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:a6::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; Fri, 8 Jan 2021 16:20:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3b3778b3-9a86-44b7-8787-08d8b3f15614 X-MS-TrafficTypeDiagnostic: PR3PR08MB5578:|PR3PR08MB5850: 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: YEfuT2Vmjf0orzu0LZzhApF9L5ZaviyUFvnhVShXBt4ssevHQCncMDGw7d9363uHMl6qQW1KZ+d4zWO9UDvLS6Cm+EYOErHWMyHTxm5Pk2sLIeIMwjZcDyhGo/BLFhrMWwYDYrHHdXEAZRLd7eWJjv7xZy4rLI65bTNcHzEhNl+ma+se2s4xHDBy4BodAVKJOVbGpMmLI6G2u4XPrn0XmyVBnrY+1/V7Wgr6YR7iK3anJ+Md/4j+5Pq1EYdtEBUL4zSu9O+gC3/hs115bHFjzNiNOsOeaMSJExTHlM8gZr2NpKlMrD0KRy/DCfvdmOHcwBq/KNhE9BGg+KSbeLDwrfKCjdvY6QnzUKK2a9nqMdIvqLcBu048aNeemxmGYnjvOQ+4Dq72eqmwSoUTKIF5IxS1dYkgH+ZFywwDKbA8hz+c+2KNSMOviSqOkM1Kk5QAkuj7wh664bbnP7jhAowHJg== 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)(376002)(136003)(396003)(39850400004)(366004)(36756003)(8936002)(52116002)(86362001)(69590400011)(16526019)(6506007)(26005)(6916009)(83380400001)(186003)(5660300002)(6512007)(6666004)(66946007)(66476007)(8676002)(316002)(66556008)(6486002)(44832011)(956004)(2616005)(2906002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: UaWHlwOoQpDcvxkcUSedtDtr+s+fSjiBgAWpKxc9PEBcU3QQER92bgytn1pOqB7r8A+Tgd4+KAJFBGquM2DNujptNqvIoAb0wTOhk2E/SwckCrMOIzVP3F2LeDBpC/KSjGMJ0CuVCIEgVD0hzfKg3vZNx8NDCTtc15ahqt+Tb/kkM/DkeFKtb7fnUAuaZHCJwsWtVnpdqvZOSUBAYsJXqKhdnID2ugwk72Yta1cSAhN03TqbsNIrJ0wJbbKITvGkHpG6DiIbBBDIYDZOTcvHKZubflYKmCC8Q8nmE0qUxSBC7DXsPUglze/dCnNGDyoSpgtQR+E8xEz0BtjR1/BqR/ByGrSiR5sAqwPvcnF3f0kv4dFlzLFGbEwAUNDLTpc6NEwwhSROcVCmd9JgJvLzFGGTsH7PhLuiX/tgyE3itTYjtD+GiuN02PdMjWiW8zTOm0z3L+prZP2LiFbtLevUxAwvdhk3AjkCeB5cWJ5x80eao1HNGRRA6H4t0EkITG0J1rqIoeLxS4MwSmKWeixRaj3HfhC9W6lhapxkIM910rgSQ0dedK9u2cZPEnv9QWXGEjh1ztkhMNV2VJGhBYsds9k3kRJpX5ON6z5fwMGmJpLRLX1Lx5peapk5I/IS+cGVYgtctRSKxq7mW9vlZYcpnj3ucohnjiBhTjvv92VbgqefSQmJbUuoF/Jl2DLBYV61cRvC34NRFgtC7buStuvOZQkx7Z2LjKbNTiLWWDVL0YaVSzVgsl6y2d9MEFoFjvtP3fwMiCrDaB79/zxkc5/ub68xRIX1GqZt+n54PQVuaS3ftQagk1aJRcBkhTzMZSicsLDeT8e+OqTW6stgom/y0yswohJg707bNhgyh4/fBzbfQ0I43qfMCSqY4cCp38aV9R2lDYa9ZEgVZ2U25PqKjIUOMdtWzllEmJKAekrpOEmrDF/JyUU81OUe0222Aru5vxkmkADDia4OW6i3SJbRXmIK16q5RV5eNmd/h5WASIcwB6GjYRj6gGyXN1W3Vzm9 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5578 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: AM5EUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: ceb145ad-0069-408d-ca95-08d8b3f15200 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yMLg/o82GE7FfY4JDRr36IVWfoNEhfFFnZMhy0KLyDFW4/2rssGPyc2SmDOxNGAqi1yRz8s00ZQi3hUzSXUIGRVRFtpfVOrNqCUdL/B4icq0qmyGgelLTph9wFDNkdjkkLcoW/QBptDuRIjtsuF+yXzbuhFoArpkbWy8GIrb5aZijtLGeCmGVP6wJPZ0s9vg8G4tR3k/qJesHJCzjKwzRj8XRYMPJg2Mge9M44ZW2paSwDukiq6B0VT/IIPlUJByQmXop3oP8seIQwh1HJbawdZckMAU85i01wVD/hnqqdhVw14c0MeYIqRkfoevhZduglkEJyNN+f1idwqNYpB27CqSZkLO5tTlE/JTNSWSDn5soTgw2a/AqLOMSNZMjBbGVKPFng96ESNeaUg78w3R+BM81RA+21B+OzQBFxb1kvvDApvY7pb4jOMalNJFbDhGGz4aqd9KZlSB6aJMKs2eQDH83CYph4RabLLGPY9wqVyF05g9xBcclHB8mRFnk4iy3xjkXYXgc9X3HBdAxbWuNA== 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)(396003)(39850400004)(346002)(136003)(46966006)(8936002)(69590400011)(86362001)(316002)(336012)(8676002)(478600001)(70206006)(36756003)(83380400001)(186003)(16526019)(70586007)(2616005)(26005)(47076005)(44832011)(6506007)(82740400003)(6916009)(2906002)(34010700040)(81166007)(5660300002)(356005)(956004)(6666004)(6512007)(6486002)(34020700004)(82310400003); DIR:OUT; SFP:1501; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2021 16:20:38.5081 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3b3778b3-9a86-44b7-8787-08d8b3f15614 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: AM5EUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5850 X-Spam-Status: No, score=-13.8 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" With static pie linking pointers in the tunables list need RELATIVE relocs since the absolute address is not known at link time. We want to avoid relocations so the static pie self relocation can be done after tunables are initialized. This is a quick fix that increases the tunable list size a bit. --- elf/dl-tunables.c | 2 +- elf/dl-tunables.h | 4 ++-- scripts/gen-tunables.awk | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c index 9b4d737fb8..3845b2c04e 100644 --- a/elf/dl-tunables.c +++ b/elf/dl-tunables.c @@ -350,7 +350,7 @@ __tunables_init (char **envp) /* Skip over tunables that have either been set already or should be skipped. */ - if (cur->initialized || cur->env_alias == NULL) + if (cur->initialized || cur->env_alias[0] == '\0') continue; const char *name = cur->env_alias; diff --git a/elf/dl-tunables.h b/elf/dl-tunables.h index 518342a300..05997d028a 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[64]; /* 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[24]; /* 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 Fri Jan 8 16:20:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 41683 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 7F5403982434; Fri, 8 Jan 2021 16:21:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F5403982434 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1610122860; bh=Jwsr8wRZM3yHsHwZETSkkb4I8uvWlJ9bp9FCPl8TVvA=; 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=B7A/cftDC9uyGBXJL7aNPEyMpB573PPViWdm/92+kYi4ezV/miIEdDmXOvfCWyO8b SrOpcDTdUqITl1r0izp2ucD1d+Sb0cfGjwRFHJxSnwxsme9bosZ/pRdqFa4cPDc055 VDh5Rkb3GdbbWjiKSCqP6my54wZf0EKbxifNLh5s= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140073.outbound.protection.outlook.com [40.107.14.73]) by sourceware.org (Postfix) with ESMTPS id 2F0763982430 for ; Fri, 8 Jan 2021 16:20:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2F0763982430 Received: from DB9PR05CA0021.eurprd05.prod.outlook.com (2603:10a6:10:1da::26) by AM0PR08MB4434.eurprd08.prod.outlook.com (2603:10a6:208:143::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Fri, 8 Jan 2021 16:20:55 +0000 Received: from DB5EUR03FT049.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:1da:cafe::ba) by DB9PR05CA0021.outlook.office365.com (2603:10a6:10:1da::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Fri, 8 Jan 2021 16:20:55 +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 DB5EUR03FT049.mail.protection.outlook.com (10.152.20.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Fri, 8 Jan 2021 16:20:55 +0000 Received: ("Tessian outbound 587c3d093005:v71"); Fri, 08 Jan 2021 16:20:55 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ffd42821b0ba5526 X-CR-MTA-TID: 64aa7808 Received: from 1dbaa99d84b5.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 19073FB2-0A37-4835-BB34-2BB8E9615725.1; Fri, 08 Jan 2021 16:20:49 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1dbaa99d84b5.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 08 Jan 2021 16:20:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NdWmYEZPKnqXlibD7JH8mtMPFnjx7M88w1OCz0NAgyevJeCRnIhdI/8OmqHDJUMbMpWK6YG3xUugGCVrS2nleagW2ibeeHgUziCQjeCUfClBeuxSKLbGwJq9ku+eM4GSverTc0UxsBhZs06rcq5AYQ1J14DLUubCq4XVKOUZ9nMkZQ6WjeCynpgtMR5kSLEXgXdwXQ32wOAqQbdVcem3nt1fnj4Bml1bLxp7Y1lDZPpjzPxuGWrvIpPLksuJ0xJNR+778//HTjvdCNeFiU+3Vc9L86ETM0lMNepmdfYnI3jDUD+KmtQbJ0O7NqWmQYPSvV0wXPEaU5OIwQO08xOzqA== 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=Jwsr8wRZM3yHsHwZETSkkb4I8uvWlJ9bp9FCPl8TVvA=; b=fwPK3ut30AjrfkY+qjtwqLGKw1rB/5Y52c//gWf0336GLx9C1/qHgRTKpjLzxJnLydF4BSFrxLFFXLpP6g6Fv4H0RQRZ20PS2VQN+fIUttV5HpZbE6NEdPsEJcWRuY0u7R0bq4hFtiN9QLQC/4Ki0V/Tnff2150q+64MczSdPFdNVts6PBrcSMcdUSJw+y51rfoypl1Xt0jXIeyUA0voG2lecOwPLmJkWDQFRHR0sZj4Tss01uH7Qs02Veybvly8mqf8MERDUJw3lLUeXUqJhEZXZoG/tKxAquVHEh1kJl+g/u14kBjfqH6/MkXzGveaThQ6867LYoDf/s7Ahkw0/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 PR3PR08MB5578.eurprd08.prod.outlook.com (2603:10a6:102:83::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Fri, 8 Jan 2021 16:20:48 +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; Fri, 8 Jan 2021 16:20:48 +0000 To: libc-alpha@sourceware.org Subject: [PATCH v2 4/4] csu: Move static pie self relocation later [BZ #27072] Date: Fri, 8 Jan 2021 16:20:42 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: LO4P123CA0006.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:150::11) 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 LO4P123CA0006.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:150::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Fri, 8 Jan 2021 16:20:48 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3f3e1801-d9ce-4629-8f4e-08d8b3f15ffc X-MS-TrafficTypeDiagnostic: PR3PR08MB5578:|AM0PR08MB4434: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: mv36xWAT9K6Xhi4VXK6XMTkrCH3e1NCaum05ytDupQL0ThmE9jmDr2aANCPxoNNkqLWpCZ+LhvnR4B+H9EWzj878fRo4c7g1MOrImQ6VN8kOZrKtV5PwcnQyCxk4d8a8Tqy6ZCso1eJ8x57ACx7VddJgnwCjcQ0XtoG5f4ov6XSymMgAmZ1G9qwaLFutOwoXBCL46kHDzvIXx75PYd8b3x9VvQLwgVH86OloyVv5BcLYROqBIVydJ5VoqD+jYC+F4gNzxicJZvJt1B3kBn7Mkor2uDmMIpRbYe01/IOPhS4mOC3SMzICOf6HRUq4gVwV912yp938u900pCpwDrn19UHPo+6Qtjq16o20qXbJ23VL0WoYunT1tZM1BGtPpjCHHHl927HTwuiSQQ4YBUaYUZaWUH2gGpw0D+f8VCljtrY1EIAoveN+sDmc8bUHy93tLQTvCwj2DTvyD4QtIj9z+A== 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)(376002)(136003)(396003)(39850400004)(366004)(36756003)(8936002)(52116002)(86362001)(69590400011)(16526019)(6506007)(26005)(6916009)(83380400001)(186003)(5660300002)(6512007)(6666004)(66946007)(66476007)(8676002)(316002)(66556008)(6486002)(44832011)(956004)(2616005)(2906002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: wTBxtUH0PZJBpq0TW4j8mULxOFoQo99GZbZIY/biCApMMxHXKupxA/+87RJBMzvEjUUMLs/MYXPbmJtPCFWXZCez0AHLitI7vxeOVdH82hYp/wwBWKVXB3uU4fZJaqyJE8BfXrtJm3/F81AoWo4hA2ctnACtyT8+5ZHAEuqKl2ToVW5TT5INtwGYq55KiCano8FbVbSvm/pwMXrOEepU2vNuGTVT4NyCIZstXN90X6h2OOxnyEQLRzEqScgToCjTTFoz24kgweC7dZR/JyhRWROGOYkWzX237FTZCE1SD74HJGz7ao9553+Bmybb5cDd/5HP8AYYlfJffSMHTdE66L1kDJA0rbbaoHA4+ykCqloioVZNgDZVQsyW05DvaLXCGPvBNaJ+SnXrWZZbszTcMqm9XDWHszyTIIhNUwtP68bx63gG4Xl7WavQuo58Xyt8Kdv8BxUJgzPrHnqZvVVTOr0fszbuka1monOn/jJu0ImB4hNoOT1sGuz/yNpmPygbIm4BQKV5oTfaJfdTILgqrSY3W1vbgcWZxA4QcifHe31CMwHYDOVSz+dZujXX/FWsUAk4x+RGbCjDLZaBXiB/0Z7XRfn8ST56P8eEynmnQ7Yl8mVd/4A+2DdJne6uszKTzATbDe5HVjAl1VR6weufVurMal+4zFZoJDXJnio6K2AhVQiX4wMHmnRxw+l6Kpz2BJTtFr78ZH/X++x9EzNKiuEqV9AL9sGHhEWM0Dbwi0uOsC9ifBieFxBtae7YeURosINoO/eDabhWJBOgbdfmjXePbHb2Y3PmwX059Y28EOpn0x12qBwEHkNCm7vq1RyeHBMPIZ4khhwO4UGsvWJEJ093y4szN/cqNkyNWyvhZ5sKk/NQI5Ql5sl5Rv3q6TJoB63JMRZAQwK41zhLeFOKMoUKUNp7VtJ/HQqozeXIGJ5UTWtQCzvbmyz8E7qAjLiPJynlobEHBdjZOMQ3c2M+lT0iEs3jc6Y8O2+QTqRu83gGwWywntmhcybxNA7wpQue X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5578 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: DB5EUR03FT049.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 5bc917d4-8d43-4264-fb19-08d8b3f15c03 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3PfLbF0zuv+bkH4If1c/oZ2VXRdrbXuDDxaE2ZrHVE9H7gzCG2gX++2WmaDajTRB+3gBvamR4lZP5UKqgLm2svUU3GX48DSiOwIfYaq3fJxKMTywWMyAW8/yjXTTG+LLIFtF8ysZRS+43/Yiv8+UChS12RpfmRlvlVjJNQ8Z7wXj/pyToPJ4JTRWv7c4NS258WPdRkwWEZSJBsXwRHtq3tkMfQ8sSE/IvxoX7NB6FHqbqmiExq2zMEzCaZnFILYfksQvi89DX/iGH1uwM3qZnQapVtE1w3lrDq7NRycPl7FBWBRyfG3eaNZcEZ4aZCrRl6fHI03Y/urC5yzrq5hbCuFjP3b7ZqO39mgxA24a3MgXzwvHr0XbSL9eadi8ECql7S4ZsNDU3prpwTFwY/hVryRIv7FAAnulKLLQUunotRMdI/4PXLxTE5b/ZI2DEnFHAghqfLgtS3ECWycDKVWAgDqgywU8do/PcvLte/aPQ+YTVSgTUrcub5f87odZwqStMe/PNGbHk8t1FXFb7YNFCw== 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)(136003)(39850400004)(346002)(376002)(396003)(46966006)(956004)(2616005)(34020700004)(6512007)(44832011)(6506007)(82740400003)(6916009)(82310400003)(70586007)(186003)(6486002)(36756003)(316002)(16526019)(70206006)(86362001)(2906002)(26005)(6666004)(336012)(5660300002)(8676002)(8936002)(478600001)(47076005)(83380400001)(69590400011)(81166007)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2021 16:20:55.1742 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3f3e1801-d9ce-4629-8f4e-08d8b3f15ffc 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: DB5EUR03FT049.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4434 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" IFUNC resolvers may depend on tunables and cpu feature setup so move static pie self relocation after those. It is hard to guarantee that the ealy startup code does not rely on relocations so this is a bit fragile. It would be more robust to handle RELATIVE relocs early and only IRELATIVE relocs later, but the current relocation processing code cannot do that. The early startup code before relocation processing includes _dl_aux_init (auxvec); __libc_init_secure (); __tunables_init (__environ); ARCH_INIT_CPU_FEATURES (); These are simple enough that RELATIVE relocs can be avoided. __ehdr_start may require RELATIVE relocation so it was moved later, fortunately ehdr and phdr are not used in the early code. --- csu/libc-start.c | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/csu/libc-start.c b/csu/libc-start.c index db859c3bed..fb64cdb2c9 100644 --- a/csu/libc-start.c +++ b/csu/libc-start.c @@ -142,8 +142,6 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), int result; #ifndef SHARED - _dl_relocate_static_pie (); - char **ev = &argv[argc + 1]; __environ = ev; @@ -165,24 +163,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), } # endif _dl_aux_init (auxvec); - if (GL(dl_phdr) == NULL) # endif - { - /* Starting from binutils-2.23, the linker will define the - magic symbol __ehdr_start to point to our own ELF header - if it is visible in a segment that also includes the phdrs. - So we can set up _dl_phdr and _dl_phnum even without any - information from auxv. */ - - extern const ElfW(Ehdr) __ehdr_start - __attribute__ ((weak, visibility ("hidden"))); - if (&__ehdr_start != NULL) - { - assert (__ehdr_start.e_phentsize == sizeof *GL(dl_phdr)); - GL(dl_phdr) = (const void *) &__ehdr_start + __ehdr_start.e_phoff; - GL(dl_phnum) = __ehdr_start.e_phnum; - } - } /* Initialize very early so that tunables can use it. */ __libc_init_secure (); @@ -191,6 +172,11 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), ARCH_INIT_CPU_FEATURES (); + /* Do static pie self relocation after tunables and cpu features + are setup for ifunc resolvers. Before this point relocations + must be avoided. */ + _dl_relocate_static_pie (); + /* Perform IREL{,A} relocations. */ ARCH_SETUP_IREL (); @@ -202,6 +188,26 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), hwcap and platform fields available in the TCB. */ ARCH_APPLY_IREL (); +# ifdef HAVE_AUX_VECTOR + if (GL(dl_phdr) == NULL) +# endif + { + /* Starting from binutils-2.23, the linker will define the + magic symbol __ehdr_start to point to our own ELF header + if it is visible in a segment that also includes the phdrs. + So we can set up _dl_phdr and _dl_phnum even without any + information from auxv. */ + + extern const ElfW(Ehdr) __ehdr_start + __attribute__ ((weak, visibility ("hidden"))); + if (&__ehdr_start != NULL) + { + assert (__ehdr_start.e_phentsize == sizeof *GL(dl_phdr)); + GL(dl_phdr) = (const void *) &__ehdr_start + __ehdr_start.e_phoff; + GL(dl_phnum) = __ehdr_start.e_phnum; + } + } + /* Set up the stack checker's canary. */ uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random); # ifdef THREAD_SET_STACK_GUARD