From 10ab12bef210a4938f80a2ef795c00963866b58d Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Wed, 22 Aug 2007 14:01:48 -0700 Subject: [PATCH] --- yaml --- r: 64250 b: refs/heads/master c: f9ee228bdc82cff8ea1ec00fd952890e00679dd8 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/exec.c | 9 ++------- trunk/fs/signalfd.c | 14 ++++++++++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/[refs] b/[refs] index 6d7d58498f6f..78d7791cf4f2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 834d216e1f804560bd1421c511ad168d7c24b01d +refs/heads/master: f9ee228bdc82cff8ea1ec00fd952890e00679dd8 diff --git a/trunk/fs/exec.c b/trunk/fs/exec.c index ce62f7b65f17..af4361c927a9 100644 --- a/trunk/fs/exec.c +++ b/trunk/fs/exec.c @@ -779,19 +779,13 @@ static int de_thread(struct task_struct *tsk) struct task_struct *leader = NULL; int count; - /* - * Tell all the sighand listeners that this sighand has - * been detached. The signalfd_detach() function grabs the - * sighand lock, if signal listeners are present on the sighand. - */ - signalfd_detach(tsk); - /* * If we don't share sighandlers, then we aren't sharing anything * and we can just re-use it all. */ if (atomic_read(&oldsighand->count) <= 1) { BUG_ON(atomic_read(&sig->count) != 1); + signalfd_detach(tsk); exit_itimers(sig); return 0; } @@ -930,6 +924,7 @@ static int de_thread(struct task_struct *tsk) sig->flags = 0; no_thread_group: + signalfd_detach(tsk); exit_itimers(sig); if (leader) release_task(leader); diff --git a/trunk/fs/signalfd.c b/trunk/fs/signalfd.c index 7b941abbcde0..a8e293d30034 100644 --- a/trunk/fs/signalfd.c +++ b/trunk/fs/signalfd.c @@ -56,12 +56,18 @@ static int signalfd_lock(struct signalfd_ctx *ctx, struct signalfd_lockctx *lk) sighand = lock_task_sighand(lk->tsk, &lk->flags); rcu_read_unlock(); - if (sighand && !ctx->tsk) { + if (!sighand) + return 0; + + if (!ctx->tsk) { unlock_task_sighand(lk->tsk, &lk->flags); - sighand = NULL; + return 0; } - return sighand != NULL; + if (lk->tsk->tgid == current->tgid) + lk->tsk = current; + + return 1; } static void signalfd_unlock(struct signalfd_lockctx *lk) @@ -331,7 +337,7 @@ asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemas init_waitqueue_head(&ctx->wqh); ctx->sigmask = sigmask; - ctx->tsk = current; + ctx->tsk = current->group_leader; sighand = current->sighand; /*