[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lhuect8sol1.fsf@oldenburg.str.redhat.com>
Date: Mon, 18 Aug 2025 16:15:38 +0200
From: Florian Weimer <fweimer@...hat.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Jens Axboe <axboe@...nel.dk>, LKML <linux-kernel@...r.kernel.org>,
Michael Jeanson <mjeanson@...icios.com>, Mathieu Desnoyers
<mathieu.desnoyers@...icios.com>, Peter Zijlstra <peterz@...radead.org>,
"Paul E. McKenney" <paulmck@...nel.org>, Boqun Feng
<boqun.feng@...il.com>, Wei Liu <wei.liu@...nel.org>, Sean
Christopherson <seanjc@...gle.com>, Samuel Thibault
<sthibault@...ian.org>
Subject: Re: BUG: rseq selftests and librseq vs. glibc fail
* Thomas Gleixner:
> On Sun, Aug 17 2025 at 23:23, Thomas Gleixner wrote:
>> It survives the self test suite after I wasted a day to figure out why
>> the selftests reliably segfault on a machine which has debian trixie
>> installed. The fix is in the branch.
>
> That's glibc 2.41 FWIW. glibc 2.36 from Debian 12 does not have this
> problem.
>
> The fix unfortunately only works with a dynamically linked libc,
> statically linked libc fails. The fix is basically a revert of
>
> 3bcbc20942db ("selftests/rseq: Play nice with binaries statically linked
> against glibc 2.35+")
>
> which introduced these weak libc symbols to make static libc linking work.
>
> I have no idea why this creates havoc, but in GDB I saw that libc
> manages to overwrite the TLS of the pthread at some place, but I gave up
> decoding it further. If no pthread is created it just works. Removing
> this weak muck makes it work too.
>
> It's trivial to reproduce. All it needs is to have in the source:
>
> __weak ptrdiff_t __rseq_offset;
>
> w/o even being referenced and creating a pthread. Reproducer below.
Well, that's sort of expected. You can't define glibc symbols that are
not intended for interposition and expect things to work. It's kind of
like writing:
int _rtld_global;
That's going to fail rather spectaculary, too. We make an exception for
symbols that are not reserved (you can build in ISO C mode and define
open, close, etc., at least as long as you link to glibc only). But
__rseq_offset is a reserved name, so that is not applicable here.
The real change here is GCC changing from -fcommon (which made a lot of
these things work in the past) to -fno-common.
Thanks,
Florian
Powered by blists - more mailing lists