This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Fix a couple of multiexec races
- From: Vladimir Prus <vladimir at codesourcery dot com>
- To: Pedro Alves <pedro at codesourcery dot com>, gdb-patches at sourceware dot org
- Date: Mon, 15 Feb 2010 12:11:13 +0300
- Subject: Re: Fix a couple of multiexec races
- References: <201001131811.30403.vladimir@codesourcery.com> <201002081554.31654.pedro@codesourcery.com>
On Monday 08 February 2010 18:54:31 you wrote:
> On Wednesday 13 January 2010 15:11:30, Vladimir Prus wrote:
> >
> > The attached patch fixes a couple of glitches preventing (upcoming)
> > '-exec-run --all' from working.
> >
> > First, consider this code inside linux_nat_wait_1:
> >
> > if (lp
> > && ptid_is_pid (ptid)
> > && ptid_get_pid (lp->ptid) != ptid_get_pid (ptid))
> > {
> >
> > if (debug_linux_nat)
> > fprintf (stderr, "LWP %ld got an event %06x, leaving pending.\n",
> > ptid_get_lwp (lp->ptid), status);
> >
> > if (WIFSTOPPED (lp->status))
> > {
> > if (WSTOPSIG (lp->status) != SIGSTOP)
> > {
> > stop_callback (lp, NULL);
> >
> > /* Resume in order to collect the sigstop. */
> > ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
> >
> > stop_wait_callback (lp, NULL);
> > }
> >
> > Because lp->status is naturally not NULL when calling stop_callback, and because
> > stop_callback has:
> >
> > gdb_assert (lp->status == 0);
> >
> > if we ever enter the inner "if", GDB will crash. Offlist, Pedro suggested the inner if be
> > just removed.
>
> I thought about this some more, and I think this deserves more
> extensive fixing. See patch (and comments in it) below, which
> I've just applied.
Thanks for taking care of this!
--
Vladimir Prus
CodeSourcery
vladimir@codesourcery.com
(650) 331-3385 x722