lkml.org 
[lkml]   [2017]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 06/26] rlimit: Remove unnecessary grab of tasklist_lock
Oleg Nesterov <oleg@redhat.com> writes:

> Hi Eric,
>
> I'll try very much to read this series tomorrow, can't do this today...
>
> On 06/06, Eric W. Biederman wrote:
>>
>> @@ -1380,13 +1380,6 @@ int do_prlimit(struct task_struct *tsk, unsigned int resource,
>> return -EPERM;
>> }
>>
>> - /* protect tsk->signal and tsk->sighand from disappearing */
>> - read_lock(&tasklist_lock);
>> - if (!tsk->sighand) {
>> - retval = -ESRCH;
>> - goto out;
>> - }
>
> Yes, the comment is wrong.
>
> However we do need read_lock(tasklist_lock) to access ->group_leader. And the
> ->sighand != NULL check ensures that ->group_leader is the valid
> pointer.

As of 4.12-rc1 The code does not access group_leader anymore.

> Also, update_rlimit_cpu() is not safe without tasklist / sighand-check.
>
> We can probably change this code to rely on rcu.

Good point a NULL sighand will cause update_rlimit_cpu to OOPS.

Grr. There is a point in my tree where this is perfectly safe. But not
at this point. Consider this patch dropped for the moment.

Eric

\
 
 \ /
  Last update: 2017-06-12 01:05    [W:0.044 / U:11.604 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site