Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] Fix linux-nat.c new_lp dropped status
Date: Sun, 18 Jul 2010 22:09:00 -0000	[thread overview]
Message-ID: <20100718220853.GA3011@host1.dyn.jankratochvil.net> (raw)

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.

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,


             reply	other threads:[~2010-07-18 22:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-18 22:09 Jan Kratochvil [this message]
2010-07-20 12:46 ` Pedro Alves
2010-07-20 12:56   ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100718220853.GA3011@host1.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox