Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2617132imu; Thu, 29 Nov 2018 07:42:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/VwDhX6i/apZtBtQtdszjzZuMMB0bA7Z90B8BCHW3+J6zSzfYRbJZKz2OWJNb4RU6obHQ47 X-Received: by 2002:a63:9a09:: with SMTP id o9mr1596288pge.94.1543506179422; Thu, 29 Nov 2018 07:42:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543506179; cv=none; d=google.com; s=arc-20160816; b=V7EoJfuXb+67hmXOTtpI+VO88nJCj32crBHkurD9WuwIGo7oummH1QwfqUmEsuoKYB 1VaO2u7QpqLEZt7NcsmQ0QAsT/NIrf+aWx/wXYD+dHfqqhps7qBZk8UwNBEqnVm4PjoQ 1YLLt+OkeDKtCKEd3rSuFvvEbyZUCxAgxXX3axPPL6MG8zYaHdVdIfPkqEGmB6eo/i+b upPo0RNKHdgyAblCxeRbvtUly/8MjZlsgeE005060NSI4pcE96MrPcbu6rcfyjPakhRA Y2IcOjfSNtJYCdI5GF7El+HjHtYEFWattmj9fWt+3546cYO+aZnqq/ESSXpwj4H+PNh5 NwzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=wUaGunDtnb4smCOwlQz/Opr5eS28NFZpbozN7x/9C+k=; b=bkCS347RBNKuE0NlS37KrHa3LJB+/2bJ3y1VDAjzBxYquY1gmhfXT8+OmqzBBn+4tK 56M7eBavJezjuwJ0zZg4mOvssqNkyNJpt0qo9gNBRPnRiEkUGjPQdeOsofSN49VEs/m5 yu4ecQSO32k1+TyUoETIfgeYYgGfaRY8eX0usUOI0SRM7wSaaN4ltoCPsZYVhGV/NRCD myq5xiKHGkZxBXLIPf88VEPtPBpLvFzjLvDOShQbT2IUwU3NXHe86n7qKNdkPY+eyfHM dP3JmCnIQO1rsAI1Y6+4tcS8G5mWNHTRGoJfWW2AmHZD3eQwarBWpYesDWcu5WRubrj2 qhAw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si2538667ply.409.2018.11.29.07.42.27; Thu, 29 Nov 2018 07:42:59 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728631AbeK3Crg (ORCPT + 99 others); Thu, 29 Nov 2018 21:47:36 -0500 Received: from nov-007-i650.relay.mailchannels.net ([46.232.183.204]:41163 "EHLO nov-007-i650.relay.mailchannels.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728363AbeK3Crg (ORCPT ); Thu, 29 Nov 2018 21:47:36 -0500 X-Sender-Id: novatrend|x-authuser|juerg@bitron.ch Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id CAB052EC0015; Thu, 29 Nov 2018 15:41:44 +0000 (UTC) Received: from srv17.tophost.ch (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTPA id 529D42EC0021; Thu, 29 Nov 2018 15:41:41 +0000 (UTC) X-Sender-Id: novatrend|x-authuser|juerg@bitron.ch Received: from srv17.tophost.ch (srv17.tophost.ch [193.33.128.141]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.15.2); Thu, 29 Nov 2018 15:41:44 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: novatrend|x-authuser|juerg@bitron.ch X-MailChannels-Auth-Id: novatrend X-Quick-Industry: 72ad060b459b633a_1543506104574_420126914 X-MC-Loop-Signature: 1543506104574:355923777 X-MC-Ingress-Time: 1543506104573 Received: from [148.252.241.226] (port=55628 helo=jx1y.guest.codethink.co.uk) by srv17.tophost.ch with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gSORf-00Gxrx-8y; Thu, 29 Nov 2018 16:41:39 +0100 Message-ID: Subject: Re: [PATCH] prctl: add PR_{GET,SET}_KILL_DESCENDANTS_ON_EXIT From: =?ISO-8859-1?Q?J=FCrg?= Billeter To: Oleg Nesterov , "Eric W. Biederman" Cc: Andrew Morton , Thomas Gleixner , Kees Cook , Andy Lutomirski , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 29 Nov 2018 15:41:38 +0000 In-Reply-To: <20181129123409.GA10645@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> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-AuthUser: juerg@bitron.ch Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Oleg, Thanks for the review. 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. > 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, unless you have another approach in mind to fix this. Jürg