From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 8F26E38582AD for ; Thu, 2 Jun 2022 05:21:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8F26E38582AD Received: by mail-pf1-x42c.google.com with SMTP id g205so3798749pfb.11 for ; Wed, 01 Jun 2022 22:21:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=F3JjzSOQ8UzOThfFX5QYfjjx85vocVPL6BerlBCa+WE=; b=iz3xoX9rnVLy5NtLAbMTHpYCOEisCan262D3MDlfBivIXyG0gGbGs/9mvALTLW98AE LyD0K2ZT5a6qhA8e3yM1nXp4znafx+5ZibO8BbyGXa99sOemX1oiOK9ioozAADA88Pvr q710vJCrZL71x5u449km1bWtLJ78NI1iuqbLeNguw/nuvf2a7oMCs5Ad4nVF5n7/0jwE BiZtJaHHTS8RNqhSHuZR6H0j1fGRefS8iqMwx3MPZocSDVNtc9ab3kMIZOFtXCayk7k2 WVM0QjCRiUSHawroVLfhR09sQFWTfy1FJznJVLOoprrzRedVOyv16KbGRiOubYb95RoK YOdA== X-Gm-Message-State: AOAM530W8TtEF1PuGCPPH9OoZBQ2ggJ0ySFebLFm+ZTjRfizUEwd6tpW neUkvxsbjPDygtWds6fPQhUtxs2YoDaQaw== X-Google-Smtp-Source: ABdhPJyJHJSKz4lucg/WmELNbxX9xCe9Z+8ewETT7xBZUbxtjG0rIs07iOU+bDPGkFMglDyxKNKyiw== X-Received: by 2002:a65:6bce:0:b0:3f2:5f88:6f7d with SMTP id e14-20020a656bce000000b003f25f886f7dmr2744438pgw.253.1654147298320; Wed, 01 Jun 2022 22:21:38 -0700 (PDT) Received: from google.com ([2620:15c:2ce:200:54f5:789a:e4e8:6740]) by smtp.gmail.com with ESMTPSA id y22-20020aa78056000000b005183f333721sm2385352pfm.87.2022.06.01.22.21.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 22:21:37 -0700 (PDT) Date: Wed, 1 Jun 2022 22:21:34 -0700 From: Fangrui Song To: Florian Weimer Cc: Szabolcs Nagy via Libc-alpha , Szabolcs Nagy Subject: Re: [PATCH v2] elf: Remove ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA Message-ID: <20220602052134.oyvbtynjjnrm6fze@google.com> References: <20220601045033.809671-1-maskray@google.com> <20220601073423.ddyb5wuwlo6tpisk@google.com> <87leugps7q.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <87leugps7q.fsf@oldenburg.str.redhat.com> X-Spam-Status: No, score=-20.6 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL 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: Thu, 02 Jun 2022 05:21:41 -0000 On 2022-06-01, Florian Weimer wrote: >* Szabolcs Nagy via Libc-alpha: > >> but that's not true: the exe (or a shared lib) can now >> interpose a protected variable by another one with the >> same name (and no copy relocs). > >That's not desirable at all, I think. It's certainly very surprising. > >> i originally thought that warning/rejecting copy relocs in >> ld is enough to get sane behaviour for protected symbols, >> but when multiple definitions are present the behaviour >> will depend on ld's decision to use GOT or not. >> >> i think the removed logic tried to ensure that GOT relocs >> resolve to the definition within the same shared lib for >> protected data. (i.e. ld's decision does not matter.) >> >> if we want to allow ld to not use GOT then i think we need >> to keep the logic that makes GOT behave consistently with >> that future. > >I agree. I have this mental model that protected symbols behave like >-Bsymbolic. The ELF specification also seems to require that the symbol >cannot be preempted. Yes. I just send two GNU ld patches (arm and aarch64) to restore the previous behavior whether ld -shared produces RELATIVE instead of GLOB_DAT for GOT-generating relocations referencing a protected data symbol: https://sourceware.org/pipermail/binutils/2022-June/