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"