Bug 483629

Summary: SEGV on printf a __thread variable, compiled with -fPIC
Product: Red Hat Enterprise Linux 4 Reporter: Petr Muller <pmuller>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED WONTFIX QA Contact: BaseOS QE <qe-baseos-auto>
Severity: medium Docs Contact:
Priority: low    
Version: 4.7CC: drepper, mfranc, ohudlick
Target Milestone: rc   
Target Release: ---   
Hardware: ia64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 16:11:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
original customer testcase
none
reduced testcase none

Description Petr Muller 2009-02-02 17:26:54 UTC
Description of problem:

Firstly: I'm not sure where the problem actually lies - could be glibc, could be gcc, could be invalid testcase. I'm filing this so it won't get lost in the case it's a real bug we would want to fix in RHEL4. NOTABUG is expected, but I want to be sure.

When testing bug 479630, I've encountered a SEGV on the testcase provided by customer, on something like this, if present in a shared library compiled with -fPIC:

static __thread char whatever[100];

void do_stuff(){
   printf("whatever=%p\n", whatever);
}

Because I haven't seen the SEGV on other arches, and even RHEL5 on ia64, I assumed it's a bug. I've tried to narrow down the issue, but I'm not sure if the reductio is valid, so I will append both testcases.

Version-Release number of selected component (if applicable):
gcc-3.4.6-10.ia64
glibc-2.3.4-2.41.ia64

How reproducible:
always

Steps to Reproduce (original reproducer)
1) untar the TLS.tar.gz
2) cd TLS; make
3) LD_LIBRARY_PATH=. ./ldmain

Steps to Reproduce (my reduced reproducer)
1) untar the tc.tar.gz
2) cd tc
3) make test-fpic-thread
  
Actual results:
SEGV

Expected results:
no SEGV

Comment 1 Petr Muller 2009-02-02 17:29:59 UTC
Created attachment 330652 [details]
original customer testcase

Comment 2 Petr Muller 2009-02-02 17:30:38 UTC
Created attachment 330655 [details]
reduced testcase

Comment 3 Ulrich Drepper 2009-03-16 21:26:57 UTC
This cannot possibly be a glibc problem.  The printf function expects an absolute pointer to the string.  It is the compilers job to covert the magic __thread variable access into such a pointer.  If this fails it is the compilers problem.

Comment 4 Jiri Pallich 2012-06-20 16:11:14 UTC
Thank you for submitting this issue for consideration in Red Hat Enterprise Linux. The release for which you requested us to review is now End of Life. 
Please See https://access.redhat.com/support/policy/updates/errata/

If you would like Red Hat to re-consider your feature request for an active release, please re-open the request via appropriate support channels and provide additional supporting details about the importance of this issue.