From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752205AbdBMSBf (ORCPT ); Mon, 13 Feb 2017 13:01:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47620 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751658AbdBMSBe (ORCPT ); Mon, 13 Feb 2017 13:01:34 -0500 Date: Mon, 13 Feb 2017 19:01:31 +0100 From: Oleg Nesterov To: Mika =?iso-8859-1?Q?Penttil=E4?= Cc: Andrew Morton , Aleksa Sarai , Andy Lutomirski , Attila Fazekas , "Eric W. Biederman" , Jann Horn , Kees Cook , Michal Hocko , Ulrich Obergfell , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] exec: don't wait for zombie threads with cred_guard_mutex held Message-ID: <20170213180131.GA2699@redhat.com> References: <20170213141516.GA30233@redhat.com> <7ce94707-7bbe-a0d5-85a0-b93e73d76e22@nextfour.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7ce94707-7bbe-a0d5-85a0-b93e73d76e22@nextfour.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 13 Feb 2017 18:01:34 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/13, Mika Penttilä wrote: > > > +int de_thread(struct task_struct *tsk) > > { > > struct signal_struct *sig = tsk->signal; > > struct sighand_struct *oldsighand = tsk->sighand; > > @@ -1051,60 +1100,24 @@ static int de_thread(struct task_struct *tsk) > > if (thread_group_empty(tsk)) > > goto no_thread_group; > > > > - /* > > - * Kill all other threads in the thread group. > > - */ > > spin_lock_irq(lock); > > - if (signal_group_exit(sig)) { > > - /* > > - * Another group action in progress, just > > - * return so that the signal is processed. > > - */ > > - spin_unlock_irq(lock); > > - return -EAGAIN; > > - } > > - > > - sig->group_exit_task = tsk; > > - sig->notify_count = zap_other_threads(tsk); > > + sig->notify_count = sig->nr_threads; > > > maybe nr_threads - 1 since nr_threads includes us ? Damn. Of course you are right, thanks a lot! Please see v2. Hmm. I didn't even notice my own test-case didn't pass because of this off-by-one. Oleg.