aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2006-03-28 19:11:13 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-28 21:36:42 -0500
commitf63ee72e0fb82e504a0489490babc7612c7cd6c2 (patch)
tree85167f8016d1f746135bf1777646a58c44376af1 /include
parentaa1757f90bea3f598b6e5d04d922a6a60200f1da (diff)
[PATCH] introduce lock_task_sighand() helper
Add lock_task_sighand() helper and converts group_send_sig_info() to use it. Hopefully we will have more users soon. This patch also removes '!sighand->count' and '!p->usage' checks, I think they both are bogus, racy and unneeded (but probably it makes sense to restore them as BUG_ON()s). ->sighand is cleared and it's ->count is decremented in release_task() with sighand->siglock held, so it is a bug to have '!p->usage || !->count' after we already locked and verified it is the same. On the other hand, an already dead task without ->sighand can have a non-zero ->usage due to ptrace, for example. If we read the stale value of ->sighand we must see the change after spin_lock(), because that change was done while holding that same old ->sighand.siglock. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/sched.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index bbcfc873bd98..ca1fd31aae97 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1225,6 +1225,15 @@ static inline void task_unlock(struct task_struct *p)
1225 spin_unlock(&p->alloc_lock); 1225 spin_unlock(&p->alloc_lock);
1226} 1226}
1227 1227
1228extern struct sighand_struct *lock_task_sighand(struct task_struct *tsk,
1229 unsigned long *flags);
1230
1231static inline void unlock_task_sighand(struct task_struct *tsk,
1232 unsigned long *flags)
1233{
1234 spin_unlock_irqrestore(&tsk->sighand->siglock, *flags);
1235}
1236
1228#ifndef __HAVE_THREAD_FUNCTIONS 1237#ifndef __HAVE_THREAD_FUNCTIONS
1229 1238
1230#define task_thread_info(task) (task)->thread_info 1239#define task_thread_info(task) (task)->thread_info