diff options
author | Oleg Nesterov <[email protected]> | 2013-07-03 15:08:31 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2013-07-03 16:08:03 -0700 |
commit | 8190773985141f063e1d6dc10200527c655abfb5 (patch) | |
tree | 5c148834f047748dfa2ce3500236b89656976567 /include/linux/fpga/fpga-mgr.h | |
parent | 80628ca06c5d42929de6bc22c0a41589a834d151 (diff) |
kernel/fork.c:copy_process(): don't add the uninitialized child to thread/task/pid lists
copy_process() adds the new child to thread_group/init_task.tasks list and
then does attach_pid(child, PIDTYPE_PID). This means that the lockless
next_thread() or next_task() can see this thread with the wrong pid. Say,
"ls /proc/pid/task" can list the same inode twice.
We could move attach_pid(child, PIDTYPE_PID) up, but in this case
find_task_by_vpid() can find the new thread before it was fully
initialized.
And this is already true for PIDTYPE_PGID/PIDTYPE_SID, With this patch
copy_process() initializes child->pids[*].pid first, then calls
attach_pid() to insert the task into the pid->tasks list.
attach_pid() no longer need the "struct pid*" argument, it is always
called after pid_link->pid was already set.
Signed-off-by: Oleg Nesterov <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Pavel Emelyanov <[email protected]>
Cc: Sergey Dyasly <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'include/linux/fpga/fpga-mgr.h')
0 files changed, 0 insertions, 0 deletions