diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-10-19 02:40:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-19 14:53:40 -0400 |
commit | bac0abd6174e427404dd197cdbefece31e97329b (patch) | |
tree | 68ed6bd8619552c921c9fb99e83cb04fcb235a39 /fs | |
parent | 19b9b9b54e5f115907efd56be2c3799775a46561 (diff) |
Isolate some explicit usage of task->tgid
With pid namespaces this field is now dangerous to use explicitly, so hide
it behind the helpers.
Also the pid and pgrp fields o task_struct and signal_struct are to be
deprecated. Unfortunately this patch cannot be sent right now as this
leads to tons of warnings, so start isolating them, and deprecate later.
Actually the p->tgid == pid has to be changed to has_group_leader_pid(),
but Oleg pointed out that in case of posix cpu timers this is the same, and
thread_group_leader() is more preferable.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/exec.c | 4 | ||||
-rw-r--r-- | fs/proc/base.c | 2 |
2 files changed, 3 insertions, 3 deletions
@@ -841,8 +841,8 @@ static int de_thread(struct task_struct *tsk) | |||
841 | */ | 841 | */ |
842 | tsk->start_time = leader->start_time; | 842 | tsk->start_time = leader->start_time; |
843 | 843 | ||
844 | BUG_ON(leader->tgid != tsk->tgid); | 844 | BUG_ON(!same_thread_group(leader, tsk)); |
845 | BUG_ON(tsk->pid == tsk->tgid); | 845 | BUG_ON(has_group_leader_pid(tsk)); |
846 | /* | 846 | /* |
847 | * An exec() starts a new thread group with the | 847 | * An exec() starts a new thread group with the |
848 | * TGID of the previous thread group. Rehash the | 848 | * TGID of the previous thread group. Rehash the |
diff --git a/fs/proc/base.c b/fs/proc/base.c index db7636041c10..991482811f1e 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -2553,7 +2553,7 @@ static struct dentry *proc_task_lookup(struct inode *dir, struct dentry * dentry | |||
2553 | rcu_read_unlock(); | 2553 | rcu_read_unlock(); |
2554 | if (!task) | 2554 | if (!task) |
2555 | goto out; | 2555 | goto out; |
2556 | if (leader->tgid != task->tgid) | 2556 | if (!same_thread_group(leader, task)) |
2557 | goto out_drop_task; | 2557 | goto out_drop_task; |
2558 | 2558 | ||
2559 | result = proc_task_instantiate(dir, dentry, task, NULL); | 2559 | result = proc_task_instantiate(dir, dentry, task, NULL); |