This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Fix TLS access for -static -pthread
- From: Pedro Alves <palves at redhat dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>, Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org, Sergio Durigan Junior <sergiodj at redhat dot com>
- Date: Thu, 05 Jun 2014 16:17:41 +0100
- Subject: Re: [patch] Fix TLS access for -static -pthread
- Authentication-results: sourceware.org; auth=none
- References: <20140410115204 dot GB16411 at host2 dot jankratochvil dot net> <539018F9 dot 5060307 at codesourcery dot com> <20140605080639 dot GA32146 at host2 dot jankratochvil dot net>
On 06/05/2014 09:06 AM, Jan Kratochvil wrote:
> On Thu, 05 Jun 2014 09:15:05 +0200, Yao Qi wrote:
> [...]
>> thread 1^M
>> [Switching to thread 1 (Thread 5784)]^M
>> #0 clone () at ../ports/sysdeps/unix/sysv/linux/arm/nptl/../clone.S:62^M
>> 62 cmp r0, #0^M
>> (gdb) PASS: gdb.threads/staticthreads.exp: thread 1
>> up 10^M
>> #2 0xbe8ea7e4 in ?? ()^M
>> (gdb) FAIL: gdb.threads/staticthreads.exp: up 10
It'd be nice if this was reported to glibc upstream.
> This is a bug of unwinding clone() at this PC. IIRC even x86_64 has this or
> similar CFI bug, though.
I think it's fixed. It works here on f20:
(gdb) bt
#0 thread_function0 (arg=0x0) at threads.c:63
#1 0x000000373c807f33 in start_thread (arg=0x7ffff7fc6700) at pthread_create.c:309
#2 0x000000373bcf4ded in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb)
It seems this bug ends up easily happening on new ports:
https://sourceware.org/ml/libc-ports/2012-05/msg00068.html
https://sourceware.org/ml/libc-alpha/2014-01/msg00337.html
Sounds like nobody has a test to catch this. Assuming glibc's
backtrace() makes use of CFI, glibc itself could have one.
But maybe we should be have it too - a GNU/Linux specific,
but arch-independent test that makes sure a backtrace in a thread
always stops at clone. Likewise for catching bogus frames beyond
'_start' in the main thread (with "set backtrace past-main on").
--
Pedro Alves