Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751311AbdIMRLj (ORCPT ); Wed, 13 Sep 2017 13:11:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34218 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751054AbdIMRLi (ORCPT ); Wed, 13 Sep 2017 13:11:38 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EC5A5C058EAA Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=oleg@redhat.com Date: Wed, 13 Sep 2017 19:11:35 +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: <20170913171135.GB14063@redhat.com> References: <20170909094008.49983-1-j@bitron.ch> <20170912170544.GA32121@redhat.com> <1505242495.5111.82.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: <1505242495.5111.82.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.32]); Wed, 13 Sep 2017 17:11:38 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1175 Lines: 33 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... > it also makes it relatively easy to enforce > PDEATHSIG_PROC for all descendants of a process. this is clear, > > Say, CLONE_PARENT. Should it succeed if ->pdeath_signal_proc != 0 ? > > Yes, I don't see an issue with that. The new process will be a sibling > and inheriting pdeath_signal_proc seems sensible to me for this. I meant, the process created by clone(CLONE_PARENT) won't be killed by pdeath_signal if the creator process exits, exactly because it won't be its child. Not that I think this is wrong. Oleg.