This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Fix linux-nat.c new_lp dropped status
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Date: Tue, 20 Jul 2010 13:46:20 +0100
- Subject: Re: [patch] Fix linux-nat.c new_lp dropped status
- References: <20100718220853.GA3011@host1.dyn.jankratochvil.net>
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