Bug 1764214

Summary: glibc: Fix alignment of TLS variables for tls variant TLS_TCB_AT_TP
Product: Red Hat Enterprise Linux 8 Reporter: Carlos O'Donell <codonell>
Component: glibcAssignee: DJ Delorie <dj>
Status: CLOSED ERRATA QA Contact: qe-baseos-tools-bugs
Severity: unspecified Docs Contact: Oss Tikhomirova <otikhomi>
Priority: unspecified    
Version: 8.2CC: ashankar, codonell, dj, fweimer, mnewsome, otikhomi, pfrankli, skolosov
Target Milestone: rcKeywords: Patch, Triaged
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glibc-2.28-95 Doc Type: Bug Fix
Doc Text:
.Alignment of TLS variables in `glibc` has been fixed Previously, aligned thread-local storage (TLS) data could, under certain conditions, become instantiated without the expected alignment. With this update, the POSIX Thread Library `libpthread` has been enhanced to ensure correct alignment under any conditions. As a result, aligned TLS data is now correctly instantiated for all threads with the correct alignment.
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:50:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1746918    

Description Carlos O'Donell 2019-10-22 13:31:25 UTC
We need to backport the following to correct alignment of TLS variables.

commit bc79db3fd487daea36e7c130f943cfb9826a41b4
Author: Stefan Liebler <stli.com>
Date:   Wed Feb 6 09:06:34 2019 +0100

    Fix alignment of TLS variables for tls variant TLS_TCB_AT_TP [BZ #23403]
    
    The alignment of TLS variables is wrong if accessed from within a thread
    for architectures with tls variant TLS_TCB_AT_TP.
    For the main thread the static tls data is properly aligned.
    For other threads the alignment depends on the alignment of the thread
    pointer as the static tls data is located relative to this pointer.
    
    This patch adds this alignment for TLS_TCB_AT_TP variants in the same way
    as it is already done for TLS_DTV_AT_TP. The thread pointer is also already
    properly aligned if the user provides its own stack for the new thread.
    
    This patch extends the testcase nptl/tst-tls1.c in order to check the
    alignment of the tls variables and it adds a pthread_create invocation
    with a user provided stack.
    The test itself is migrated from test-skeleton.c to test-driver.c
    and the missing support functions xpthread_attr_setstack and xposix_memalign
    are added.

Please also verify upstream branch backports:

release/2.30/master - May be required. Please check.
release/2.29/master - May be required. Please check.
release/2.28/master - May be required. Please check.

Comment 2 Sergey Kolosov 2020-02-16 17:09:49 UTC
Verified with the reproducer https://sourceware.org/bugzilla/attachment.cgi?id=11121, the bug is reproduced on s390x and x86_64.

Comment 9 errata-xmlrpc 2020-04-28 16:50:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:1828