From: Florian Weimer <fweimer@redhat.com>
To: Mathieu Desnoyers via Libc-alpha <libc-alpha@sourceware.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Rich Felker <dalias@libc.org>,
linux-api@vger.kernel.org, Boqun Feng <boqun.feng@gmail.com>,
Will Deacon <will.deacon@arm.com>,
linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Ben Maurer <bmaurer@fb.com>, Dave Watson <davejwatson@fb.com>,
Thomas Gleixner <tglx@linutronix.de>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Paul Turner <pjt@google.com>,
Joseph Myers <joseph@codesourcery.com>,
Carlos O'Donell <carlos@redhat.com>
Subject: Re: [PATCH 1/3] glibc: Perform rseq registration at C startup and thread creation (v22)
Date: Thu, 02 Jul 2020 16:46:17 +0200 [thread overview]
Message-ID: <87o8oy9dqe.fsf@oldenburg2.str.redhat.com> (raw)
In-Reply-To: <20200629190036.26982-2-mathieu.desnoyers@efficios.com> (Mathieu Desnoyers via Libc-alpha's message of "Mon, 29 Jun 2020 15:00:34 -0400")
* 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
next prev parent reply other threads:[~2020-07-02 14:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200629190036.26982-1-mathieu.desnoyers@efficios.com>
2020-06-29 19:00 ` [PATCH 1/3] glibc: Perform rseq registration at C startup and thread creation (v22) Mathieu Desnoyers
2020-07-02 14:46 ` Florian Weimer [this message]
2020-07-03 17:50 ` Carlos O'Donell
2020-06-29 19:00 ` [PATCH 2/3] Linux: Use rseq in sched_getcpu if available (v9) Mathieu Desnoyers
2020-07-06 13:59 ` Florian Weimer
2020-07-06 14:49 ` Mathieu Desnoyers
2020-07-06 17:33 ` Mathieu Desnoyers
2020-07-06 17:50 ` Florian Weimer
2020-07-06 18:02 ` Mathieu Desnoyers
2020-07-06 18:11 ` Florian Weimer
2020-07-06 21:08 ` Mathieu Desnoyers
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=87o8oy9dqe.fsf@oldenburg2.str.redhat.com \
--to=fweimer@redhat.com \
--cc=bmaurer@fb.com \
--cc=boqun.feng@gmail.com \
--cc=carlos@redhat.com \
--cc=dalias@libc.org \
--cc=davejwatson@fb.com \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=tglx@linutronix.de \
--cc=will.deacon@arm.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 NNTP newsgroup(s).