From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 104486 invoked by alias); 14 Jul 2015 08:00:53 -0000 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 Received: (qmail 104477 invoked by uid 89); 14 Jul 2015 08:00:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f53.google.com Received: from mail-pa0-f53.google.com (HELO mail-pa0-f53.google.com) (209.85.220.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 14 Jul 2015 08:00:51 +0000 Received: by pachj5 with SMTP id hj5so1604371pac.3 for ; Tue, 14 Jul 2015 01:00:49 -0700 (PDT) X-Received: by 10.67.5.231 with SMTP id cp7mr77582636pad.36.1436860849511; Tue, 14 Jul 2015 01:00:49 -0700 (PDT) Received: from E107787-LIN (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id qt4sm321710pbc.86.2015.07.14.01.00.46 (version=TLS1_2 cipher=AES128-SHA256 bits=128/128); Tue, 14 Jul 2015 01:00:48 -0700 (PDT) From: Yao Qi To: Pedro Alves Cc: Yao Qi , gdb-patches ml Subject: Re: [PATCH v2] GDBserver crashes when killing a multi-thread process References: <510f2362-8d33-4c3c-9a13-5d187f26abdf@SVR-ORW-FEM-04.mgc.mentorg.com> <53AF87EB.60703@mentor.com> <53B3CBDB.5030207@redhat.com> <53BEAE5E.7030209@redhat.com> <55A3E23C.8020101@gmail.com> <55A3F626.7050409@redhat.com> Date: Tue, 14 Jul 2015 08:00:00 -0000 In-Reply-To: <55A3F626.7050409@redhat.com> (Pedro Alves's message of "Mon, 13 Jul 2015 18:32:22 +0100") Message-ID: <864ml7kw2g.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-07/txt/msg00388.txt.bz2 Pedro Alves 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). >>=20 > > 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=3D=3Dpid1, continue iterating > -> kill (pid1, SIGKILL); // killing wrong process > <- waitpid (pid1) returns either SIGSTOP or WSIGNALLED > ... Yes, that is possible. --=20 Yao (=E9=BD=90=E5=B0=A7)