From patchwork Fri Jan 8 16:19:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 41679 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 BCA793982426; Fri, 8 Jan 2021 16:19:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BCA793982426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1610122793; bh=RVB4XwBs93OWcSjrIKtMr1NVhGmH0Cv0BlY3bMZiJJY=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Abg94ozed+CpiLIzapRA1TcfqpqkhqSiMln3/2xybsMjpqCLsxZNSjT31LtCRc3aj TlDbdb+uc4t0U0pHjJ3hz9an+4ofKJk6UW3DtMrpt2xqfNX+P4yW0noW4HRjMHZHMH mKewmAUhFCUdq2uyf7oiNEX1rDnFXwa05FebVLM8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00043.outbound.protection.outlook.com [40.107.0.43]) by sourceware.org (Postfix) with ESMTPS id 02C983982403 for ; Fri, 8 Jan 2021 16:19:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 02C983982403 Received: from DB3PR08CA0005.eurprd08.prod.outlook.com (2603:10a6:8::18) by VI1PR0802MB2173.eurprd08.prod.outlook.com (2603:10a6:800:a2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.19; Fri, 8 Jan 2021 16:19:49 +0000 Received: from DB5EUR03FT019.eop-EUR03.prod.protection.outlook.com (2603:10a6:8:0:cafe::b2) by DB3PR08CA0005.outlook.office365.com (2603:10a6:8::18) 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: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 DB5EUR03FT019.mail.protection.outlook.com (10.152.20.163) 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:48 +0000 Received: ("Tessian outbound e989e14f9207:v71"); Fri, 08 Jan 2021 16:19:48 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: f256b21e26f68a44 X-CR-MTA-TID: 64aa7808 Received: from c513e51d8721.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2E8105FF-3457-43B0-A76E-903FB155CC02.1; Fri, 08 Jan 2021 16:19:42 +0000 Received: from FRA01-MR2-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c513e51d8721.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 08 Jan 2021 16:19:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Is6JW5tpG2Z7rcM3/AWr26Zl652psJl9isOjLyoliSSaXWHT1WvqaYfEBprzg6jAc9WFAkwG3bhqws7QTMQNhlVq5YpTxOQZIPqRsJNZvUmMNnX9QhPnePrTNCTunv/c8J5CPo0cewYfNZLehct3UduUpO9TEPxiERfCB/+sXGMK3KV2MYsHMmNJIwnh3IGqMMZu8jAZ4Lgesl/wttP8g/6ZEePTA/sUE2v/NZAPlgiZNs3Jgjcmotbmsw5IzbG7TvYy3iadXhax9S7lORblIgx9IaFTJxArRtTJhsnl0h2dZT9uQOqPrXfmsO/eFQ5yHRjMRppQtIbhR5kHX4NyYA== 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=RVB4XwBs93OWcSjrIKtMr1NVhGmH0Cv0BlY3bMZiJJY=; b=MBmBbD16Yiybuez8jotgxGLpaU+Jb9Kxz+E/peiU1XzXeU/movLdlF0z+E6QV9hErjpmsa8UC/fOM8AmB2lTcbZ5eu4M7DFkB31ovv2Jbl90IvMLxg9fQ6zqW6LxZhf4xw6J2zcsFbVk6hCqoHunsnpRXI+sWyqHR8tNhta8h/r6jt/C8xEgnrdhvcmbhBPQU7NUhhnLEYsJNKUib+YukqAN+5U2ulz2dm5DatQBB3VWqjOQMUG1CI6GmxZgB2wFUI9dVxg1eBkvtTclVMAKn8sAFQUN5aixn8HJKnNUdGmKkgliIWZ3bMRm1gjzlld9R7qqMbTuFYKRHhUlOMO5FQ== 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 PR2PR08MB4732.eurprd08.prod.outlook.com (2603:10a6:101:26::15) 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: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; Fri, 8 Jan 2021 16:19:41 +0000 To: libc-alpha@sourceware.org Subject: [PATCH v2 0/4] fix ifunc with static pie [BZ #27072] Date: Fri, 8 Jan 2021 16:19:35 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: LO4P123CA0028.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:151::15) 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 LO4P123CA0028.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:151::15) 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:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 855e7b55-a494-4a37-6d29-08d8b3f13834 X-MS-TrafficTypeDiagnostic: PR2PR08MB4732:|VI1PR0802MB2173: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: wPVRVvMi4ASmScNUJT8N69vvWjE4EMh15PJifzDPYMyOulR438EgxTBvNQ6FVzlOrhdTKm1b4Hlqkd0iLwuHsSJ3hN+L2V+siJy4GDe4hrfM0r3L6wkbQSrL6gE7uPtJolAM9ssNIJzcm2Z74lKgqCFnAcaypJ50A8pUnCNrBSnVc7ObNZ9RwmOZz+fZm+NIahfD1KRGcbNpY15Hkkip0Yr/LkopYvOxXRiKsKFRh6OpsqaUBc17pyb5sNBf+K5GF4Ec+Q5FTremoOBBncEKyU05LdW6YFkuLF62vqLrZaBbkpLYcezdniRgy2MCBiE3aRQVQ+aX4Ud7BRB6n1DqoUuznB6mRQEMV7X4xMPmlTZIkwHWS2zNCfRfabvS5s8bCyT1DFb6jP6PsF55Gj6rLrpze8QL/2YrY5kF4PuMpCWmmU4KP1ucCYjkuM+BnqecBy+ok7K8ltEO3JXETrHR5w== 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)(39850400004)(396003)(136003)(376002)(346002)(366004)(86362001)(44832011)(2616005)(5660300002)(83380400001)(6506007)(66946007)(66556008)(186003)(6512007)(16526019)(26005)(66476007)(52116002)(6486002)(36756003)(956004)(316002)(6666004)(8676002)(2906002)(6916009)(69590400011)(8936002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 0QxBNy60FspwO4Ig10NYQacpu/mhwERco96kClzy85vNgTGT8ZBxt3XPD+IEIW7XHxuSloyYNW48mnOqlxi8fQfVXCJhOLUUYC7+sB3jORo22O7vikqWrUzMHBhk9ykJxxenEhHw1/k6TwtMPZ8+1Hj6aaSaVY9rO6niBaZwr3yG1afE8rNzGZd3FuyCouVFTB3/xir2Is+o2taNKjtLrapg7NqpdMpH63AbpPGQx7JvIUR8le6J37G3Jwtm/QR+QtNFxCRmejF0r1wVwyHam8kFhcG3a/mPFuaPk3d6JyknzKrdbH5UnqPhTTMTAMDIyAbZzWb+9hhy1wG4D5KYnzXBFn1ecKbtc+Gltk9yh5vBaV54nZSa8Pcx4hiCXIOXSagOWQBPBL2bIdJE3YEgUcAtfoDJ6CbA9QbCFN7gNLXc3mAEo6Nzi1s/7x8HQHTVnchSKoo5Ojm6WBhVChrYoz1lOmshqTLMydJIC5EFQk8RYhHcC9kogGVlUqQXYOoxIFpLAxlm1kkQNR7ImJFPZwZRQTspCb+kLDuJvZsYN8JOmx3gtQsrQXpte1gTBBq+cYOVnZoP7c6cgqQm6H/OSVR59lrnZBbiBjBQ2RVmbBR4NOrCVBWa3TkWdlMo+Aju13FwQ+vKFjx8eTuyQ646qtEc+LRGMSH/EBmFfT+tTNbsbRaFAfWzl4nOVcG4kde+ko5qhdfUlr4eRgVyLLumwv6Z3axNQ4GhxLqf492NSD/4EwVu9jq8ufnAXXxKoijS6aw8Y8Or9rU9UjouaxntSsO5exie+BQBjrfxOpunGSmPdkqgfh6s4VQERBU1hVl5IYR65NxLjxlBZp5jVdWYEdknY/tAuW8I65qHyut0SkAYIPl3bai56kO+qo4fTdwEYidW4z+p0sK7BWMnATesjgi8VK9FsEeaxNiWKnz/ITT6rSLgaoh5pubfQ3jHxE0IrO3vFWiFbGiUI2Fs8AgikmjTtqnO8LvcGX/tIm7PqJDdWGfxD/ygAbjv+ik3Txc9 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR08MB4732 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: DB5EUR03FT019.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: bced8656-7779-4a1f-a8eb-08d8b3f133ce X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sRfrxoXIFj2mEJENIAarFKGam8wJXt4PYP6Mqe6rvujGw5ylc/FZm5GvPJnZ9S4leCv4d75n+mH5HqbVMfS6ExnaYcSFmF8n1lCWMUZ88FTm5AM/ojlHOZpZ5knIExwYEVmYXGd/c5mPCJ7Bd+vgW0e21WMhWpwjmhFeoDCoMXbeLGFA7LvuypZgVNAmivSrZ6hNxPdTcq6aRzhVwMEBDn4vg2NNcD4ZJqQml1pFU4wlIJ0F1iW4XpgcY0Vjnhy0IO1RfXxW7xHwxzG7e2uwUGwIil29ARmT8fDvIfpwYWmVcA8HS0pEDZM2TrruraT/ykJezK/WGdm0Q2V8V8iu3kwvUdTd/kAAeW1qq1ksrRbqIICQXhyvZIxPwlaYejb8vC9c/0zWjS0t5vJo8Dd5hw62O3+tcHSvXkZmtyn5j2uPRgOrPSW5O2BKuwC1BRWhtyOtrwU0czIIRzkBjDiWQ2DDjRbYJimm2Pj9ac/hlpv0vB/rkd/a67ZEJo8+i87TLjb2o9WUtWvY1b19lagnbw== 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)(136003)(346002)(39850400004)(396003)(46966006)(16526019)(186003)(336012)(316002)(70586007)(70206006)(6916009)(6506007)(6486002)(2616005)(26005)(8676002)(44832011)(8936002)(2906002)(5660300002)(6512007)(36756003)(356005)(956004)(47076005)(86362001)(81166007)(6666004)(69590400011)(82740400003)(82310400003)(34020700004)(478600001)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2021 16:19:48.4315 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 855e7b55-a494-4a37-6d29-08d8b3f13834 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: DB5EUR03FT019.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2173 X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, 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" v2: - check PI_STATIC_AND_HIDDEN for --enable-static-pie - change string buffer sizes in the tunables - fix env_alias == NULL logic in __tunables_init - move __ehdr_start processing after self relocation I think this is in a reasonable shape now, but there are still some issues: - tunables try to allocate memory (tunable_strdup) even if that's not necessary: only setuid binaries need this (in case there is a TUNABLE_SECLEVEL_SXID_ERASE tunable). this adds a lot of complexity and a failure path to the early init code. i think that if there is any such tunable then the entire GLIBC_TUNABLE= should just be dropped. - tunable strings could be stored more compactly (and without arbitrary size limits) as an optimization. (can be done once there are too many tunables.) - all symbols are forced hidden in libc.a, but i think lib*.a should do the same. (other than lib*_nonshared.a) Szabolcs Nagy (4): configure: Require PI_STATIC_AND_HIDDEN for static pie Make libc symbols hidden in static PIE elf: Avoid RELATIVE relocs in __tunables_init csu: Move static pie self relocation later [BZ #27072] configure | 14 +++++++++++++ configure.ac | 5 +++++ csu/libc-start.c | 44 +++++++++++++++++++++++----------------- elf/dl-tunables.c | 2 +- elf/dl-tunables.h | 4 ++-- include/libc-symbols.h | 8 ++++++-- scripts/gen-tunables.awk | 2 +- 7 files changed, 54 insertions(+), 25 deletions(-)