From f5ec98b77f2e279d0b427abae15a2409c27b1a7c Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Wed, 30 Apr 2008 00:53:01 -0700 Subject: [PATCH] --- yaml --- r: 95138 b: refs/heads/master c: 2e2ba22ea4fd4bb85f0fa37c521066db6775cbef h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/kernel/signal.c | 24 +++++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index a329dd665bed..9a321963ad7f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 53c30337f2c61aff6eecf2a446e839641172f9bd +refs/heads/master: 2e2ba22ea4fd4bb85f0fa37c521066db6775cbef diff --git a/trunk/kernel/signal.c b/trunk/kernel/signal.c index 251cc13720bd..24be82c0aae3 100644 --- a/trunk/kernel/signal.c +++ b/trunk/kernel/signal.c @@ -533,6 +533,7 @@ static int rm_from_queue(unsigned long mask, struct sigpending *s) static int check_kill_permission(int sig, struct siginfo *info, struct task_struct *t) { + struct pid *sid; int error; if (!valid_signal(sig)) @@ -545,11 +546,24 @@ static int check_kill_permission(int sig, struct siginfo *info, if (error) return error; - if (((sig != SIGCONT) || (task_session_nr(current) != task_session_nr(t))) - && (current->euid ^ t->suid) && (current->euid ^ t->uid) - && (current->uid ^ t->suid) && (current->uid ^ t->uid) - && !capable(CAP_KILL)) - return -EPERM; + if ((current->euid ^ t->suid) && (current->euid ^ t->uid) && + (current->uid ^ t->suid) && (current->uid ^ t->uid) && + !capable(CAP_KILL)) { + switch (sig) { + case SIGCONT: + read_lock(&tasklist_lock); + sid = task_session(t); + read_unlock(&tasklist_lock); + /* + * We don't return the error if sid == NULL. The + * task was unhashed, the caller must notice this. + */ + if (!sid || sid == task_session(current)) + break; + default: + return -EPERM; + } + } return security_task_kill(t, info, sig, 0); }