Thread (33 messages) 33 messages, 5 authors, 2017-06-07

Re: [PATCH 06/26] rlimit: Remove unnecessary grab of tasklist_lock

flat view

From: Oleg Nesterov <oleg@redhat.com>
Date: 2017-06-07 12:37:23
Also in: lkml

Hi Eric,

I'll try very much to read this series tomorrow, can't do this today...

On 06/06, Eric W. Biederman wrote:
quoted hunk ↗ jump to hunk
@@ -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.

Also, update_rlimit_cpu() is not safe without tasklist / sighand-check.

We can probably change this code to rely on rcu.

Oleg.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help