From patchwork Tue Jan 12 17:21: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: 1425341 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=KdzSC/Js; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DFcnW0gp8z9svs for ; Wed, 13 Jan 2021 04:21:51 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9D2CA3896C2E; Tue, 12 Jan 2021 17:21:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9D2CA3896C2E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1610472108; bh=6d8y6fh3aEznddpaiMRj++Q141n9pCAwnHk2ugEk3io=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=KdzSC/JsDsK2RlgXk19f0q5OHjU+RV+kPk7R6BvmCScR+Z1Vp7rngVp2zlSqN40zx UmL3VHm6zZOg+6tjlJxkFHv9qpWLYboFGiblKDB0r0GR6iuvSDeR3XghG6yf+up4aP ctCeWeP0WZVq1P1IBsH+L/i95KEZH6S43t5rt5U8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50085.outbound.protection.outlook.com [40.107.5.85]) by sourceware.org (Postfix) with ESMTPS id 501063896C28 for ; Tue, 12 Jan 2021 17:21:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 501063896C28 Received: from AM6PR0502CA0072.eurprd05.prod.outlook.com (2603:10a6:20b:56::49) by AS8PR08MB6327.eurprd08.prod.outlook.com (2603:10a6:20b:31a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.9; Tue, 12 Jan 2021 17:21:39 +0000 Received: from AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:56:cafe::5e) by AM6PR0502CA0072.outlook.office365.com (2603:10a6:20b:56::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; Tue, 12 Jan 2021 17:21:39 +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 AM5EUR03FT013.mail.protection.outlook.com (10.152.16.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Tue, 12 Jan 2021 17:21:39 +0000 Received: ("Tessian outbound 8418c949a3fa:v71"); Tue, 12 Jan 2021 17:21:38 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c1c4130afc2e3f14 X-CR-MTA-TID: 64aa7808 Received: from 17e7e42a5803.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 5E1BB432-1701-4FED-86F9-076B0EB2E50C.1; Tue, 12 Jan 2021 17:21:32 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 17e7e42a5803.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 12 Jan 2021 17:21:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NaPzH2aKKY7/3JtTYw3EDhPF4Zkr5Jp7VQvChg5mnNTmD33gij1SZgNCVL0CwnkiFALckhUU9gOHhOy29bky77ThcEoTvFA08LhzeTNOMWqmF4mA0ou5XALY1NbPcWuIfjLsbAHpK8wJiNBeZgfrmwBOJn8eHXi7F0BMpPBPCMB6C3Nx8/6StOatQ6Z5utNz8qT5Qpd/iZpYD7yc3vLW+QDCY7U09ZT913MVz2mFRI1qqHzz0W6l8te0d5nl8U1ekzUdP++jD/sJr7EAJWw2NlBCcHRpxlGeNnCZXbrWamw4jvMxn5E5NmVsKooc0MFOoSG+yg3XgSiNGro/s7VMnA== 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=6d8y6fh3aEznddpaiMRj++Q141n9pCAwnHk2ugEk3io=; b=GSqhCbwr4jAb+orWzgOydORxPRfG9uUCAeTuSTBOSBc2V+akkPRsReJfJ9w7SrUklWdw9/ek+1GvtC4OnXvLpBihbQCwJnkETbFQQNeEuiAVFR/2053PLRYPt3ey5hlytxO2Vv4sd3CIbfX490T6esVPY3DPg14fii7d6Qjow1oNHXHa9xcshFu7QH331BLZq8jCKLJPP83Y4EJtYxet7A9iQSGt5QCfLFkxPn8HuMa4IXila7U7QTke3FZH58dT9nM5ZeQiuMEQ9bDCTWaxIJt2ecnCVm+SjxngaMmslcNf88tojJQIU6PsLioOS6dHVOW8IH7QFk8THr4ET9beLw== 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 PR3PR08MB5753.eurprd08.prod.outlook.com (2603:10a6:102:87::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Tue, 12 Jan 2021 17:21: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.012; Tue, 12 Jan 2021 17:21:31 +0000 To: libc-alpha@sourceware.org Subject: [PATCH v3 0/5] fix ifunc with static pie [BZ #27072] Date: Tue, 12 Jan 2021 17:21:25 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.50] X-ClientProxiedBy: LO4P123CA0307.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:197::6) 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.50) by LO4P123CA0307.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:197::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.9 via Frontend Transport; Tue, 12 Jan 2021 17:21:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ed6f073d-40cb-49e8-ddc7-08d8b71e85c4 X-MS-TrafficTypeDiagnostic: PR3PR08MB5753:|AS8PR08MB6327: 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: oc+/sXRE3mrHawuJjV6VY+a1jXq6+2HbAlXsfFuiBb021Kprg+xI5Sb0W9F4lYJ5gLj4YypM/jpbfVn5lM1vg/NNAKsi85MdZ1Gf0RPb3+HUN50EubmUSbRgyoxMMYJ1j/TxvTZNVxk3mb+sP5NKdZdayZ/A0UjZb0xwXh1HNYHAqP3jLgDERy16rbQkLnobc5C7Poobph6kIrnHPt5TTUFD+j2cNxEyfqNP4ohY8Pd0VNm8fgtWBVuSE1vfwGQEkRpWViRRJkS71h3VEfEWSvmppM2G/2gbvyY3K7N/Lzw//aopmG7ZdD0qdiTOBrXxH986YkuV2EJ/BucwRRc4M7mV7CbnJrwb3SVXMqoqzJD7yKp0ouuVucCoeKfN9/hSDp2IEQMl+1WAKEv8BvritDfqRjzMm7ofR3ilik4libglSys6aFWboFt3rZ4S5D+7qMkWFzOZYh+gVFw/vS31sw== 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)(376002)(136003)(39850400004)(346002)(366004)(396003)(16526019)(26005)(6916009)(86362001)(6506007)(956004)(36756003)(83380400001)(69590400011)(478600001)(2906002)(8936002)(186003)(66476007)(6512007)(2616005)(6486002)(316002)(5660300002)(66946007)(44832011)(6666004)(66556008)(52116002)(8676002); DIR:OUT; SFP:1101; X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B5753 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: AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 50e93787-5fac-4edb-f81c-08d8b71e80d6 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1ofnUJ5J+r0Mh9d2NnUcEQhIiEg+iU6NmQGjJByyhG4s6FbpSmKT/qEdpbSwQ5jA6UcMz6OD8Xe9uWp98p5hfaUuF1KmauJy/lgT3BUuI3w2IbDrPZmxa4+5bXctULG/OzhS2ME8a1y/mpsOygCbJS8iRpcpzhByadKmpIyXakGthnh5ZF+YXOeyxwy1CKgSgd3xou0pvA042mDZpgzL3u2BatSUmpKST2bMwbbuCjfnn2CBfdyGa3vKv8oQPjgmIGp7YthLSxcbRsKGSC5DMhZJ2OgtCFD8sLKzKqEjaJzjpvqdiKN+CSotDGjVunYtXFmhaYLVG/FW4j5dUQAQZLzgJRf2KGJGRcA6YI9bqUmalgiEP9qGa1oYIeY/ul7GerZ7V8wI85gK+QE5FTWBo0y/Up9BixzFP5eDGN4PsYMj2EwWuUu18z8FkKxB8/Y+lAKpkMv6bjwyqtf7lzXfbQrnP19U3h3vX0RDqXB9p7tLt5ML0RQKFwE9l/hznMQXXwNCHVnt+QqJMM9jptZZKg== 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)(39850400004)(136003)(396003)(46966006)(356005)(81166007)(186003)(83380400001)(16526019)(70586007)(5660300002)(6916009)(69590400011)(6666004)(47076005)(82740400003)(70206006)(2906002)(6506007)(2616005)(8676002)(316002)(8936002)(36756003)(478600001)(336012)(6486002)(34020700004)(82310400003)(26005)(44832011)(6512007)(956004)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2021 17:21:39.3518 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ed6f073d-40cb-49e8-ddc7-08d8b71e85c4 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: AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6327 X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, 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" v3: - refactor tunables: move internals out of dl-tunables.h - use generated max string length in the tunables list instead of magic values. 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 force pushed into nsz/bug27072 branch (with a gcc8 bug workaround for aarch64) Issues that are not addressed: - tunables try to allocate memory even with non-suid exe. allocation is only needed for rewriting the GLIBC_TUNABLES env var. i think a case can be made that if anything there is TUNABLE_SECLEVEL_SXID_ERASE then this env var would be simply dropped. - tunable list is not optimized for compactness. - all symbols are forced hidden in libc.a, but i think lib*.a should do the same. (other than lib*_nonshared.a) Szabolcs Nagy (5): configure: Require PI_STATIC_AND_HIDDEN for static pie Make libc symbols hidden in static PIE elf: Make the tunable struct definition internal only 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-tunable-types.h | 42 +++++++++++++++++++++++++++++--------- elf/dl-tunables.c | 2 +- elf/dl-tunables.h | 35 ++++++++------------------------ include/libc-symbols.h | 8 ++++++-- scripts/gen-tunables.awk | 16 +++++++++++++-- 8 files changed, 105 insertions(+), 61 deletions(-)