Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3128099imu; Fri, 18 Jan 2019 05:22:01 -0800 (PST) X-Google-Smtp-Source: ALg8bN7v5H0/qFlZKdJwisbUkra75p8lQelkti9okA5QwSDuI+cYkrGCZqKxhzxD/ar7ngJ60314 X-Received: by 2002:a63:a002:: with SMTP id r2mr17319002pge.212.1547817721511; Fri, 18 Jan 2019 05:22:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547817721; cv=none; d=google.com; s=arc-20160816; b=r7DlDgDZX9+PtN1XdfQqkRQp3mBAmbSSCNFajQOra9mCcc5FutcIXWh47d679wxGE5 L1BZ+ixmy6GNRFk31/EXTonY3odTv6ZpWYVNpwJEklMn4DaqRyZzSRTuGh5AwkZp4Tw5 UzHZ6+pp3DLBUc9ry30SyFDDkMdqjrXlHO7aOxc9oEZGIT68tien+f67uPelKtuIxhxt 182cYWdwOWFcgEJEsPDuphFztuKvOgbotysNefDJFDFlWGx/il1swZPU2aZuoOfnkiKi 1T7AM4A5Tzd+pARky3ee9mW4Mm951c7I21Naq4ZjFwmkT002uPD938JKB7vmBqqoIAD7 IUog== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=oM6vS+4YM+jVN9bC5qJkQZ4TWxm+0hNC/W6IQg/TJBE=; b=RRkgmTaUDkuq6AnP2hpjm2cK0jC4C+x+sYac1LBqPdh9KS8+aWhwhqVUAWLLSX8yaF NeLSIqdbJWS0QC2NLmjZwZlryhteu/jOxvt899o3aEstRJXoYNCdSSAg6ZaxMeE0s9hE PXofgfZAyyJ0oXM50QefLkSFhjm6S9OHGQQbVz6UGGqoYc6cCVibX5bAp2nyHYBQMkEU z51MxohfZRRKWym3uAUMTtHmU/s2Kl0QFQAEbCECCQ0esLPfRVtsclumef1Vh2SL8TpV CDwlAvX+KnzEnLpTLIZ2KuUjzJ08/FR6vNTpScFhUwrAH69CLdZ1tbizurZmuLcMVw7F AYIA== 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 u27si4657864pfa.103.2019.01.18.05.21.45; Fri, 18 Jan 2019 05:22:01 -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 S1727517AbfARNUZ (ORCPT + 99 others); Fri, 18 Jan 2019 08:20:25 -0500 Received: from nov-007-i650.relay.mailchannels.net ([46.232.183.204]:33404 "EHLO nov-007-i650.relay.mailchannels.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727100AbfARNUY (ORCPT ); Fri, 18 Jan 2019 08:20:24 -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 245F0BE0A20; Fri, 18 Jan 2019 13:12:00 +0000 (UTC) Received: from srv17.tophost.ch (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTPA id B7CE8BE0724; Fri, 18 Jan 2019 13:11:56 +0000 (UTC) X-Sender-Id: novatrend|x-authuser|juerg@bitron.ch Received: from srv17.tophost.ch (srv17.tophost.ch [193.33.128.155]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.15.2); Fri, 18 Jan 2019 13:12:00 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: novatrend|x-authuser|juerg@bitron.ch X-MailChannels-Auth-Id: novatrend X-Continue-Abaft: 7520c95450af670d_1547817119922_413462037 X-MC-Loop-Signature: 1547817119922:2121460126 X-MC-Ingress-Time: 1547817119921 Received: from [80.219.231.201] (port=59124 helo=jzen.bitron.ch) by srv17.tophost.ch with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-SHA256:128) (Exim 4.91) (envelope-from ) id 1gkTwA-0002In-1q; Fri, 18 Jan 2019 14:11:54 +0100 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= To: Andrew Morton Cc: Oleg Nesterov , Thomas Gleixner , Eric Biederman , Kees Cook , Andy Lutomirski , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?J=C3=BCrg=20Billeter?= Subject: [RESEND PATCH v2 0/1] Add prctl to kill descendants on exit Date: Fri, 18 Jan 2019 14:11:29 +0100 Message-Id: <20190118131130.42209-1-j@bitron.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20181127225408.7553-1-j@bitron.ch> References: <20181127225408.7553-1-j@bitron.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 This patch adds a new prctl to kill all descendant processes on exit. See commit message for details of the prctl. This is a replacement of PR_SET_PDEATHSIG_PROC I proposed last year [1]. In the following discussion, Oleg suggested this approach. The motivation for this is to provide a lightweight mechanism to prevent stray processes. There is also a related Bugzilla entry [2]. PID namespaces can also be used to prevent stray processes, of course. However, they are not quite as lightweight as they typically also require a new mount namespace to be able to mount a new /proc. And they require CAP_SYS_ADMIN. User namespaces can help to gain CAP_SYS_ADMIN, however, that further increases the overhead and the other effects of the user namespace may not be desired. PID 1 in PID namespaces also exhibits non-standard signal behavior (SIGNAL_UNKILLABLE) [3]. Changes in v2: - Use bool instead of bitfield to avoid race with PR_SET_CHILD_SUBREAPER [1] https://lkml.kernel.org/lkml/20170929123058.48924-1-j@bitron.ch/ [2] https://bugzilla.kernel.org/show_bug.cgi?id=43300 [3] https://lkml.kernel.org/lkml/20180803144021.56920-2-j@bitron.ch/ Jürg Billeter (1): prctl: add PR_{GET,SET}_KILL_DESCENDANTS_ON_EXIT fs/exec.c | 6 ++++++ include/linux/sched/signal.h | 3 +++ include/uapi/linux/prctl.h | 4 ++++ kernel/exit.c | 12 ++++++++++++ kernel/sys.c | 11 +++++++++++ security/apparmor/lsm.c | 1 + security/selinux/hooks.c | 3 +++ 7 files changed, 40 insertions(+) -- 2.20.1