From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5440 invoked by alias); 16 Mar 2014 13:59:23 -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 5428 invoked by uid 89); 16 Mar 2014 13:59:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 16 Mar 2014 13:59:20 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2GDxJBg020309 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 16 Mar 2014 09:59:19 -0400 Received: from host2.jankratochvil.net (ovpn-116-86.ams2.redhat.com [10.36.116.86]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s2GDxGKh029043 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Sun, 16 Mar 2014 09:59:18 -0400 Date: Sun, 16 Mar 2014 13:59:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] linux_nat_kill() compat. with linux-2.4.x Message-ID: <20140316135916.GA31463@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2014-03/txt/msg00351.txt.bz2 Hi, it had been already approved by Tom that time so I will check it in in some time. [patch] Fix SIGTERM signal safety (PR gdb/15358) https://sourceware.org/ml/gdb-patches/2013-07/msg00094.html Message-ID: <20130702200010.GA23478@host2.jankratochvil.net> Doug has just asked to split it out of: Re: [patchv2] Fix SIGTERM signal safety (PR gdb/15358) [refresh] https://sourceware.org/ml/gdb-patches/2014-03/msg00342.html Message-ID: <21284.44419.745786.47756@ruffy.mtv.corp.google.com> The testcase of the patch above still PASSes for me on Fedora 20 x86_64 even without this patch, I guess this patch was needed only on that 2.4.x Linux kernel it mentions. I am no longer interested in 2.4.x so if anyone has any concerns I am also fine with dropping this patch. Thanks, Jan gdb/ 2014-03-16 Jan Kratochvil PR gdb/15358 * linux-nat.c (linux_nat_kill): Use kill_callback first. Extend the comment for stop_callback. diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index b615423..ec84188 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -3777,8 +3777,15 @@ linux_nat_kill (struct target_ops *ops) { ptid_t ptid = pid_to_ptid (ptid_get_pid (inferior_ptid)); + /* Kill all LWP's before trying to stop them. In rare cases the + lwp_info state may not match the inferior and + stop_wait_callback could lock up. */ + iterate_over_lwps (ptid, kill_callback, NULL); + /* Stop all threads before killing them, since ptrace requires - that the thread is stopped to sucessfully PTRACE_KILL. */ + that the thread is stopped to sucessfully PTRACE_KILL. + kill_callback normally already turned the inferior into a zombie + except for old Linux kernels 2.4.x. */ iterate_over_lwps (ptid, stop_callback, NULL); /* ... and wait until all of them have reported back that they're no longer running. */