From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 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 dcvr.yhbt.net (Postfix) with ESMTPS id 3B0FE1F934 for ; Thu, 21 Jan 2021 15:38:34 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 57B0238708A5; Thu, 21 Jan 2021 15:38:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 57B0238708A5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1611243513; bh=ZDo2oGbsu0CCODnJAfjOiyFGbnkt4KK269+wQtYDG6I=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=IgTVXNX9+Sc2N2rvORF3nnvFCukVh98DzTm4RbqS34IOy/OPBR72eN72EzMBHZ/fw TR5+UhWDyhecDNRER6mFozSpPajmJGCJeR4cz4spwUjd+hvBnuiWFaXP3z5zZSvwYt bJAJ4LLgKnehXXmI330MGdZXpc3PZz5rrBkCKF/A= Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50047.outbound.protection.outlook.com [40.107.5.47]) by sourceware.org (Postfix) with ESMTPS id A651C3870841 for ; Thu, 21 Jan 2021 15:38:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A651C3870841 Received: from AM6PR10CA0103.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::44) by VI1PR08MB2671.eurprd08.prod.outlook.com (2603:10a6:802:1d::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.11; Thu, 21 Jan 2021 15:38:27 +0000 Received: from VE1EUR03FT017.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8c:cafe::2a) by AM6PR10CA0103.outlook.office365.com (2603:10a6:209:8c::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.14 via Frontend Transport; Thu, 21 Jan 2021 15:38:27 +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 VE1EUR03FT017.mail.protection.outlook.com (10.152.18.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Thu, 21 Jan 2021 15:38:27 +0000 Received: ("Tessian outbound f362b81824dc:v71"); Thu, 21 Jan 2021 15:38:27 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4f6e9c98b25bb38e X-CR-MTA-TID: 64aa7808 Received: from b62adf5a10ca.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1A9EC354-74C4-4BDD-822B-8E5AB13DDF1A.1; Thu, 21 Jan 2021 15:38:12 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b62adf5a10ca.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 21 Jan 2021 15:38:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XOex13aiER5mRFS7VG8EsETdkxlkSo4AqkLMwVsujj2Ozzw110g4jWD1O0Aw0vMOvVcAORzvRjoueevO3aNq9c5rSgt5U1sXtl3DWKAaqnNYoxF9i74Vs0m8IFA6tbIHZd74yD8X6kgaGbEaLIRU81GUDTlXlT51wRAJBlJcs0hzEXaKYi2ZdG1GI4sThKdXzykyrYfxZAO3NKgfMJWJfLOV5mEiV++Sd3TpNj8XWpdGKf4Iggx0VQ5EDXRjxCYKqHPZYfUACodWHlAX3DQOCyZKnXqy83igQ+l+RWRZsEqv+CUV2Tf/oMvd68KER0ZD/3wmPHXGg8Po8CskwWpfpg== 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=ZDo2oGbsu0CCODnJAfjOiyFGbnkt4KK269+wQtYDG6I=; b=mkkj/QFaldCtrrr0ico+vOy/4xJ19/Xm387k5K1ag9LznbXj5wbhIRxRm6gaRqQErSj6F3Zm2yDrTVILlhRCnIIQEGuMXmQGtV7lO73LDbn6CIlJsXylxQfhA8oqQ4xkrg1Prp7d8MnnWiyEpahbo3f5E+ofpYmmnHzvrVenUHFwOoUenkpTo7ommvTGYYYCScAVLyL6ZJv0WB8UgFZRf196xkvKAyZKt+PHTTTcAjrsNc7VL+6kpVP8AOLk0RHv/ydkUvD61WRDfkErn8eAInrYuu9ZDH9go5BiDOv3oCOmOSAqzvuxo8R7FOcKD+8PnutH8ZoIwdUehOKiFi4Wwg== 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: linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=none action=none header.from=arm.com; Received: from PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) by PR3PR08MB5593.eurprd08.prod.outlook.com (2603:10a6:102:84::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Thu, 21 Jan 2021 15:38:11 +0000 Received: from PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::700f:ddbe:a347:ee4f]) by PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::700f:ddbe:a347:ee4f%7]) with mapi id 15.20.3763.014; Thu, 21 Jan 2021 15:38:10 +0000 Date: Thu, 21 Jan 2021 15:38:03 +0000 To: Adhemerval Zanella Subject: Re: [PATCH v5 6/7] csu: Move static pie self relocation later [BZ #27072] Message-ID: <20210121153802.GI3445@arm.com> References: <81d4408b-9f7a-0dec-6ba2-857a74dab73e@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <81d4408b-9f7a-0dec-6ba2-857a74dab73e@linaro.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [217.140.106.55] X-ClientProxiedBy: SN1PR12CA0077.namprd12.prod.outlook.com (2603:10b6:802:20::48) To PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.55) by SN1PR12CA0077.namprd12.prod.outlook.com (2603:10b6:802:20::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.14 via Frontend Transport; Thu, 21 Jan 2021 15:38:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 536d9d14-5ef8-4739-23fb-08d8be2298bd X-MS-TrafficTypeDiagnostic: PR3PR08MB5593:|VI1PR08MB2671: 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: ijTjvXS4kwMdsfSBSGfc4/tprX0rlqFWSkgS45GkZ28gw6pQP2xk7PY1xpbUcCp7/RSxvhAm/Wi6auyjxPonvxZIuSxW/rCzzZzGgZCD6Z4uBm7EhkYxqVbdVKhOuzPhM+g6zwNrg3i6I+OZmHXd83d5fTHWsqBtVF8zD8XCn/21kQfRgXEtlM0a+q2ZwNEKl2UnjRXNh1TMyPHwErEvFYOz68zjIbeZotYA0mdFW6wydmhhTCWsZweEPMbUBRcASdn6AgDyPySrXuGZe7ykPC10ulUvot/Hff9pg1tzEliS88jv4/WvYZTPnaX4+U+3MeB5QhqB+h4UHMKgwwfG5Lho9A3BuafrI+hZBYcPcGr7lJYkz8mZYL3OQ02hNk1hJswEiK8U+MtkUpFvucshZw== 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)(136003)(396003)(39860400002)(376002)(366004)(346002)(1076003)(6916009)(83380400001)(2906002)(8936002)(33656002)(4326008)(6666004)(53546011)(8676002)(16526019)(316002)(8886007)(26005)(186003)(36756003)(55016002)(86362001)(66946007)(44832011)(66476007)(66556008)(7696005)(52116002)(478600001)(5660300002)(956004)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?c2MvM2lyUFN4NDQwQzNITXA3ajRlb2l1L3E1eU5rSFBiUHZ4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FOFhrSTArdDFVamZYM3BLdFNTdEMrSTRXK2pS?= =?utf-8?B?RS90Rk93TmVlYTltelVqSFJxbytidVZxam5yQnJCQ0pJeVdsN3lNTms4WVhS?= =?utf-8?B?Zk02UUFNSUdvVFhVSy9xSFJTL3hERmFTa09SY1UrS3dWY3FvdVMvZTdmRmdW?= =?utf-8?B?VUNhOWgwUWVGdzNuZTZSUytmeHgySXFzQU5RN1VzckhBWk95S095RFAwbGRH?= =?utf-8?B?clkwQnFkQURZY2NtRjNlNzg3cUxSRnVsQi9ORDBNWnJBdGdsMjN1SHYwWUFF?= =?utf-8?B?aWszNEpCOU81cDRiaXlQb2c0QXVUVWUwWUNsaFZiN0ZGTVFROGJZVExJRWd2?= =?utf-8?B?VTR6ek1nQk9mV2huNGVncGpQTHFRNjJoblFFR0ErNFZDUDZQaEhqRllJYXp5?= =?utf-8?Q?MRLLlg+vkhWv+OBSAU6wqyNHkNREIoi9u5?= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5593 Original-Authentication-Results: linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT017.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: fa1dd9a4-fa9c-4787-2fe2-08d8be228eb2 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vdx5r25UBRKYJHh7Wj+hB4v7tah9JWmV6DOfwq0bjsenP9sN/HctbfJnQlhDSMV/6N+JdCAHA39sYjygS5ZiEMekVotrtSoqwr8S5kq8uImMazQpd0UD9yDk+lu6B/HvgKlwAWtvAJrV6SVon5Vr5foQV0b13eZy+DxZmsRydrL66th+gIDAyy5Zuz2Cro/6rbcgOpLZ6puhxAazV3KkSQCNxBX8UnIWNGTi6ghLI+MLedGoZ3Nz1jTqABw1QfpH/5GHP8aNuG9PwXOSHog9V++FR3mHwz9hpmEv3W2GXHkrIhn2HiejKbPBP9WeA51rRXw1bmc/pvOb5K45QSsBG/W9AbCdNJ9k4gO8UwfVP3JG+ZbEHYc54+YRFk/NhePWK8jdPMpY71syyNrt64192nMye9G8Hiypitia0DfLpv6RujlQtbzGq8rafn2W48g2g8W2ZzL8THOpa6uJsO0J8Q== 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)(396003)(376002)(136003)(46966006)(83380400001)(2616005)(1076003)(336012)(70586007)(44832011)(5660300002)(33656002)(8886007)(82310400003)(316002)(8936002)(956004)(6666004)(86362001)(8676002)(6862004)(7696005)(36756003)(4326008)(81166007)(70206006)(26005)(186003)(82740400003)(16526019)(2906002)(53546011)(478600001)(55016002)(47076005)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2021 15:38:27.2320 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 536d9d14-5ef8-4739-23fb-08d8be2298bd 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: VE1EUR03FT017.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB2671 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: , From: Szabolcs Nagy via Libc-alpha Reply-To: Szabolcs Nagy Cc: libc-alpha@sourceware.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The 01/21/2021 11:07, Adhemerval Zanella wrote: > > > On 20/01/2021 12:31, Szabolcs Nagy via Libc-alpha wrote: > > 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. > > As a side note, how hard would that be? I really think we should aim > to make the bootstrap less fragile and it would also make porting > static-pie to other architecture easier. the IRELATIVE relocs are in the DT_JMPREL area, while RELATIVE relocs are outside of it. (this split is to allow simpler lazy binding, i don't know how strictly this is enforced in elf, but since ifunc is a gnu extension we can just say that this is abi.) so i think you only have to change/copy elf/dynamic-link.h and have a ELF_DYNAMIC_RELOCATE variant that processes the two sets of relocations separately. if you don't want to rely on DT_JMPREL then i think you have to change elf/do-rel.h as well to have a elf_dynamic_do_Rel variant that does IRELATIVE separately. either case changing these looked more scary to me than the current patches: likely we have to copy complex logic with slight modification and there are a lot of things going on there. (but that was before i learnt about the i386 hidden issue and hidden weak refs and tunables_strdup.) > > > > The early startup code up to relocation processing includes > > > > _dl_aux_init (auxvec); > > __libc_init_secure (); > > __tunables_init (__environ); > > ARCH_INIT_CPU_FEATURES (); > > _dl_relocate_static_pie (); > > > > These are simple enough that RELATIVE relocs can be avoided. > > > > The following steps include > > > > ARCH_SETUP_IREL (); > > ARCH_SETUP_TLS (); > > ARCH_APPLY_IREL (); > > > > On some targets IRELATIVE processing relies on TLS setup on > > others TLS setup relies on IRELATIVE relocs, so the right > > position for _dl_relocate_static_pie is target dependent. > > For now move self relocation as early as possible on targets > > that support static PIE. > > > > Fixes bug 27072. > > LGTM, thanks. > > Reviewed-by: Adhemerval Zanella thanks.