Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1080657

Summary: [RHEL7] Can't access TLS variables in statically linked binaries
Product: Red Hat Enterprise Linux 7 Reporter: Ben Woodard <woodard>
Component: gdbAssignee: Sergio Durigan Junior <sergiodj>
Status: CLOSED ERRATA QA Contact: Miroslav Franc <mfranc>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.0CC: gdb-bugs, jan.kratochvil, mcermak, mfranc, ohudlick, tgummels
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: gdb-7.6.1-56.el7 Doc Type: Bug Fix
Doc Text:
Cause: GDB could not correctly access TLS (Thread Local Storage) data on statically linked binaries. Consequence: The user was not able to inspect TLS data on the program being debugged, if this program was linked statically. Fix: GDB now correctly accesses TLS data on statically linked binaries. Result: The user can now inspect the TLS data on a statically linked binary.
Story Points: ---
Clone Of: 1080656 Environment:
Last Closed: 2015-03-05 09:23:58 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: 1081283    
Attachments:
Description Flags
reprocer none

Description Ben Woodard 2014-03-25 21:39:09 UTC
+++ This bug was initially created as a clone of Bug #1080656 +++

Description of problem:
When you have a statically linked binary you can't access the tls data through gdb

Version-Release number of selected component (if applicable):
All. This problem exists in 6.4, 6.5, rhel7, F20 and even the upstream trunk version GDB

How reproducible:
always everywhere


Steps to Reproduce:
sierra648{jdelsign}82: gcc -g -o tls tls.c -pthread -static
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libpthread.a(libpthread.o): In function `sem_open':
(.text+0x764d): warning: the use of `mktemp' is dangerous, better use `mkstemp'
sierra648{jdelsign}83: gdb tls
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
...
Reading symbols from /g/g0/jdelsign/tls...done.
(gdb) b 12
Breakpoint 1 at 0x400511: file tls.c, line 12.
(gdb) run
Starting program: /g/g0/jdelsign/tls 
[Thread debugging using libthread_db enabled]
[New Thread 0x2aaaaacac700 (LWP 6735)]
thread_local_p: & == 00002aaaaacac6c0, . == 00002aaaaacabd1c, * == 1
[Switching to Thread 0x2aaaaacac700 (LWP 6735)]

Breakpoint 1, start_routine (arg=0x1) at tls.c:12
12        return arg;

Actual results:
(gdb) p thread_local_p
Cannot find executable file `/g/g0/jdelsign/tls' in dynamic linker's load module list

Expected results:
It print's the variable

Additional info:

Comment 1 Ben Woodard 2014-03-25 21:39:55 UTC
Created attachment 878703 [details]
reprocer

Comment 3 RHEL Program Management 2014-04-02 05:47:13 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 4 Jan Kratochvil 2014-05-18 20:15:16 UTC
[patch] Fix gdbserver qGetTLSAddr for x86_64 -m32
https://sourceware.org/ml/gdb-patches/2014-04/msg00154.html
Message-ID: <20140410114901.GA16411.net>

[patch] Fix TLS access for -static -pthread
https://sourceware.org/ml/gdb-patches/2014-04/msg00155.html
Message-ID: <20140410115204.GB16411.net>

Comment 9 errata-xmlrpc 2015-03-05 09:23:58 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://rhn.redhat.com/errata/RHBA-2015-0404.html