From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29771 invoked by alias); 14 Jan 2013 15:46:03 -0000 Received: (qmail 29762 invoked by uid 22791); 14 Jan 2013 15:46:02 -0000 X-SWARE-Spam-Status: No, hits=-7.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Jan 2013 15:45:58 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0EFjucF028063 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 14 Jan 2013 10:45:57 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r0EFjsZg030557; Mon, 14 Jan 2013 10:45:55 -0500 Message-ID: <50F42832.9030700@redhat.com> Date: Mon, 14 Jan 2013 15:46:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: "Bilal, Muhammad" CC: "gdb-patches@sourceware.org" Subject: Re: [PATCH]13217 thread apply all detach throws a SEGFAULT References: <97B73E257CC18646B0B5D3DD77DCBDD158E8FD@EU-MBX-02.mgc.mentorg.com> <97B73E257CC18646B0B5D3DD77DCBDD158EBC9@EU-MBX-02.mgc.mentorg.com> In-Reply-To: <97B73E257CC18646B0B5D3DD77DCBDD158EBC9@EU-MBX-02.mgc.mentorg.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 X-SW-Source: 2013-01/txt/msg00277.txt.bz2 Hi Bilal, The problem with this fix is that it handles one specific crash, but is not a complete fix, as it still leaves undefined behavior in place, which may well manifest in similar crashes, or worse, random corruption. The issue is that the command applies to each thread may not remove _all_ threads (as detected by your patch), but cause the currently iterated thread to exit, and thus, (at least) this "tp->next" reference: for (tp = thread_list; tp; tp = tp->next) ^^^^^^^^^^^^^ if (thread_alive (tp)) Please coordinate with Ali Anwar @ Mentor. He was working on this issue a couple months back, and posted a more complete patch, though review showed some more work was necessary. -- Pedro Alves