From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751131AbdJCDZx convert rfc822-to-8bit (ORCPT ); Mon, 2 Oct 2017 23:25:53 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:58149 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750869AbdJCDZv (ORCPT ); Mon, 2 Oct 2017 23:25:51 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Andrew Morton Cc: =?utf-8?Q?J=C3=BCrg?= Billeter , Oleg Nesterov , Linus Torvalds , Michael Kerrisk , Filipe Brandenburger , David Wilcox , "Adam H . Peterson" , hansecke@gmail.com, linux-kernel@vger.kernel.org References: <20170909094008.49983-1-j@bitron.ch> <20170929123058.48924-1-j@bitron.ch> <20171002162041.a7cefe8af71327b8becd2347@linux-foundation.org> Date: Mon, 02 Oct 2017 22:25:32 -0500 In-Reply-To: <20171002162041.a7cefe8af71327b8becd2347@linux-foundation.org> (Andrew Morton's message of "Mon, 2 Oct 2017 16:20:41 -0700") Message-ID: <87o9pogbf7.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-XM-SPF: eid=1dzDq3-0002a7-Ra;;;mid=<87o9pogbf7.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=67.3.200.44;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX199YVmWc4mvsysSsawF1SJnUUK0iDN6/Z8= X-SA-Exim-Connect-IP: 67.3.200.44 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 1.5 TR_Symld_Words too many words that have symbols inside * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] * 0.1 XMSolicitRefs_0 Weightloss drug X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: *;Andrew Morton X-Spam-Relay-Country: X-Spam-Timing: total 5547 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 2.5 (0.0%), b_tie_ro: 1.77 (0.0%), parse: 1.17 (0.0%), extract_message_metadata: 18 (0.3%), get_uri_detail_list: 1.98 (0.0%), tests_pri_-1000: 8 (0.1%), tests_pri_-950: 1.14 (0.0%), tests_pri_-900: 0.96 (0.0%), tests_pri_-400: 23 (0.4%), check_bayes: 22 (0.4%), b_tokenize: 7 (0.1%), b_tok_get_all: 7 (0.1%), b_comp_prob: 2.2 (0.0%), b_tok_touch_all: 3.6 (0.1%), b_finish: 0.65 (0.0%), tests_pri_0: 217 (3.9%), check_dkim_signature: 0.50 (0.0%), check_dkim_adsp: 3.2 (0.1%), tests_pri_500: 5271 (95.0%), poll_dns_idle: 5260 (94.8%), rewrite_mail: 0.00 (0.0%) Subject: Re: [RESEND PATCH] prctl: add PR_[GS]ET_PDEATHSIG_PROC X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andrew Morton writes: > On Fri, 29 Sep 2017 14:30:58 +0200 Jürg Billeter wrote: > >> PR_SET_PDEATHSIG sets a parent death signal that the calling process >> will get when its parent thread dies, even when the result of getppid() >> doesn't change because the calling process is reparented to a different >> thread in the same parent process. When managing multiple processes, a >> process-based parent death signal is much more useful. E.g., to avoid >> stray child processes. >> >> PR_SET_PDEATHSIG_PROC sets a process-based death signal. Unlike >> PR_SET_PDEATHSIG, this is inherited across fork to allow killing a whole >> subtree without race conditions. >> >> This can be used for sandboxing when combined with a seccomp filter. >> >> There have been previous attempts to support this by changing the >> behavior of PR_SET_PDEATHSIG. However, that would break existing >> applications. See https://marc.info/?l=linux-kernel&m=117621804801689 >> and https://bugzilla.kernel.org/show_bug.cgi?id=43300 > > Are Eric and Oleg OK with this? > > A prctl manpage update will be needed, please (cc linux-api). It makes for an interesting way of killing a process tree. The domino effect. I believe the rational for adding a new prctl. The code where it calls group_send_sig_info is buggy for pdeath_signal. And it no less buggy for this new case. There is no point to check permissions when sending a signal to yourself. Especially this signal gets cleared during exec with a change of permissions. I would recommend using: do_send_sig_info(p->signal->pdeath_signal_proc, SEND_SIG_NOINFO, p, true); Perhaps with a comment saying that no permission check is needed when sending a signal to yourself. I don't know what I think about inherit over fork, and the whole tree killing thing. Except when the signal is SIGKILL I don't know if that code does what is intended. So I am a little leary of it. Eric