[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87o9waep28.fsf@xmission.com>
Date: Wed, 05 Apr 2017 12:34:23 -0500
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Oleg Nesterov <oleg@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Aleksa Sarai <asarai@...e.com>,
Andy Lutomirski <luto@...capital.net>,
Attila Fazekas <afazekas@...hat.com>,
Jann Horn <jann@...jh.net>, Kees Cook <keescook@...omium.org>,
Michal Hocko <mhocko@...nel.org>,
Ulrich Obergfell <uobergfe@...hat.com>,
linux-kernel@...r.kernel.org, linux-api@...r.kernel.org
Subject: Re: [RFC][PATCH v2 3/5] clone: Disallown CLONE_THREAD with a shared sighand_struct
Oleg Nesterov <oleg@...hat.com> 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
Powered by blists - more mailing lists