Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3572906imu; Fri, 30 Nov 2018 02:34:26 -0800 (PST) X-Google-Smtp-Source: AFSGD/Ws099l65i/hw2Mb1XhHdFM7e74GKHbRl5bmYgp1qV9StFcLtPxj5jUcZYAf3/gMVx1BO1k X-Received: by 2002:a63:2ac9:: with SMTP id q192mr4392492pgq.58.1543574065991; Fri, 30 Nov 2018 02:34:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543574065; cv=none; d=google.com; s=arc-20160816; b=qWu1DJonaL+EDaHJeCUOt5Uxk3EsQcQLUYtzFPLI6vrWIwQGZhzIm1dE5hhrRPlpar IWcE5ew0HM7HXqGSc7NYmlnvUrsuUU1NWQwFtp+mLkbafzNkFsyeEp0hJPhgiEkBkloE lNTvzd6o9ppCSg7gXOXXTvYFXG7wrA9efED1DkqdLVLq6mRmEwWpG42mGJrJKdHEx4bL adqiRaFcKKQn3SbsaLR1mh896twMsl7uJmBAOs4x1tKLs88dIm5ejwCQNCTZjxaNN9LQ iBqeS/G15XMEeiAeALapxjvNP7xp2BucChj5NK3YIS4DybBr9Trc45Zv7o7FdzLtTDw5 sCfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=b6MasDxwkZts7Pdv3cpqQ5eGG+2glPmJ2RiwN/prLEc=; b=akuf5AeiTy2iJQCcHD6IbwA1m1uHaQ0+bnH9UXi8Lb8Fb8Qbr3DR4HD/eOoYDF9W/q nZ2Zo7jbCCo61QqwgZhCS702LvxV596X6/GTmmRlu4KIM1mdT/JIPa7ySOrwkmapL0tS xI3MPTEeaDZ2vPPX3/2DmmWPH99uyMxXOS3llCltDRo0QO20t6izHhUZNb4H59v9qNIT c3vSt69eHu8bnIhi+h06J1qE5opTB/4DbH1V/lhoW57CXG4RkGo74VHzYN+qeeaXHPGG v6u9DxT+JwwwD05JhDPGEmeUUuWp09HDTfXRzxy28nN4yvgJwzafqnKgPx6fLjUTDhEq ekkw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7si4519136pgh.403.2018.11.30.02.34.10; Fri, 30 Nov 2018 02:34:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726660AbeK3VmX (ORCPT + 99 others); Fri, 30 Nov 2018 16:42:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:16297 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726507AbeK3VmX (ORCPT ); Fri, 30 Nov 2018 16:42:23 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E6FEF80F7D; Fri, 30 Nov 2018 10:33:32 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.12]) by smtp.corp.redhat.com (Postfix) with SMTP id 410C15D736; Fri, 30 Nov 2018 10:33:30 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Fri, 30 Nov 2018 11:33:32 +0100 (CET) Date: Fri, 30 Nov 2018 11:33:30 +0100 From: Oleg Nesterov To: =?iso-8859-1?Q?J=FCrg?= Billeter Cc: "Eric W. Biederman" , Andrew Morton , Thomas Gleixner , Kees Cook , Andy Lutomirski , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] prctl: add PR_{GET,SET}_KILL_DESCENDANTS_ON_EXIT Message-ID: <20181130103329.GB23670@redhat.com> References: <20181127225408.7553-1-j@bitron.ch> <20181127225408.7553-2-j@bitron.ch> <20181128144230.GG30395@redhat.com> <87r2f5gr9g.fsf@xmission.com> <20181129123409.GA10645@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 30 Nov 2018 10:33:33 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/29, J?rg Billeter wrote: > > On Thu, 2018-11-29 at 13:34 +0100, Oleg Nesterov wrote: > > To me it would be more clean to call walk_process_tree(kill_descendant_visitor) > > unconditionally in find_new_reaper() right before "if (has_child_subreaper)", but > > then we will need to shift read_lock(tasklist) from walk_process_tree(). > > Yes, that's the reason why I added the call before the tasklist lock. > Let me know if you want me to move the read lock from > walk_process_tree() to PR_SET_CHILD_SUBREAPER (the only caller) > instead. I am fine either way. We can do this later, lets keep your patch simple. > > So I think the patch is mostly fine, the only problem I can see is that > > PR_SET_KILL_DESCENDANTS_ON_EXIT can race with PR_SET_CHILD_SUBREAPER, they both > > need to update the bits in the same word. > > Good point. I'll make it a regular bool instead of a bitfield for v2, Agreed, > unless you have another approach in mind to fix this. Well, I think that is_child_subreaper/has_child_subreaper and the new kill_descendants_on_exit should live in signal->flags, but we need some cleanups to make this possible, so I agree with the boolean. Oleg.