This is the mail archive of the 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 malloc/17730] thread-local storage is sometimes improperly free()'d after being __libc_memalign()'d

--- Comment #8 from cvs-commit at gcc dot <cvs-commit at gcc dot> ---
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  6c444ad6e953dbdf9c7be065308a0a7779d32bb2 (commit)
       via  a2ff21f825adb8821eeb6145197fa8b9a8a60a58 (commit)
      from  5bc17330eb7667b96fee8baf3729c3310fa28b40 (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 -----------------------------------------------------------------;h=6c444ad6e953dbdf9c7be065308a0a7779d32bb2

commit 6c444ad6e953dbdf9c7be065308a0a7779d32bb2
Author: Florian Weimer <>
Date:   Wed Aug 3 16:16:57 2016 +0200

    elf: Do not use memalign for TCB/TLS blocks allocation [BZ #17730]

    Instead, call malloc and explicitly align the pointer.

    There is no external location to store the original (unaligned)
    pointer, and this commit increases the allocation size to store
    the pointer at a fixed location relative to the TCB pointer.

    The manual alignment means that some space goes unused which
    was previously made available for subsequent allocations.
    However, in the TLS_DTV_AT_TP case, the manual alignment code
    avoids aligning the pre-TCB to the TLS block alignment.  (Even
    while using memalign, the allocation had some unused padding
    in front.)

    This concludes the removal of memalign calls from the TLS code,
    and the new tst-tls3-malloc test verifies that only core malloc
    routines are used.;h=a2ff21f825adb8821eeb6145197fa8b9a8a60a58

commit a2ff21f825adb8821eeb6145197fa8b9a8a60a58
Author: Florian Weimer <>
Date:   Wed Aug 3 16:15:38 2016 +0200

    elf: Avoid using memalign for TLS allocations [BZ #17730]

    Instead of a flag which indicates the pointer can be freed, dtv_t
    now includes the pointer which should be freed.  Due to padding,
    the size of dtv_t does not increase.

    To avoid using memalign, the new allocate_dtv_entry function
    allocates a sufficiently large buffer so that a sub-buffer
    can be found in it which starts with an aligned pointer.  Both
    the aligned and original pointers are kept, the latter for calling
    free later.


Summary of changes:
 ChangeLog                |   37 ++++++++++
 csu/libc-tls.c           |    2 +-
 elf/dl-tls.c             |  164 ++++++++++++++++++++++++++-----------------
 nptl/Makefile            |    8 ++-
 nptl/allocatestack.c     |    4 +-
 nptl/tst-tls3-malloc.c   |  176 ++++++++++++++++++++++++++++++++++++++++++++++
 sysdeps/generic/dl-dtv.h |   12 ++--
 7 files changed, 327 insertions(+), 76 deletions(-)
 create mode 100644 nptl/tst-tls3-malloc.c

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]