From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1534 invoked by alias); 20 Jul 2010 12:46:32 -0000 Received: (qmail 1525 invoked by uid 22791); 20 Jul 2010 12:46:31 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 20 Jul 2010 12:46:25 +0000 Received: (qmail 26050 invoked from network); 20 Jul 2010 12:46:23 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 20 Jul 2010 12:46:23 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [patch] Fix linux-nat.c new_lp dropped status Date: Tue, 20 Jul 2010 12:46:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.31-11-rt; KDE/4.4.2; x86_64; ; ) Cc: Jan Kratochvil References: <20100718220853.GA3011@host1.dyn.jankratochvil.net> In-Reply-To: <20100718220853.GA3011@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201007201346.21224.pedro@codesourcery.com> X-IsSubscribed: yes 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: 2010-07/txt/msg00296.txt.bz2 On Sunday 18 July 2010 23:08:53, Jan Kratochvil wrote: > Hi, > > while reading the code it seems to me it can drop non-SIGSTOP status in this > case. It can happen only during some racy case while creating a thread, > I have not tried to exploit it. > > Does the patch make sense? I have no dependency on it, I just have seen it. It does to me. Okay, thanks. > > No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu. > > > Thanks, > Jan > > > --- a/gdb/linux-nat.c > +++ b/gdb/linux-nat.c > @@ -2288,6 +2288,23 @@ linux_handle_extended_wait (struct lwp_info *lp, int status, > linux_ops->to_resume (linux_ops, pid_to_ptid (new_pid), > 0, signo); > } > + else > + { > + if (status != 0) > + { > + /* We created NEW_LP so it cannot yet contain STATUS. */ > + gdb_assert (new_lp->status == 0); > + > + /* Save the wait status to report later. */ > + if (debug_linux_nat) > + fprintf_unfiltered (gdb_stdlog, > + "LHEW: waitpid of new LWP %ld, " > + "saving status %s\n", > + (long) GET_LWP (new_lp->ptid), > + status_to_str (status)); > + new_lp->status = status; > + } > + } > > if (debug_linux_nat) > fprintf_unfiltered (gdb_stdlog, > -- Pedro Alves