public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] elf: Support at least 32-byte alignment in static dlopen
@ 2020-07-12 15:55 Florian Weimer
  0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2020-07-12 15:55 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=48699da1c468543ade14777819bd1b4d652709de

commit 48699da1c468543ade14777819bd1b4d652709de
Author: Florian Weimer <fweimer@redhat.com>
Date:   Sun Jul 12 17:53:58 2020 +0200

    elf: Support at least 32-byte alignment in static dlopen
    
    Otherwise loading a dynamically linked libc with rseq support fails,
    as result of the __rseq_abi TLS variable, which has an alignment
    of 32 bytes.
    
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
    Tested-by: Vineet Gupta <vgupta@synopsys.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Tested-by: Alistair Francis <alistair.francis@wdc.com>

Diff:
---
 csu/libc-tls.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/csu/libc-tls.c b/csu/libc-tls.c
index 06e76bd395..3f1655f264 100644
--- a/csu/libc-tls.c
+++ b/csu/libc-tls.c
@@ -112,6 +112,12 @@ __libc_setup_tls (void)
   size_t tcb_offset;
   const ElfW(Phdr) *phdr;
 
+  /* libc.so with rseq has TLS with 32-byte alignment.  Static dlopen
+     requires at least 32-byte alignment as well, otherwise loading
+     libc.so will always fail.  */
+  if (max_align < 32)
+    max_align = 32;
+
   struct link_map *main_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
 
   /* Look through the TLS segment if there is any.  */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-12 15:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-12 15:55 [glibc] elf: Support at least 32-byte alignment in static dlopen Florian Weimer

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).