From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933523AbdDERj6 (ORCPT ); Wed, 5 Apr 2017 13:39:58 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:35645 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755622AbdDERjo (ORCPT ); Wed, 5 Apr 2017 13:39:44 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Oleg Nesterov Cc: Andrew Morton , Aleksa Sarai , Andy Lutomirski , Attila Fazekas , Jann Horn , Kees Cook , Michal Hocko , Ulrich Obergfell , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org References: <20170303173326.GA17899@redhat.com> <87tw7axlr0.fsf@xmission.com> <87d1dyw5iw.fsf@xmission.com> <87tw7aunuh.fsf@xmission.com> <87lgsmunmj.fsf_-_@xmission.com> <20170304170312.GB13131@redhat.com> <8760ir192p.fsf@xmission.com> <878tnkpv8h.fsf_-_@xmission.com> <874ly6a0h1.fsf_-_@xmission.com> <87k2728lrp.fsf_-_@xmission.com> <20170405162458.GF14536@redhat.com> Date: Wed, 05 Apr 2017 12:34:23 -0500 In-Reply-To: <20170405162458.GF14536@redhat.com> (Oleg Nesterov's message of "Wed, 5 Apr 2017 18:24:59 +0200") Message-ID: <87o9waep28.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1cvouD-0004ka-CQ;;;mid=<87o9waep28.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=67.3.234.240;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+GK/RLlVYMEQmg2gd26SEnZLsNBdePmvw= X-SA-Exim-Connect-IP: 67.3.234.240 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.7 XMSubLong Long Subject * 1.5 TR_Symld_Words too many words that have symbols inside * 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.4991] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa02 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa02 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Oleg Nesterov X-Spam-Relay-Country: X-Spam-Timing: total 451 ms - load_scoreonly_sql: 0.08 (0.0%), signal_user_changed: 3.5 (0.8%), b_tie_ro: 2.2 (0.5%), parse: 1.35 (0.3%), extract_message_metadata: 6 (1.2%), get_uri_detail_list: 2.3 (0.5%), tests_pri_-1000: 7 (1.6%), tests_pri_-950: 2.2 (0.5%), tests_pri_-900: 1.82 (0.4%), tests_pri_-400: 29 (6.5%), check_bayes: 27 (6.1%), b_tokenize: 11 (2.4%), b_tok_get_all: 7 (1.5%), b_comp_prob: 3.9 (0.9%), b_tok_touch_all: 2.4 (0.5%), b_finish: 0.86 (0.2%), tests_pri_0: 370 (82.0%), check_dkim_signature: 1.72 (0.4%), check_dkim_adsp: 4.9 (1.1%), tests_pri_500: 8 (1.7%), rewrite_mail: 0.00 (0.0%) Subject: Re: [RFC][PATCH v2 3/5] clone: Disallown CLONE_THREAD with a shared sighand_struct 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 in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Oleg Nesterov writes: > On 04/02, Eric W. Biederman wrote: >> >> --- a/kernel/fork.c >> +++ b/kernel/fork.c >> @@ -1515,6 +1515,13 @@ static __latent_entropy struct task_struct *copy_process( >> if ((clone_flags & CLONE_THREAD) && !(clone_flags & CLONE_SIGHAND)) >> return ERR_PTR(-EINVAL); >> >> + /* Disallow CLONE_THREAD with a shared SIGHAND structure. No >> + * one cares > > Well, can't resists... I won't argue, but we can't know if no one cares > or not. I agree that most probably this won't break something, but who > knows... I am always scared when we add the incompatible changes. I agree that changing userspace semantics is something to be very careful with. But at least for purposes of discussion I think this is a good patch. I can avoid this change but it requires moving sighand->siglock into signal_struct and introducing a new spinlock into sighand_struct to just guard the signal handlers. However I think the change to move siglock would be a distraction from the larger issues of this patchset. Once we address the core issues I will be happy to revisit this. >> and supporting it leads to unnecessarily complex >> + * code. >> + */ >> + if ((clone_flags & CLONE_THREAD) && (atomic_read(¤t->sighand->count) > 1)) >> + return ERR_PTR(-EINVAL); > > Perhaps the comment should explain why we do this and say that > sighand-unsharing in de_thread() depends on this. That would be a better comment. Eric