pids: document task_pgrp/task_session is not safe without tasklist/rcu
commit6dda81f4384b94930826eded254d8c16f89a9248
authorOleg Nesterov <oleg@redhat.com>
Thu, 2 Apr 2009 23:58:35 +0000 (2 16:58 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 3 Apr 2009 02:05:02 +0000 (2 19:05 -0700)
treea7b27ca16a6feba637cb01e68b54c58b6ca07bc2
parent8e654fba4a376f436bdfe361fc5cdbc87ac09b35
pids: document task_pgrp/task_session is not safe without tasklist/rcu

Even if task == current, it is not safe to dereference the result of
task_pgrp/task_session.  We can race with another thread which changes the
special pid via setpgid/setsid.

Document this.  The next 2 patches give an example of the unsafe usage, we
have more bad users.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Louis Rilling <Louis.Rilling@kerlabs.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/sched.h