From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753403AbdDCSNC (ORCPT ); Mon, 3 Apr 2017 14:13:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58488 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752431AbdDCSNA (ORCPT ); Mon, 3 Apr 2017 14:13:00 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 366966841B Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=oleg@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 366966841B Date: Mon, 3 Apr 2017 20:12:52 +0200 From: Oleg Nesterov To: "Eric W. Biederman" Cc: Andrew Morton , Aleksa Sarai , Andy Lutomirski , Attila Fazekas , Jann Horn , Kees Cook , Michal Hocko , Ulrich Obergfell , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [RFC][PATCH 2/2] exec: If possible don't wait for ptraced threads to be reaped Message-ID: <20170403181252.GA31390@redhat.com> References: <87tw7axlr0.fsf@xmission.com> <87d1dyw5iw.fsf@xmission.com> <87tw7aunuh.fsf@xmission.com> <87lgsmunmj.fsf_-_@xmission.com> <20170304170312.GB13131@redhat.com> <8760ir192p.fsf@xmission.com> <878tnkpv8h.fsf_-_@xmission.com> <87vaqooggs.fsf_-_@xmission.com> <20170402153517.GA12637@redhat.com> <877f32k5ew.fsf@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <877f32k5ew.fsf@xmission.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.38]); Mon, 03 Apr 2017 18:13:00 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/02, Eric W. Biederman wrote: > > Oleg Nesterov writes: > > > And btw zap_other_threads(may_hang == 0) is racy. Either you need tasklist or > > exit_notify() should set tsk->exit_state under siglock, otherwise zap() can > > return the wrong count. > > zap_other_thread(tsk, 0) only gets called in the case where we don't > care about the return value. It does not get called from fs/exec.c I meant that may_hang == 0 implies zap_other_threads(do_count => -1) which should return the number of threads which didn't pass exit_notify(). The returned value can be wrong unless you change exit_notify() to set exit_state under siglock. Oleg. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Nesterov Subject: Re: [RFC][PATCH 2/2] exec: If possible don't wait for ptraced threads to be reaped Date: Mon, 3 Apr 2017 20:12:52 +0200 Message-ID: <20170403181252.GA31390@redhat.com> References: <87tw7axlr0.fsf@xmission.com> <87d1dyw5iw.fsf@xmission.com> <87tw7aunuh.fsf@xmission.com> <87lgsmunmj.fsf_-_@xmission.com> <20170304170312.GB13131@redhat.com> <8760ir192p.fsf@xmission.com> <878tnkpv8h.fsf_-_@xmission.com> <87vaqooggs.fsf_-_@xmission.com> <20170402153517.GA12637@redhat.com> <877f32k5ew.fsf@xmission.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <877f32k5ew.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: "Eric W. Biederman" Cc: Andrew Morton , Aleksa Sarai , Andy Lutomirski , Attila Fazekas , Jann Horn , Kees Cook , Michal Hocko , Ulrich Obergfell , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-api@vger.kernel.org On 04/02, Eric W. Biederman wrote: > > Oleg Nesterov writes: > > > And btw zap_other_threads(may_hang == 0) is racy. Either you need tasklist or > > exit_notify() should set tsk->exit_state under siglock, otherwise zap() can > > return the wrong count. > > zap_other_thread(tsk, 0) only gets called in the case where we don't > care about the return value. It does not get called from fs/exec.c I meant that may_hang == 0 implies zap_other_threads(do_count => -1) which should return the number of threads which didn't pass exit_notify(). The returned value can be wrong unless you change exit_notify() to set exit_state under siglock. Oleg.