[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Undefined use of weak symbols in gnulib
From: |
Florian Weimer |
Subject: |
Re: Undefined use of weak symbols in gnulib |
Date: |
Wed, 28 Apr 2021 19:43:39 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
* Bruno Haible:
> So, in the normal cases (link with '-lpthread', link without '-lpthread',
> and even with dlopen()), everything will work fine. The only problematic
> case thus is the the use of LD_PRELOAD. Right?
LD_PRELOAD and glibc 2.34 as originally planned.
> I think few packages in a distro will be affected. And few users are
> using LD_PRELOAD on their own, because since the time when glibc
> started to use 'internal' calls to system calls where possible, there
> are not a lot of uses of LD_PRELOAD that still work.
We get the occasional bug report when these things break. We have not
seen much of that yet because our gnulib-using programs are still at
older versions for most of our users.
Here's an example of such a bug report, although not for libpthread:
powerpc: libc segfaults when LD_PRELOADed with libgcc
<https://sourceware.org/bugzilla/show_bug.cgi?id=26615>
I think in this bug, libc.so.6 was invoked during some build process
(which could easily run bison as well, so it has to work with
LD_PRELOAD).
>> No. glibc 2.34 will behave as if an implicit -lpthread is present on
>> the linker program line.
>
> Good. This means a bullet-proof way for a distro to avoid the problem
> is to "rebuild the world" after importing glibc 2.34.
Yeah, but that's not good enough. So I spent today on coming up with a
workaround in glibc.
>> No, it's unrelated. The crash or other undefined behavior is a
>> consequence of actions of the link editor and cannot be reverted at run
>> time.
>
> In other words, the problem is that
> - there are some/many binaries out there, that were produced by an 'ld'
> that did not anticipate the changes in glibc 2.34, and
> - these binaries have a problem not when run directly, but only when
> run with LD_PRELOAD.
>
> Right?
No, glibc 2.34 won't need LD_PRELOAD to expose the bug. LD_PRELOAD is
just a development aid that reveals the problem with glibc 2.33 and
earlier.
Thanks,
Florian
Re: Undefined use of weak symbols in gnulib, Bruno Haible, 2021/04/27
Re: Undefined use of weak symbols in gnulib, Bruno Haible, 2021/04/27
Re: Undefined use of weak symbols in gnulib, Ben Pfaff, 2021/04/29