Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: Pedro Alves <palves@redhat.com>
Cc: Yao Qi <qiyaoltc@gmail.com>,
	 gdb-patches ml <gdb-patches@sourceware.org>
Subject: Re: [PATCH v2] GDBserver crashes when killing a multi-thread process
Date: Tue, 14 Jul 2015 08:00:00 -0000	[thread overview]
Message-ID: <864ml7kw2g.fsf@gmail.com> (raw)
In-Reply-To: <55A3F626.7050409@redhat.com> (Pedro Alves's message of "Mon, 13	Jul 2015 18:32:22 +0100")

Pedro Alves <palves@redhat.com> writes:

> Looks like I forgot to push the rest of that series:
>
>  https://sourceware.org/ml/gdb-patches/2015-03/msg00182.html
>
> What do you think of that one?

Yes, it looks good to me.  We also need it on 7.10 branch.

>
>> Why don't we implement kill_wait_lwp like its counterpart in GDB
>> linux-nat.c:kill_wait_callback? we can loop and assert like this
>> patch below, (note that this patch fixes the internal error, and
>> the FAIL is still there).
>> 
>
> Seems to me it's not 100% correct to waitpid the pid one more time
> after we've already reaped it, because there's a minuscule chance
> another process that we're debugging could clone a new lwp that reuses
> the PID of the one we've just killed/reaped, and then another iteration
> could collect the initial SIGSTOP of the wrong LWP and we'd kill it:
>
> -> kill (pid1, SIGKILL);
> <- waitpid (pid1) returns pid1/WSIGNALLED
> -> on iteration1: new pid1 clone lwp is spawned
> -> ret==pid1, continue iterating
> -> kill (pid1, SIGKILL); // killing wrong process
> <- waitpid (pid1) returns either SIGSTOP or WSIGNALLED
> ...

Yes, that is possible.

-- 
Yao (齐尧)


  reply	other threads:[~2015-07-14  8:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-23 10:10 [PATCH] Fix crash of gdbserver when kill threads Hui Zhu
2014-06-29  3:28 ` Hui Zhu
2014-07-02  9:07   ` Pedro Alves
2014-07-10 15:17     ` [PATCH v2] GDBserver crashes when killing a multi-thread process Pedro Alves
2014-07-11  8:21       ` Hui Zhu
2014-07-11 10:53         ` [PUSHED+7.8] " Pedro Alves
2015-07-13 16:07       ` Yao Qi
2015-07-13 17:32         ` Pedro Alves
2015-07-14  8:00           ` Yao Qi [this message]
2015-07-14  9:13             ` Pedro Alves

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=864ml7kw2g.fsf@gmail.com \
    --to=qiyaoltc@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /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