Skip to content

Commit

Permalink
kernel/pid.c: update comment on find_task_by_pid_ns
Browse files Browse the repository at this point in the history
tasklist_lock does protect the task and its pid, it can't go away.  The
problem is that find_pid_ns() itself is unsafe without rcu lock, it can
race with copy_process()->free_pid(any_pid).

Protecting copy_process()->free_pid(any_pid) with tasklist_lock would make
it possible to call find_task_by_pid_ns() under tasklist safely, but we
don't do so because we are trying to get rid of the read_lock sites of
tasklist_lock.

Signed-off-by: Tetsuo Handa <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: "Paul E. McKenney" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Tetsuo Handa authored and torvalds committed Mar 6, 2010
1 parent 8aeee85 commit 9728e5d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ struct task_struct *pid_task(struct pid *pid, enum pid_type type)
EXPORT_SYMBOL(pid_task);

/*
* Must be called under rcu_read_lock() or with tasklist_lock read-held.
* Must be called under rcu_read_lock().
*/
struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns)
{
Expand Down

0 comments on commit 9728e5d

Please sign in to comment.