This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/19826] invalid pointer returned from __tls_get_addr with static linking


https://sourceware.org/bugzilla/show_bug.cgi?id=19826

--- Comment #14 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  17af5da98cd2c9ec958421ae2108f877e0945451 (commit)
      from  444eacba82f675d4657ad55da67b355536be90ab (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=17af5da98cd2c9ec958421ae2108f877e0945451

commit 17af5da98cd2c9ec958421ae2108f877e0945451
Author: Alexandre Oliva <aoliva@redhat.com>
Date:   Wed Sep 21 22:01:16 2016 -0300

    [PR19826] fix non-LE TLS in static programs

    An earlier fix for TLS dropped early initialization of DTV entries for
    modules using static TLS, leaving it for __tls_get_addr to set them
    up.  That worked on platforms that require the GD access model to be
    relaxed to LE in the main executable, but it caused a regression on
    platforms that allow GD in the main executable, particularly in
    statically-linked programs: they use a custom __tls_get_addr that does
    not update the DTV, which fails when the DTV early initialization is
    not performed.

    In static programs, __libc_setup_tls performs the DTV initialization
    for the main thread, but the DTV of other threads is set up in
    _dl_allocate_tls_init, so that's the fix that matters.

    Restoring the initialization in the remaining functions modified by
    this patch was just for uniformity.  It's not clear that it is ever
    needed: even on platforms that allow GD in the main executable, the
    dynamically-linked version of __tls_get_addr would set up the DTV
    entries, even for static TLS modules, while updating the DTV counter.

    for  ChangeLog

        [BZ #19826]
        * elf/dl-tls.c (_dl_allocate_tls_init): Restore DTV early
        initialization of static TLS entries.
        * elf/dl-reloc.c (_dl_nothread_init_static_tls): Likewise.
        * nptl/allocatestack.c (init_one_static_tls): Likewise.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog            |    8 ++++++++
 elf/dl-reloc.c       |    6 ++++++
 elf/dl-tls.c         |    4 ++++
 nptl/allocatestack.c |    9 ++++++---
 4 files changed, 24 insertions(+), 3 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]