public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Fangrui Song <maskray@google.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: Szabolcs Nagy via Libc-alpha <libc-alpha@sourceware.org>,
	Szabolcs Nagy <szabolcs.nagy@arm.com>
Subject: Re: [PATCH v2] elf: Remove ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA
Date: Wed, 1 Jun 2022 22:21:34 -0700	[thread overview]
Message-ID: <20220602052134.oyvbtynjjnrm6fze@google.com> (raw)
In-Reply-To: <87leugps7q.fsf@oldenburg.str.redhat.com>

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/

  reply	other threads:[~2022-06-02  5:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01  4:50 Fangrui Song
2022-06-01  7:26 ` Szabolcs Nagy
2022-06-01  7:34   ` Fangrui Song
2022-06-01  9:53     ` Szabolcs Nagy
2022-06-01 10:56       ` Florian Weimer
2022-06-02  5:21         ` Fangrui Song [this message]
2022-06-01 17:56       ` [PATCH v3] " Fangrui Song
2022-06-07 13:24         ` Szabolcs Nagy
2022-06-07 17:49           ` Fangrui Song
2022-06-08  9:15             ` Szabolcs Nagy
2022-06-08 17:16               ` Fangrui Song
2022-06-09  8:12                 ` Szabolcs Nagy
2022-06-07 17:49           ` H.J. Lu
2022-06-07 18:21             ` Fangrui Song
2022-06-07 19:21               ` H.J. Lu
2022-06-07 20:00                 ` Fangrui Song
2022-06-07 21:02                   ` H.J. Lu
2022-06-07 23:57                     ` Fangrui Song
2022-06-08  1:51                       ` H.J. Lu
2022-06-08  3:42                         ` Fangrui Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220602052134.oyvbtynjjnrm6fze@google.com \
    --to=maskray@google.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=szabolcs.nagy@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).