[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87o8oy9dqe.fsf@oldenburg2.str.redhat.com>
Date: Thu, 02 Jul 2020 16:46:17 +0200
From: Florian Weimer <fweimer@...hat.com>
To: Mathieu Desnoyers via Libc-alpha <libc-alpha@...rceware.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Rich Felker <dalias@...c.org>, linux-api@...r.kernel.org,
Boqun Feng <boqun.feng@...il.com>,
Will Deacon <will.deacon@....com>,
linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Ben Maurer <bmaurer@...com>, Dave Watson <davejwatson@...com>,
Thomas Gleixner <tglx@...utronix.de>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Paul Turner <pjt@...gle.com>,
Joseph Myers <joseph@...esourcery.com>,
Carlos O'Donell <carlos@...hat.com>
Subject: Re: [PATCH 1/3] glibc: Perform rseq registration at C startup and thread creation (v22)
* Mathieu Desnoyers via Libc-alpha:
> Register rseq TLS for each thread (including main), and unregister for
> each thread (excluding main). "rseq" stands for Restartable Sequences.
>
> See the rseq(2) man page proposed here:
> https://lkml.org/lkml/2018/9/19/647
>
> Those are based on glibc master branch commit 3ee1e0ec5c.
> The rseq system call was merged into Linux 4.18.
>
> The TLS_STATIC_SURPLUS define is increased to leave additional room for
> dlopen'd initial-exec TLS, which keeps elf/tst-auditmany working.
>
> The increase (76 bytes) is larger than 32 bytes because it has not been
> increased in quite a while. The cost in terms of additional TLS storage
> is quite significant, but it will also obscure some initial-exec-related
> dlopen failures.
We need another change to get this working on most non-x86
architectures:
diff --git a/elf/dl-tls.c b/elf/dl-tls.c
index 817bcbbf59..ca13778ca9 100644
--- a/elf/dl-tls.c
+++ b/elf/dl-tls.c
@@ -134,6 +134,12 @@ void
_dl_determine_tlsoffset (void)
{
size_t max_align = TLS_TCB_ALIGN;
+ /* libc.so with rseq has TLS with 32-byte alignment. Since TLS is
+ initialized before audit modules are loaded and slotinfo
+ information is available, this is not taken into account below in
+ the audit case. */
+ max_align = MAX (max_align, 32U);
+
size_t freetop = 0;
size_t freebottom = 0;
This isn't visible on x86-64 because TLS_TCB_ALIGN is already 64 there.
I plan to re-test with this fix and push the series.
Carlos, is it okay if I fold in the dl-tls.c change if testing looks
good?
Thanks,
Florian
Powered by blists - more mailing lists