public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Fangrui Song <maskray@google.com>,
	GNU C Library <libc-alpha@sourceware.org>,
	Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Subject: Re: DT_RELR without libc.so dependency
Date: Thu, 14 Apr 2022 14:48:57 +0930	[thread overview]
Message-ID: <YleuwRhyaKDNk+SC@squeak.grove.modra.org> (raw)
In-Reply-To: <CAMe9rOqopqZZKSOVmfeSQS6eO2k5RiU7J6i3PsdkZYcpOA18gw@mail.gmail.com>

On Wed, Apr 13, 2022 at 06:54:17PM -0700, H.J. Lu wrote:
> On Wed, Apr 13, 2022 at 5:34 PM Alan Modra <amodra@gmail.com> wrote:
> >
> > On Fri, Apr 08, 2022 at 05:14:12PM -0700, Fangrui Song wrote:
> > > HJ's DT_RELR patch series has been upgraded to v7
> > > (https://patchwork.sourceware.org/project/glibc/list/?series=8295)
> > >
> > >   git-pw series apply 8295
> > >   # `Add --disable-default-dt-relr` does not apply cleanly
> > >
> > > If no regressions with default DT_RELR, that will be cool!
> >
> > I did find one error when testing a build of glibc using Ubuntu gcc-8.
> > elf/filter fails with "error while loading shared libraries:
> > .../elf/filtmod1.so: DT_RELR without GLIBC_ABI_DT_RELR dependency".
> >
> > A little analysis shows the problem occurs when filtmod1.so is linked
> > with --as-needed and libc.so is not needed.  filtmod1.so ends up with
> > no .gnu.version or .gnu.version_r sections, and of course no
> > GLIBC_ABI_DT_RELR version.
> >
> > The error check is not one that belongs in ld.so.  If you have the
> > error checking code, then you have DT_RELR support in ld.so and there
> > is no reason at all to refuse to run the program!  The check should be
> > in the linker, if anywhere.
> >
> 
> The GLIBC_ABI_DT_RELR dependency is added to avoid the random
> crush at run-time with older glibc binaries.   Since it is possible to create
> a DSO with DT_RELR, but without the libc.so dependency.   Should ld.so
> skip the GLIBC_ABI_DT_RELR check if the DSO doesn't depend on
> libc.so?

I understand why you want a dependency, but I do not see a hard
requirement for l_abi_version or any code using it.  If you try to run
a new binary with DT_RELR using an old glibc or even current glibc
without relr support, you'll get "version `GLIBC_ABI_DT_RELR' not
found".  That is sufficient, presuming there is a GLIBC_ABI_DT_RELR
version in the binary.  If there *isn't* a GLIBC_ABI_DT_RELR version
then running that binary on an older glibc probably will crash.
Putting a check in a newer ld.so doesn't help much with that, except
show up this case where the dependency isn't there.  I guess the check
is justifiable under some DL_DEBUG flag.

Lack of a dependency is either a linker bug or a relr design bug.
Nitpick: isn't the actual dependency on ld.so rather than libc.so?

-- 
Alan Modra
Australia Development Lab, IBM

  parent reply	other threads:[~2022-04-14  5:19 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-23 12:42 [PowerPC64] Use medium model toc accesses throughout Alan Modra
2022-01-24  3:47 ` [PATCH 2/5] [PowerPC64] Set up thread register for _dl_relocate_static_pie Alan Modra
2022-02-16 23:02   ` Paul E Murphy
2022-02-19  0:49     ` Alan Modra
2022-01-24  3:50 ` [PATCH 3/5] [PowerPC] Relocate stinfo->main Alan Modra
2022-01-24  4:48   ` H.J. Lu
2022-01-24  6:51     ` Alan Modra
2022-01-24  3:52 ` [PATCH 4/5] Constify a variable in dl_vdso_vsym Alan Modra
2022-01-24  4:06 ` [PATCH 5/5] Enable static-pie on powerpc64 Alan Modra
2022-01-27 18:39   ` Florian Weimer
2022-01-28  8:45     ` Alan Modra
2022-01-28 17:48 ` [PowerPC64] Use medium model toc accesses throughout Paul E Murphy
2022-01-29  1:24   ` Alan Modra
2022-02-28  6:40 ` [PATCH v2 0/4] PowerPC64 static-pie Alan Modra
2022-02-28  6:40   ` [PATCH v2 1/4] powerpc64: Use medium model toc accesses throughout Alan Modra
2022-04-08 22:28     ` Tulio Magno Quites Machado Filho
2022-02-28  6:40   ` [PATCH v2 2/4] powerpc64: Set up thread register for _dl_relocate_static_pie Alan Modra
2022-04-08 22:28     ` Tulio Magno Quites Machado Filho
2022-02-28  6:40   ` [PATCH v2 3/4] powerpc: Relocate stinfo->main Alan Modra
2022-04-08 22:32     ` Tulio Magno Quites Machado Filho
2022-02-28  6:40   ` [PATCH v2 4/4] powerpc64: Enable static-pie Alan Modra
2022-04-08 22:49     ` Tulio Magno Quites Machado Filho
2022-04-14  1:16       ` Alan Modra
2022-04-14  3:42         ` Fangrui Song
2022-04-20  7:21         ` [PATCH v3] " Alan Modra
2022-03-04 12:48   ` [PATCH v2 0/4] PowerPC64 static-pie Alan Modra
2022-04-08  8:06     ` Alan Modra
2022-04-09  0:14       ` Fangrui Song
2022-04-14  0:33         ` Alan Modra
2022-04-14  1:54           ` DT_RELR without libc.so dependency H.J. Lu
2022-04-14  3:43             ` Fangrui Song
2022-04-14  5:18             ` Alan Modra [this message]
2022-04-14 17:55               ` H.J. Lu
2022-04-08 22:27   ` [PATCH v2 0/4] PowerPC64 static-pie Tulio Magno Quites Machado Filho
2022-04-11  1:38     ` Alan Modra

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=YleuwRhyaKDNk+SC@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=maskray@google.com \
    --cc=tuliom@linux.ibm.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).