From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4668 invoked by alias); 5 Jun 2014 15:18:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 4652 invoked by uid 89); 5 Jun 2014 15:18:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Jun 2014 15:17:47 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s55FHigD012336 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 5 Jun 2014 11:17:44 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s55FHfFb023361; Thu, 5 Jun 2014 11:17:42 -0400 Message-ID: <53908A15.8000501@redhat.com> Date: Thu, 05 Jun 2014 15:18:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Jan Kratochvil , Yao Qi CC: gdb-patches@sourceware.org, Sergio Durigan Junior Subject: Re: [patch] Fix TLS access for -static -pthread References: <20140410115204.GB16411@host2.jankratochvil.net> <539018F9.5060307@codesourcery.com> <20140605080639.GA32146@host2.jankratochvil.net> In-Reply-To: <20140605080639.GA32146@host2.jankratochvil.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-06/txt/msg00266.txt.bz2 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