From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 43554 invoked by alias); 29 Sep 2017 12:24:47 -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 42727 invoked by uid 89); 29 Sep 2017 12:24:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=weren't, werent, occasional, FYI 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; Fri, 29 Sep 2017 12:24:45 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EB1625F795 for ; Fri, 29 Sep 2017 12:24:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EB1625F795 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30C6660600; Fri, 29 Sep 2017 12:24:42 +0000 (UTC) Subject: Re: [PATCH v4 5/7] Add thread_db_notice_clone to gdbserver To: Kevin Buettner , gdb-patches@sourceware.org References: <20170816092542.6d2deb00@pinnacle.lan> <20170816104143.0af5d91a@pinnacle.lan> From: Pedro Alves Message-ID: <133e7d06-cda7-cd0b-aba8-0e91b16f52ba@redhat.com> Date: Fri, 29 Sep 2017 12:24:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20170816104143.0af5d91a@pinnacle.lan> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-09/txt/msg00905.txt.bz2 On 08/16/2017 06:41 PM, Kevin Buettner wrote: > While working on a patch for fetching a thread handle in gdbserver, I > ran into a circumstance in which tests in gdb.mi/mi-nsmoribund.exp > would occasionally fail. Over a large enough number of runs, it would > fail roughly 2% of the time. > > That thread handle patch caused find_one_thread() to be called on > every stop. find_one_thread() calls td_ta_map_lwp2thr() which, in > turn, can cause ps_get_thread_area() to be called. > ps_get_thread_area() makes a call to ptrace() for getting the thread > area address. If this should happen when the thread is not stopped, > the call to ptrace will return error which in turn propogates back to > find_one_thread(). find_one_thread() calls error() in this instance > which causes the program to die. > > This patch causes find_one_thread() to be called upon reciept of a > clone event. Since the clone is stopped, the circumstances described > above cannot occur. > FYI, issues like the described above still happened with the patch as it was. While both parent/child are stopped, we weren't making sure that one of parent/child is the current thread. That lead to libthread_db -> proc-service trying to access memory from a running or non-existing thread. For me that resulted in occasional gdb.threads/multi-create-ns-info-thr.exp failures. The gdbserver buildslaves have been reporting the same regression too, e.g.: https://sourceware.org/ml/gdb-testers/2017-q3/msg05653.html Should be fixed now, with: https://sourceware.org/ml/gdb-patches/2017-09/msg00903.html https://sourceware.org/ml/gdb-patches/2017-09/msg00904.html Thanks, Pedro Alves