From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2087.outbound.protection.outlook.com [40.107.21.87]) by sourceware.org (Postfix) with ESMTPS id 11D883858D20 for ; Wed, 10 Apr 2024 07:29:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 11D883858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 11D883858D20 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.21.87 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1712734200; cv=pass; b=m+0Srl436tUt4KodtR1q3iRhczUsMA5wzUy1mj5BQKItC5N2dGNWpgK9uUvsOU+IgkAFTQ8SDDjuvJ24Qo/6nUojDKIgf1b5og4wNaFFqG4aWu2wiBHqJSK9BqpFpbhklC3bLBmpq9M5v6I+VYoFn8gz6PkhAINY3ejyH9qlJp0= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1712734200; c=relaxed/simple; bh=+OeCoIyTjul9eXr5h6sFrHDQc2rnndMfZ313MNYfiJA=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=aHmJAzWlNFSsZ1s0iMlpWPG3Kv7iiyWQ+vpJsO6nPmW7h4zakIOv3McfQT1z4Y0uMzBOkfA4OVBDKomoasphRB5YzslT2bFJiLhUK5Wc7m67WQ/qYecad2X4sHuceuy6uHO/tbFPFYGlsOJBHrclzwg9hncnWzr94jjy60EbnoQ= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=ZRJsP8A1tDo7lBIfQyw8HU3BQYApi5LcgR1BwVH7evU5QTpiSzGMsJQhajz1MrwBN1Bnzc3iCEnlryhh83vGyiW9/kvP+RCEX7GqC38th9hK4YGo6WAUts5paSuI935xUge47ZRBom1zX+O71mvLKOt4SPOwS7phZBF6weQpa49s6tFWxSVythk3KE22qgAtiVNjp7rq9tlfb26lwTC3f0IQfVTyVnst9SNKDO7daGAN6IM99sEUIYO5F+6Zau/WXUgsUyRhe0MQiEQMMX5AUdYcBPUsrtRN8uF/AKPxiKvJJdpbV4v08aSsyrQxZWqwcOVx00yrpPn9L7AmndoSAw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RJXrjciDrUXzNxYfKvagErGIbiZKI2DpZnz5XbCWn84=; b=c703r8L1/bOjCpfcau5Wf8mAyaO/BRgvVCRqLHWn6lBfmOp86qbeBe52OEv95ohdmEkdvu8gey6JknSdjwDYy7ig3Hl3xJnq5tOt0d/lXU7PP5zhoVTbR2ggwEjDi5UZeydq4beZg7Z76Oa5oTC0hN0AvMZfI3QE66l42A0pzwW2hesfQiWtvs0klJUBcgwkTWNOKJDV/18cMyL+a0vxe+R/Kiiv9mLuYEpkAEeQ5smS2Hl7PDv0h8leUvxycF3Ywngi3lmmujZgR4YW+yP0SygM49aoPAjdci1/JbiTO/XR6EXAVaUWUFguZu10lLesAnnx5ehNzl2OCW0LME8gZw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RJXrjciDrUXzNxYfKvagErGIbiZKI2DpZnz5XbCWn84=; b=iADCpK4uDdxXagWoHcbqQ8j2HYdumeFe71tV6jreyrLdid6+JxoxL890WMQ62uZahXa8KypQEIOn+uRkZFKBYfqWrnM3oWNTPOx4U3FDoKXFof06MXTHs3UdtSLYYqAZw9Delyw1VCw1xQROgJ9EEEmWt0Abukf9iPwcoWvRf9U= Received: from AM9P193CA0009.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:21e::14) by PAWPR08MB9805.eurprd08.prod.outlook.com (2603:10a6:102:2e6::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.55; Wed, 10 Apr 2024 07:29:39 +0000 Received: from AM3PEPF0000A797.eurprd04.prod.outlook.com (2603:10a6:20b:21e:cafe::d4) by AM9P193CA0009.outlook.office365.com (2603:10a6:20b:21e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.19 via Frontend Transport; Wed, 10 Apr 2024 07:29:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;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; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM3PEPF0000A797.mail.protection.outlook.com (10.167.16.102) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Wed, 10 Apr 2024 07:29:39 +0000 Received: ("Tessian outbound dc0a9029eb2c:v300"); Wed, 10 Apr 2024 07:29:39 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 544fa1e7b956cc1c X-CR-MTA-TID: 64aa7808 Received: from 8ec448717305.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id D4105CE2-E707-406A-B1F2-B7D4CAF0865C.1; Wed, 10 Apr 2024 07:29:32 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 8ec448717305.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 10 Apr 2024 07:29:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gp94+ZjTvQ9gbaoYoYwcl/eKUOYKkeW/bydo7+eJqxrHGrMb6DgvuwMhDjLbFlahUj1fr9rduHvz178BZLaiDOHmYJiu/Ch9iXSQxoFyoGWGccGGpnTYW9azrJWSO9llhikgRp8OJ5wsycQWN9pCgle1KBBY/a3XHp010oZYrfECLYlCAasc96y51wwXgioVLZpWFCqTal+oNZ7wrklaBUJJkqe8Ho2kh5ITlBvmtj/fu6Px9pl9BloZZ2dCCkWe7Nn5J2OUjN8Dt4dr5juE1bC6ZzN7GoOc4+9Jq/S+pT/IY2frTf3/2wqAY2rSSbF0MLViGL1xkJ5rhmqlt9TYlA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RJXrjciDrUXzNxYfKvagErGIbiZKI2DpZnz5XbCWn84=; b=fL02AQnK/NYGFq3px+ZDMfKUxgw867uSuQ2VpEQ35bMVMjC2YcdLCNysupZfEt3S2A56HD52+4THQ1k9lDpcakwPhE7arQFF84a2r/p3An4/CFybrV9lLRGcl885MaFtJlNG4IGNh3MQ16gFLoBlU9Cbnrk4aOfk8EIJLvUTNDrIYZ3le7ls4RGrORzov/6ODr1c5AGTQU1sI1zYf8Ymlobb+yKZh0hXhpFjq5DJ1M/GNKvBSfC7dSclPtedEkodo2HxD0XwREXj6uKULD3w80F2zTOtV4/F01aYbNGRw9gdrhytc3nSQruCvas6o2qsYnDjGWG12qCnsjPtAZ+GXQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RJXrjciDrUXzNxYfKvagErGIbiZKI2DpZnz5XbCWn84=; b=iADCpK4uDdxXagWoHcbqQ8j2HYdumeFe71tV6jreyrLdid6+JxoxL890WMQ62uZahXa8KypQEIOn+uRkZFKBYfqWrnM3oWNTPOx4U3FDoKXFof06MXTHs3UdtSLYYqAZw9Delyw1VCw1xQROgJ9EEEmWt0Abukf9iPwcoWvRf9U= Received: from DB9PR08MB7179.eurprd08.prod.outlook.com (2603:10a6:10:2cc::19) by DB9PR08MB6473.eurprd08.prod.outlook.com (2603:10a6:10:257::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.55; Wed, 10 Apr 2024 07:29:30 +0000 Received: from DB9PR08MB7179.eurprd08.prod.outlook.com ([fe80::8c23:46ef:c2c9:ea91]) by DB9PR08MB7179.eurprd08.prod.outlook.com ([fe80::8c23:46ef:c2c9:ea91%4]) with mapi id 15.20.7409.042; Wed, 10 Apr 2024 07:29:30 +0000 Date: Wed, 10 Apr 2024 08:29:16 +0100 From: Szabolcs Nagy To: Fangrui Song , Adhemerval Zanella Netto Cc: Cristian =?utf-8?Q?Rodr=C3=ADguez?= , "H.J. Lu" , Florian Weimer , libc-alpha@sourceware.org, Vitaly Buka , Fangrui Song , Evgenii Stepanov , Kostya Serebryany , Dmitry Vyukov Subject: Re: [PATCH] aarch64: Remove ld.so __tls_get_addr plt usage Message-ID: References: <20240405123550.1748641-1-adhemerval.zanella@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: LO4P265CA0287.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:38f::15) To DB9PR08MB7179.eurprd08.prod.outlook.com (2603:10a6:10:2cc::19) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR08MB7179:EE_|DB9PR08MB6473:EE_|AM3PEPF0000A797:EE_|PAWPR08MB9805:EE_ x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: tCkxCTp4ce/8ujNVMSI3HI51uMT9Urg0Sc9/Au8KMuycJmLyiDhRgrmfbEUUTv3nGM/AI2mSZ24s19uC2L6d3swXGS1dn7mSzdzJ83m47+OOpJNTqF1GX8kF4//fo2YSL9uko1NuBM1ueq7JkD8hNE1YerZCA8r2Mz1ddROQoDEwzxxFGA3a8S9omm5UGCblWD6SfIknp/2MkjuX5XgbwJ5n3lcgwaSw7kfeWJfubdDBj9ob0jnq/ab3M8gwpy9sXghZFmkhRx9i2P70bZW7PhV++Tkw6sJLD3hdQzHq87NqirL+B5v26aqZfuioM67D1DIHBtNtzdr7ZCUq30sXIsMJ3p2nJu8v880PIcgE8QGk8SB6Ta59w4Ckq+gSWrHOzt4n3Bnjb/hifVLietOYjb8cZpS1+DEcfXl+H0WDeUlIG7/nfYXevjrnDLFV0fUUQUYXhTNCdsVO6Eq6nhIEBFklEPVa8csux23d3OGkdXN9q+1PqOT1GeUXAARz7XnKW23EOUL7wnf9Wnl/EqrHgH8dejw6V7xcn03nmxYM8KskPNGZ8zTmf56Twl+6s2A5CuEoG7PQZ8t51GVMcoMrBmsXcAujioigOyq7yPQtvEs= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR08MB7179.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(1800799015)(7416005)(376005);DIR:OUT;SFP:1102; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6473 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM3PEPF0000A797.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a5f63c71-c68f-405b-854c-08dc592ffb61 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fn7I+sP7jFwprNH1UzI9qm4lJa3aNkIcJntavIz94YaKVQCwkfC5rqBYcHtKEwVx/lZVbpD778ak+f7+9oAJxzFbjjg5jEsIjv8BElQG5W/FPPgVbNwQ/3dW90/Xr0uAsJeFNpDNspw1EiGNL5hEtnEXBK3BKdjWNBBHz9C3fR6ambe3W0btsQ3mljXXPkcJML27w7zdM+lBE2EI5c0uyhSp1Wr/JAKHeZYgkXkDHqwyOVgfz0TRLzNJ/aUGfpX29nTkDgtvh0zz+NA9Bb9FQ3lR7k1LiSMolMfiIuQYpp3c7cLKQnNN70/xzzimeKlz9JTImf85mDFjp4ed8BmdR8igBls2O6MfXcofVzJ8Bj+7hHWyKBCDlIDgQQ9YqbEWtbGpOaEmBDbCccpEYbIjO9YYSvVgpEXbWEnTfOpAKK+gFqkMAXh5AB7HIaAWyWuJTG/mcPSl7UzxeGm3wQ3+4vrgPN0DO5XaH49ukIDmQccNZfjpsp61Fab6IdJQDUiiepcx4nPV5VJiYFA5sR0vrDyYmE+f/yCLfsDjtIABucQyeDK1KdBU8uhQiBsDA3n78f1jJ4UmVK/AZW86IDpIwP4PdxLUynAuTw7eDKQGoxzwEKT7JXQa75r0y+saALEJD9mjV4PPMWciXzm+QufE2NcNEBC/VGhwXdEaa9l+QbUxtNWjiGfajyHqOoAXLIuACT/4/6zqS1uPj5J1lvrzMw== 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:(13230031)(1800799015)(376005)(82310400014)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2024 07:29:39.4950 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5f63c71-c68f-405b-854c-08dc592ffb61 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: AM3PEPF0000A797.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB9805 X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,KAM_DMARC_NONE,KAM_INFOUSMEBIZ,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: The 04/09/2024 10:50, Fangrui Song wrote: > On Tue, Apr 9, 2024 at 7:03 AM Adhemerval Zanella Netto > wrote: > > On 09/04/24 05:30, Szabolcs Nagy wrote: > > > The 04/08/2024 13:57, Adhemerval Zanella Netto wrote: > > >> On 08/04/24 04:26, Szabolcs Nagy wrote: > > >>> i know sanitizers interpose __tls_get_addr, because > > >>> https://sourceware.org/bugzilla/show_bug.cgi?id=16291 > > >>> i don't know if that hack works at all now for tlsdesc > > >>> (where the ld.so calls __tls_get_addr, not user code) > > >>> > > >>> my question was if we investigated this issue since it > > >>> is useful to document then in the commit msg (or news > > >>> entry if this affects users) > > >> > > >> This change 'breaks' the sanitizer trick to get the dynamic TLS, with > > >> this patch I now see: > > >> > > >> MemorySanitizer-AARCH64 :: dtls_test.c > > >> SanitizerCommon-asan-aarch64-Linux :: Linux/resize_tls_dynamic.cpp > > >> SanitizerCommon-msan-aarch64-Linux :: Linux/resize_tls_dynamic.cpp > > >> SanitizerCommon-tsan-aarch64-Linux :: Linux/resize_tls_dynamic.cpp > > >> > > >> And it does not fail on x86 only because it uses -mtls=gnu as default > > >> (the same tests fail on x86 with -mtls=gnu2). > > >> > > >> Now that GCC and distributions are aiming to use GNU2/DESC as the > > >> default TLS, this hack will also break on x86. So the question is > > >> whether we revert 050f7298e1ecc39887c329037575ccd972071255 and > > >> document that __tls_get_addr should be interposable, or move with this > > >> change and try to come up with a possible solution for BZ#16291. > > >> > > >> I bringing this because we will have another two ABIs with tlsdesc > > >> support (loongarch and riscv). > > Last time I analyzed the __tls_get_addr interceptor in sanitizers, I > have made quite some notes at > https://maskray.me/blog/2021-02-14-all-about-thread-local-storage#why-does-compiler-rt-need-to-know-tls-blocks says > Note: aarch64 uses TLSDESC by default and there is no interposable symbol. not quite true: the tlsdesc call cannot be interposed, but then ld.so internally calls __tls_get_addr via a PLT that can be. (only for first time dynamic tls setup, but that's enough to get dynamic tls boundaries) you need another way to detect the static tls area, but that's true for non-tlsdesc too. > Current TLSDESC implementations not providing an interposable symbol > is indeed an issue, but I haven't carefully analyzed it on an aarch64 > machine. we are planning to remove the interposable symbol in the next glibc version, so the current __tls_get_addr trick won't work for x86_64, aarch64, loongarch, riscv.