From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130081.outbound.protection.outlook.com [40.107.13.81]) by sourceware.org (Postfix) with ESMTPS id 0A0FF383665F for ; Wed, 1 Jun 2022 07:26:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0A0FF383665F ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=E8ZLnMcdaZoZyVojDS8K5bwntklEFyMRowYsj2SUGLGVPleUUlj378kEQdXuBkWMin++ONMq4HU9RGxMVk/I08XX+yRM/dTBfn+s7ykZcV91QVQpC7joUjUoijfL5WZZEM7cL5pYsq+PmIfVUfVvuDnQfXxCYTDIXW4upNjveTqd92KLLjV7OyvPZepdEj/isqbmuQrqmm+DV99U+OepanUiLx4sRpneIM2tp8wupuinKnWseE63DJLPxyABvItLLuTH4vwn/5z3SN2Vvu0TXvWS7LW2+Ztzn+Eyfs5INBZ0mszGUCBcRQXWPgLhaU3ULoCrJoaPCd/J+9S3hZBvWQ== 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=PXF1a1BofBkx7iQPpie8l/XzptT2yKPnZVEEJs0HhPs=; b=YbMlG4DxQP8PU/8eaYP/oOpi1jz6VKgS1Or2Gj4FXNRNnpWuPlbvx4zJO4KDi4RcnkbZQmp/oP7pdFPaeGODDqBQ6J/+w65J+srcsDZ2nvMqcR0awI+T/YDhm3Ef3sEUFmH9fptqQ5taaxyU9b4i1tJNsGIeOHzMEwryDUo2iQ/Jpt5vY0m8To7pKx+1R+0mB7i4hpOPRX1ZKu3U/dvZPwPw5G0k0KA5/x71EOj5L55b0IxRwRGfFKDdofXXm+ofHMWOvxrlg8SiBETk1Pch/UOZIaiyZDpBJWwZN1x299jQAzuGT6LziAGWLFIw67tk1S3dJBczyF775jVqKspReg== 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]) Received: from DB8PR06CA0055.eurprd06.prod.outlook.com (2603:10a6:10:120::29) by HE1PR0801MB1690.eurprd08.prod.outlook.com (2603:10a6:3:7f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.16; Wed, 1 Jun 2022 07:26:50 +0000 Received: from DBAEUR03FT054.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:120:cafe::72) by DB8PR06CA0055.outlook.office365.com (2603:10a6:10:120::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13 via Frontend Transport; Wed, 1 Jun 2022 07:26:50 +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 DBAEUR03FT054.mail.protection.outlook.com (100.127.142.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12 via Frontend Transport; Wed, 1 Jun 2022 07:26:49 +0000 Received: ("Tessian outbound 5b5a41c043d3:v120"); Wed, 01 Jun 2022 07:26:49 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: b20c569243b17ecf X-CR-MTA-TID: 64aa7808 Received: from 9589acb745e0.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2CA899D0-8FD7-4895-94FA-2919C2D6C024.1; Wed, 01 Jun 2022 07:26:43 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9589acb745e0.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 01 Jun 2022 07:26:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z6dSP2+kUKquh9C4+cB7WlMSZKEgANHtnxsXBAVdtPbD4NTQQJNUkwkbbLwhahfvlDPzaElql2gkLFJ5mfHlBMLjVYWVlWptXnJr4Mt3XlwTwneMio3Dn1LjZ21ftAdk3CnDB9hZrkGa9PnWaGwAv1SN4xq2JapDsnw5gOV1pG2TCWDq6rvOIpTHkglVkNGx4ODPMbsrGVF5bnpsBElF92+PgOlOXu79bIGJmgoqhuuBpUAot5s5nklOmZMCh1cjkw3AUqhTQykx8QYC4Rjnu4ZHVjd5jLfnaiYIXg7J3bTwpXI/pwXIX7a2LABwJYIybpFlQAiJ6F9JW2cIFvMmrg== 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=PXF1a1BofBkx7iQPpie8l/XzptT2yKPnZVEEJs0HhPs=; b=bDI6S08nzx/xJGLh3rrkYga5N75OGYgSeAc9jvY6mokBpd1TEZX++JVu7p6gfZeyTyeqgLpKNrtmQxTmC/lH0fB8GhFRlP1KuSMqKBBzm9nE+gub4efh/Qj027BngJlmp9g71jQRv2ct3qeNL7ly5q2xv/yUieKI8/nN9mazNZuinibJ0kfPwZqtRMc5hL6YxsG1Q/Ec4Z1GNI0rggqLLF567PJiem0ov2q+N4oyJny3pFiq7pdn+d0pkOLSMZz7kgCO48FhipatbllYpDz1101cVLVoM3/K5Eu9oOZHVTL/anfkBXVi0L72rOtdvN3l24aRdNvrniafWEfeB5OCrA== 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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from DB9PR08MB7179.eurprd08.prod.outlook.com (2603:10a6:10:2cc::19) by VI1PR0802MB2367.eurprd08.prod.outlook.com (2603:10a6:800:a1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.13; Wed, 1 Jun 2022 07:26:41 +0000 Received: from DB9PR08MB7179.eurprd08.prod.outlook.com ([fe80::9ccc:fe7c:19e5:bfa6]) by DB9PR08MB7179.eurprd08.prod.outlook.com ([fe80::9ccc:fe7c:19e5:bfa6%5]) with mapi id 15.20.5293.019; Wed, 1 Jun 2022 07:26:41 +0000 Date: Wed, 1 Jun 2022 08:26:27 +0100 From: Szabolcs Nagy To: Fangrui Song Cc: libc-alpha@sourceware.org Subject: Re: [PATCH v2] elf: Remove ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA Message-ID: References: <20220601045033.809671-1-maskray@google.com> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220601045033.809671-1-maskray@google.com> X-ClientProxiedBy: LO2P265CA0055.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::19) To DB9PR08MB7179.eurprd08.prod.outlook.com (2603:10a6:10:2cc::19) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: c7197dc2-2079-4a8e-4f14-08da43a017cd X-MS-TrafficTypeDiagnostic: VI1PR0802MB2367:EE_|DBAEUR03FT054:EE_|HE1PR0801MB1690:EE_ X-Microsoft-Antispam-PRVS: 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: lk2C6g++YX8mUgEbKBJ9EOgVVo9WpFwU3MQClXr8qkAXMRdA/oAVMHRSY2a4/BJjcfv3QCyNJ52h93xRl1/ZNxJ3VF2CI/FVI6zdRqM7zeprYhUn866q3otbKR2MZ+ezk/iTEL7AialbBVGWxJ7hKcHdG36LVgWcSSDT+Nyb2U0Ci/rpku12pFj6oGqn6eODG6AmE+HWJX8Bj8j+OdrS9EYv2ESsHZ7NpfyojlDXm23+8b7luyzikQp6sz6+xgEAttAm+/P0jcPKUqAaszr6v8KkxNeAWlQAApGOGOE9XOGmvBZfuCHCJZJGIHOrdTjyvkrvxgJJ1BQbf5LGQluGxKze6QvF9rEcR3p77w5yxKWJxgoOKugKPH/ylc+R69M4B3jb56ghQY+pgtXdTu3aTniQO/nPyEbPc4C+pWNj8I2kzjprcbBPTAPjZH3ZS/ezP0Z9DKNnQDkc4888+hFyPB/e7FhCqMImjFTIUfEFuQlqjgerRteDcdUwW/VcnPl1b8zK7/KNyHg+DqRn9ebGjZaaN2S6L79qHSzVd1gdSNfk+ZSEKwgWGyZ/WD09maEg5Ap1liHVt+c6vJ9+BefznV//t8QHD1teHL2l9j+m0cnkl7wK9gU0cOXhM1/aT4hCHaYeBvJe1Dc16HTDM04BXA== 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:(13230001)(4636009)(366004)(5660300002)(6486002)(186003)(2906002)(44832011)(36756003)(38100700002)(8936002)(86362001)(66476007)(8676002)(66556008)(4326008)(66946007)(6666004)(316002)(83380400001)(6916009)(6506007)(2616005)(508600001)(6512007)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2367 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 62933c13-1f4a-4466-0056-08da43a01285 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Np3sS5Y0yPPhydAOZpOxDihtDJrIIKN8+OFTo4fVUOkCdqV3oR/6IVAnluWi+DWHbcOmjdVJjP+/W9Qj7qbAs3SEQE0yXYYJZ3JyNZ0aN2c5M+V5Z4rC2dhwQ8pPf/wYe9p3Xs5VBICgF/YpFQD0JMZGN+bwufWv79a8WyLRLl6UNrf6ZXlw6Yi1DJQwOfB8GOquqQsfnIqJlbgEpkn2untis3HuRWvzXOmX0zmo97ZPi/endPw/NSjKIy/K5qRFZeY4zamLmITWKpv3xDp2RVC3o31D2sS+aF94wF0NjnDpWYMhrdx1Do2PhzwxbpXfvgEYTcw71yv33d4OBe9ficjaPPemScmQRXNVIQEOKWyciRMcl4+M1VQtU5ADbZcOUp8SeBQSE510AFgFI6ANIFKhS7hivuq8Si2HviTUKe5+PCeayOx1mvjPg7E+rZzU++nmASADcJL13FM9233uOD0i1+tt9oEqzrLsnMDyp8WFnrvnSb3JjEFI7GnUx7E1A/9Ic/bMtpQoc063Ryy7yaYUzAXHSsJXQ9cYCKTGLNns9BdfBbyJznNytx9JzGs5FQQ4hRk+Pd0jB16TATnW8eVrziuocz8n9IIq7eXI60ctfwkUkr+DAmLMuXaUTH3rodb3Okb7DgspVfEh365Qk4Feik2J3/8a/JNZN4SzESdy0dGgam+VpNOndcdVMWhy 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:(13230001)(4636009)(36840700001)(40470700004)(46966006)(81166007)(44832011)(316002)(36860700001)(8676002)(4326008)(508600001)(5660300002)(70586007)(70206006)(82310400005)(6506007)(36756003)(2616005)(26005)(6862004)(8936002)(6486002)(86362001)(2906002)(6666004)(83380400001)(186003)(356005)(47076005)(336012)(6512007)(40460700003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2022 07:26:49.9349 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7197dc2-2079-4a8e-4f14-08da43a017cd 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: DBAEUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1690 X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-List-Received-Date: Wed, 01 Jun 2022 07:26:55 -0000 The 05/31/2022 21:50, Fangrui Song wrote: > If an executable has copy relocations for extern protected data, that > can only work if the library containing the definition is built with > assumptions (a) the compiler emits GOT-generating relocations (b) the > linker produces R_*_GLOB_DAT instead of R_*_RELATIVE. Otherwise the > library uses its own definition directly and the executable accesses a > stale copy. Note: the GOT relocations defeat the purpose of protected > visibility as an optimization, but allow rtld to make the executable and > library use the same copy when copy relocations are present, but it > turns out this never worked perfectly. > > ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA has strange semantics when both > a.so and b.so define protected var and the executable copy relocates > var: b.so accesses its own copy even with GLOB_DAT. The behavior change > is from commit 62da1e3b00b51383ffa7efc89d8addda0502e107 (x86) and then > copied to nios2 (ae5eae7cfc9c4a8297ff82ec6b794faca1976ecc) and arc > (0e7d930c4c11de896fe807f67fa1eb756c9c1e05). > > Without ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA, b.so accesses the copy > relocated data like a.so. > > It's extremely unlikely anyone relies on the > ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA behavior, so let's remove it. > > -- > Changes from v1: > * Reword commit message as suggested by Szabolcs Nagy Please document the interposition change or fix it. That is important as it affects binaries without copy relocation.