Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751412AbdIMRsI (ORCPT ); Wed, 13 Sep 2017 13:48:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56440 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751092AbdIMRsH (ORCPT ); Wed, 13 Sep 2017 13:48:07 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B03D07A Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=oleg@redhat.com Date: Wed, 13 Sep 2017 19:48:04 +0200 From: Oleg Nesterov To: =?iso-8859-1?Q?J=FCrg?= Billeter Cc: Andrew Morton , Eric Biederman , linux-kernel@vger.kernel.org, Linus Torvalds , Michael Kerrisk Subject: Re: [PATCH] prctl: add PR_[GS]ET_PDEATHSIG_PROC Message-ID: <20170913174804.GA14752@redhat.com> References: <20170909094008.49983-1-j@bitron.ch> <20170912170544.GA32121@redhat.com> <1505242495.5111.82.camel@bitron.ch> <20170913171135.GB14063@redhat.com> <1505323578.49783.10.camel@bitron.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1505323578.49783.10.camel@bitron.ch> 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.29]); Wed, 13 Sep 2017 17:48:07 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1264 Lines: 32 On 09/13, J?rg Billeter wrote: > > On Wed, 2017-09-13 at 19:11 +0200, Oleg Nesterov wrote: > > On 09/12, J?rg Billeter wrote: > > > > > > On Tue, 2017-09-12 at 19:05 +0200, Oleg Nesterov wrote: > > > > On 09/09, J?rg Billeter wrote: > > > > > Unlike > > > > > PR_SET_PDEATHSIG, this is inherited across fork to allow killing a whole > > > > > subtree without race conditions. > > > > > > > > but I am still not sure this is right... at least I can't understand the > > > > "without race conditions" above. > > > > > > > > IOW, the child can do prctl(PR_SET_PDEATHSIG_PROC, SIGKILL) right after fork(), > > > > why this is not enough to kill a whole subtree without race conditions? > > > > > > What if the parent dies between fork() and prctl()? > > > > The child will be killed? Sorry, can't understand... > > If PR_SET_PDEATHSIG_PROC was not inherited across fork and the parent > died between fork() and prctl(PR_SET_PDEATHSIG_PROC, SIGKILL) in the > child, the child would not be killed. Aah, sorry. I forgot about another oddity of pdeath_signal API... Somehow I misread this patch as if reparent_leader() looks at current->signal->pdeath_signal_proc, not child->signal->pdeath_signal_proc. And to me the former makes more sense. But I won't insist. Oleg.