public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "Fāng-ruì Sòng" <maskray@google.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
	GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] elf: Add elf checks for main executable
Date: Mon, 13 Dec 2021 16:17:42 -0800	[thread overview]
Message-ID: <20211214001742.lbleuljd2dgmfinx@google.com> (raw)
In-Reply-To: <871r2nmmaf.fsf@oldenburg.str.redhat.com>


On 2021-12-08, Florian Weimer wrote:
>* Fāng-ruì Sòng:
>
>> On Tue, Dec 7, 2021 at 12:35 PM Adhemerval Zanella via Libc-alpha
>> <libc-alpha@sourceware.org> wrote:
>>>
>>>
>>>
>>> On 07/12/2021 12:45, Florian Weimer wrote:
>>> > * Adhemerval Zanella:
>>> >
>>> >> It does, but only for specific configurations.  bintutils does have a
>>> >> testcase for it, pr21375*, but not all configurations does bump because
>>> >> they do not require ABS relocations (for instance, for n64 -mmicromips
>>> >> --defsym hidn=1 does set the ABI version to 4).
>>> >
>>> > Should this tell us something at DT_RELR?  That binutils doesn't help us
>>> > to prevent crashes for other features?
>>>
>>> I think it tell us that binutils support for DT_RELR or any other potential
>>> abi disruptive feature will need a better ABI enforce for all Linux or
>>> affected ABI.  It seems that binutils support are not really unified with
>>> the multiples architectures and ABI.
>>>
>>> But I think it should be doable on linker side.
>>
>> For DT_RELR, you may see
>> https://maskray.me/blog/2021-10-31-relative-relocations-and-relr#ei_abiversion
>> Many Linux executables (STB_GNU_UNIQUE/STT_GNU_IFUNC are not used) use
>> ELFOSABI_NONE and the linker does not and should not bump
>> EI_ABIVERSION.

I was out-of-town for ~10 days. So sorry that I did not reply in time.

>That radare2 command is really confusing.  It changes the ABI version to
>16.  It does not change OSABI to GNU.

Thanks. I clarified my wording and added
"For ELFOSABI_GNU (r2 -nwqc 'wx 03 @ 7'), changing EI_ABIVERSION to 4 or
above will observe the failure with ld.so mapped objects but not with kernel
mapped objects."

>So I think we actually agree on the ld behavior, that the
>OSABI/ABIVERSION is not really used by binutils today.

Agree that OSABI/ABIVERSION is not enforced in the linker.

>One question I meant to ask you: If the GNU toolchain uses any mechanism
>for lockout of older glibc, would Google start building binaries using
>that mechanism and patch their glibc forks that implement DT_RELR to be
>able to load binaries with the lockout?

For ChromeOS patched glibc, I can forward the question to ChromeOS
toolchain folks. Actually the code review is open to the public and you
can comment on
https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/3320511

I think their viewpoint is similar to the Gentoo developer:
https://sourceware.org/pipermail/libc-alpha/2021-November/133388.html
If a group chooses a non-default feature, they need to understand the
implications and they cannot blame the upstream if porting the binary to
old systems would crash.

If the question is: "if upstream glibc implements the diagnostic, will
ChromeOS port the patch to their glibc".  My reply is non-authoritative,
but if this has not been a problem for more than 3 years now, I do know
see large value backporting the feature to their older glibc release.

If the question is to Google internal systems, such a diagnostic would
have a low value as production systems try hard not to have the
mismatching version problem (which is probably common on Linux desktops).
I believe many corporate users will share similar viewpoint.
They may control their production systems in such a way that running
a new executable on an old glibc is either impossible, or can be detected
with other means, so a built-in glibc diagnostic is not that useful.

While I am replying with my corporate email address (because I subscribe
to this list with it), I also need to speak up for other customers I
support as my non-work-related community duty (Android, Fuchsia,
FreeBSD, etc). For Android and Fuchsia, they have the feature for ~3
years now, while I think (running on an old system) is explicitly
unsupported for them, having a ld.so diagnostic (well, they use their
own libc implementations) at this point is definitely nearly useless.
For *BSD, I have heard multiple people saying something in line with
"this is a Linux problem. They'd not add new knobs to the toolchain".

  reply	other threads:[~2021-12-14  0:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19 15:03 Adhemerval Zanella
2021-11-19 15:33 ` H.J. Lu
2021-11-19 16:05   ` H.J. Lu
2021-11-19 17:06     ` Adhemerval Zanella
2021-12-06 19:03 ` H.J. Lu
2021-12-06 19:09 ` Florian Weimer
2021-12-06 19:22   ` H.J. Lu
2021-12-06 20:31     ` Adhemerval Zanella
2021-12-06 20:37       ` Florian Weimer
2021-12-06 21:07         ` Adhemerval Zanella
2021-12-07 15:45           ` Florian Weimer
2021-12-07 17:35             ` Adhemerval Zanella
2021-12-08  0:01               ` Fāng-ruì Sòng
2021-12-08 10:19                 ` Florian Weimer
2021-12-14  0:17                   ` Fāng-ruì Sòng [this message]
2021-12-14  9:03                     ` Florian Weimer
2021-12-14  9:09                       ` Fāng-ruì Sòng
2021-12-14  9:18                         ` Florian Weimer
2021-12-14 19:03                           ` Fangrui Song
2021-12-14 12:28                         ` Adhemerval Zanella
2021-12-14 12:23                       ` Adhemerval Zanella
2021-12-14 19:24                         ` Fangrui Song
2021-12-14 21:07                           ` Adhemerval Zanella
2021-12-14 21:30                             ` Fangrui Song
2021-12-14 21:53                               ` Florian Weimer
2021-12-14 23:08                                 ` 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=20211214001742.lbleuljd2dgmfinx@google.com \
    --to=maskray@google.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /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).