From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932404AbdDEQZ6 (ORCPT ); Wed, 5 Apr 2017 12:25:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57834 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751772AbdDEQZM (ORCPT ); Wed, 5 Apr 2017 12:25:12 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EE85819D22F Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=oleg@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com EE85819D22F Date: Wed, 5 Apr 2017 18:24:59 +0200 From: Oleg Nesterov To: "Eric W. Biederman" 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 Subject: Re: [RFC][PATCH v2 3/5] clone: Disallown CLONE_THREAD with a shared sighand_struct Message-ID: <20170405162458.GF14536@redhat.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k2728lrp.fsf_-_@xmission.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 05 Apr 2017 16:25:12 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > 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. Oleg.