[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#203434: libc6: accessing thread-local storage causes SIGSEGV



On Tue, Jul 29, 2003 at 07:03:58PM -0700, Ben Liblit wrote:
> Package: libc6
> Version: 2.3.1-17
> Severity: normal
> 
> gcc-3.3.1 understands a syntax for declaring C global variables with
> thread-local storage.  Programs using this extension compile and link
> fine, but fail at run time.  As soon as a program accesses or takes
> the address of any piece of thread-local storage, the program fails
> with a segmentation fault (SIGSEGV).
> 
> To reproduce the problem, compile the following simple program.  No
> special command line flags are needed:
> 
> 	__thread int x;
> 
> 	int main()
> 	{
> 		x = 0;
> 		return 0;
> 	}
> 
> Run the program, and observe that it dies with SIGSEGV.  Taking the
> address of a variable with thread-local storage exhibits the same
> problem.
> 
> My understanding is that while GCC has to generate the right code,
> thread-local storage also requires support from the linker, run-time
> loader, and C library.  I'm reporting this against libc6 on the
> assumption that either libc itself or the loader (/lib/ld-2.3.1.so) is
> at fault.  It's possible, though, that the problem is elsewhere.
> 
> For the record, I'm also using binutils 2.14.90.0.5-0.1 and gcc 3.3-2,
> all on Debian unstable.

You are correct that our glibc has this support disabled.  A future
version will have it enabled.

However, on some architectures, including i686, I believe that it also
requires kernel support.  Hmm, reading it again perhaps that's not
true.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



Reply to: