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 E36441F4B4 for ; Tue, 19 Jan 2021 15:24:58 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D6B80393C84B; Tue, 19 Jan 2021 15:24:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D6B80393C84B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1611069896; bh=A1XNcoWQPXUDfOo8bT22ZL//YdJ6MVvPF1UzTJsZqOw=; 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=ejnw3PGx0ngmHQ5XJVyZ5pmo6weAZuWjbTy4RZSpbtRSCed8awTKL5m3iqLaY9E3C M8ayrvwGz/fMydmsCCOsyxhNhyHyScYcCkOnrJc1kfBfGPqzwncuYXsXUwUW00e+9w GHv66PFNEvuwJwm2hBBtXyj6+bET4GpdYOsjB9/8= Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20043.outbound.protection.outlook.com [40.107.2.43]) by sourceware.org (Postfix) with ESMTPS id 4C3B43850433 for ; Tue, 19 Jan 2021 15:24:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4C3B43850433 Received: from AM7PR02CA0015.eurprd02.prod.outlook.com (2603:10a6:20b:100::25) by DBBPR08MB6218.eurprd08.prod.outlook.com (2603:10a6:10:209::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10; Tue, 19 Jan 2021 15:24:51 +0000 Received: from VE1EUR03FT055.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:100:cafe::84) by AM7PR02CA0015.outlook.office365.com (2603:10a6:20b:100::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10 via Frontend Transport; Tue, 19 Jan 2021 15:24:51 +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 VE1EUR03FT055.mail.protection.outlook.com (10.152.19.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.12 via Frontend Transport; Tue, 19 Jan 2021 15:24:51 +0000 Received: ("Tessian outbound 587c3d093005:v71"); Tue, 19 Jan 2021 15:24:50 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 417c5b7cb1292ee8 X-CR-MTA-TID: 64aa7808 Received: from d0b375cf18c0.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7054065D-ABFD-4C00-A198-54693DCB4093.1; Tue, 19 Jan 2021 15:24:44 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d0b375cf18c0.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 19 Jan 2021 15:24:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AhvVdhUO3TopCIiiOnmiWAyhIAit+sF+/jPPMBLdChZc5iKs0lTvGlBtV5tuYGqhZjeKRTaAh6LFyF0a9BUlQ0FhyQ4oqUuh29SovCex5r9B8bETawDsuQT3royNTOnYdbf3olTRq1eI5tBMmsu5tFOPw7Ob6wEb8n05UYYKh4jz/cX+5MpD1BwJohz2vu/BgmfY7a74e3h5v0CIO1+tRB2G/1E7lqReiuyVom3zk613jod0kTPOW9kVnngkULjtkTxWRwkxK39E8W3MOvzgwvGDVTXZNaCc54q81zW79T3K6InyhytTObLeaZArrUQnCHqrmPTGhglsj1Av/fRaRw== 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=A1XNcoWQPXUDfOo8bT22ZL//YdJ6MVvPF1UzTJsZqOw=; b=i6ZF1yLVEEqTYHplW2/u8cwDOtRILj175njsMt2BSUac4Dnfp3mS068EaxF2iZPYZyvdF3/1i2l6ZLYOSf82TBiTOgymfFVnLaZxkcpstS33DAl/mz4riLTouEJ+YSDZ0lWXM4s7tr58isx5sCVn9x9PjiLicMpJCwA+P8cC8yf7FAEEkkEXlZ29flSZN4PIs/Pm2aIG+RGZCSRUsvpiSOVNhldlM8KAvD22zkSlB2c7o5jVv+ppSObb1vf/83HpOLXOm5wMyVM6e4WJ1JjqAJiU3VChTkPWlR8FRzwAQMRtoEyoSmUqpyoG2vsNjr888PKMu2+QHHI8FOnqcPL+Hw== 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: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com; Received: from PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) by PR3PR08MB5690.eurprd08.prod.outlook.com (2603:10a6:102:86::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10; Tue, 19 Jan 2021 15:24:43 +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; Tue, 19 Jan 2021 15:24:43 +0000 Date: Tue, 19 Jan 2021 15:24:41 +0000 To: "H.J. Lu" Subject: Re: [PATCH v4 08/10] csu: Move static pie self relocation later [BZ #27072] Message-ID: <20210119152441.GB3445@arm.com> References: <4224b7c0428492696fe6d6c01739adcf69fc677d.1610986541.git.szabolcs.nagy@arm.com> <1ba70d1b-08f8-6a5d-ecf4-45200744c9d8@linaro.org> <20210119143500.GA3445@arm.com> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [217.140.106.53] X-ClientProxiedBy: LO4P123CA0088.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:190::21) 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.53) by LO4P123CA0088.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:190::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10 via Frontend Transport; Tue, 19 Jan 2021 15:24:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7af6c4e6-5899-4220-8238-08d8bc8e5d85 X-MS-TrafficTypeDiagnostic: PR3PR08MB5690:|DBBPR08MB6218: 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: q7xiF0Mm+pmyNraIxQL94Y7Z3jiO8p03Q3R/FYhvx0AFrdSL8uHyYOEzhAVlH176GK9VJleBXsFWvHFZE5kIagBx2+d0KSbbDvfL+u+kkC4Dstsyjq248lk9wiEoYcE4p3b0wKvo4NJLo5V+rmCa/5Da/b0kMpoS4vDpdTEYYqvTB9pauYiOKJMGB9OJWToOcORpxOtoNjxngUhxDKvrp0P9t54V6Sw1yXfoiH2fArcwZkzmbxQ2mhxM62eICHSppFT5esUN4bxPcb1Dbu4MaRClBTSZyZJM15/B/F6sz4TFioE8dklPZznIaf49PJqs3fb9YauTX5yk1Egl7yrVG9LQZvmXmkUWt3IfbaIePZZjsegtJOryw+UrrmChOjx3hGOCHUDJt4BYvBXJTNIVSw== 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)(366004)(136003)(396003)(346002)(376002)(39860400002)(956004)(2906002)(33656002)(8676002)(26005)(44832011)(66476007)(316002)(55016002)(83380400001)(478600001)(54906003)(2616005)(36756003)(86362001)(66946007)(16526019)(4326008)(6916009)(7696005)(52116002)(8886007)(66556008)(186003)(1076003)(5660300002)(8936002)(53546011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?NzRoZGcxazBuazQxbzY3YlYzS3VEU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nVndnFDdEJUY3hYdlJFRHFQT3pZdmlMZzhTMUNvaEliWFIx?= =?utf-8?B?YUdEQW5LVGZDQzFzdjZHSmVKMHdaTnlyUElPNS9HaUFiN1NYVWxseVJJbGZy?= =?utf-8?B?R0FQRlVYdFI5OG1OeDdXWXppdUFUT1BBNWttUWplN0RHWVI3eGJuU0xwZ3JU?= =?utf-8?B?dzZFUlZHQjA4MjFzQzg5VGovb1ZlODMwcXhHTnZ6cU80QkVHRTBvMFpyUmNa?= =?utf-8?B?ck9JbWNEMkxLM1Jta1hPcUVXZ0srNGMwYk1lQkY1YmVBUEJhWitDS3MxYUpO?= =?utf-8?B?bWJldEJrQnlPYU55M0RRQ2FxWW9ZQ0oreHdlVU4yRnR3ek0wbCtuQ3o0L2Y0?= =?utf-8?B?NkFIdGNKNG55YXVTT0wvUXY0MEZ3UWpZdzU4b0JJUno1MUUra2tTcFRXOHkr?= =?utf-8?Q?SKEpLPPsK6oW4g9vQFhHnpB83f+WZQ+Z7j?= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5690 Original-Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT055.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 9d469ef0-3e31-4cba-7e78-08d8bc8e588e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KWqRlxWX2BlOWKdi3Eiln7UxKV970GZJ2+FdABO907ncq8A1w3xpOlbLWp/wh6/hB/i7tODKPZbj50rf1mtqYVNB7IFVkglBxaUt1e5AJnkUjz9SvWtyK2Sv6ePTlw8K8JYfSElLKeLRONtgtQrpn+mL6QNafopKAc7677rp99ZVqoXl7Z31t36aJe/h7sRoaUSTEeuhNVa091ok9o/QfbVH7xDRkia4yxrAGSDZqJwrBOWhhmyxZtz3tj1dvAmKKaAUqfzP5NZwOXsQVu8yZ8y/XRwl/BktohQAWMnnBKxuqwJUV7FrrMv4J8Joox58yIerQJHspbeK6KRKkNxEduSik0EK4UQXGBT3sUcnxx5IYsVhnTxKl61S1DIyixXAJCkd5dpyOC4OmeY8sMrfikP/FmJOb54undT4JoCv0xpF6mtLBwB1JoOeFaWgwHAbpmBHtu52SEJ/Q83/vPQdoA== 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)(136003)(376002)(346002)(396003)(46966006)(54906003)(47076005)(44832011)(1076003)(70586007)(316002)(53546011)(6862004)(8886007)(956004)(2616005)(356005)(82310400003)(2906002)(5660300002)(83380400001)(55016002)(36756003)(336012)(86362001)(4326008)(26005)(186003)(16526019)(82740400003)(7696005)(478600001)(8936002)(33656002)(8676002)(70206006)(81166007); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 15:24:51.1244 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7af6c4e6-5899-4220-8238-08d8bc8e5d85 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: VE1EUR03FT055.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB6218 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: GNU C Library Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The 01/19/2021 06:48, H.J. Lu wrote: > On Tue, Jan 19, 2021 at 6:37 AM Adhemerval Zanella via Libc-alpha > wrote: > > > > > > > > On 19/01/2021 11:35, Szabolcs Nagy wrote: > > > The 01/19/2021 11:07, Adhemerval Zanella wrote: > > >> On 18/01/2021 13:25, 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. > > >>> > > >>> 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. > > >>> > > >>> Fixes bug 27072. > > >> > > >> LGTM, thanks. > > >> > > >> Reviewed-by: Adhemerval Zanella > > > > > > > > > sigh, this is an old version of this patch, i made a > > > mistake putting the series together. > > > > > > the problem is that _dl_phdr is used in ARCH_SETUP_TLS > > > (to get the tls program headers) so the __ehdr_start > > > magic should be before that (this only matters if auxv > > > lacks AT_PHDR for some reason, which should not happen > > > normally on linux, so testing won't show the problem) > > > > By normally do you mean it might happen on a specific kernel version > > or is it architecture specific? i guess __ehdr_start symbol can be useful and with it glibc does not have to depend on auxv (which an elf loader like valgrind/qemu-user may get wrong) however it is only used as a fallback and on linux AT_PHDR is always expected to be present. (i don't know if this ever triggers) > > I think we can leave __ehdr_start ASIS since it doesn't need RELATIVE > relocation. I verified it by adding -Wl,-z,report-relative-reloc when building > elf/sln on x86. it needs relative reloc on aarch64: it can be an undefined weak symbol and that must be 0. a pc relative address computation cannot give 0 (unless linker does some instruction rewriting, but on aarch64 the address computation is multiple instructions that can be spread far apart). so yeah it needs a GOT entry and that will be either 0 or needs a RELATIVE reloc.