diff options
-rw-r--r-- | kernel/signal.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index 251cc13720bd..24be82c0aae3 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -533,6 +533,7 @@ static int rm_from_queue(unsigned long mask, struct sigpending *s) | |||
533 | static int check_kill_permission(int sig, struct siginfo *info, | 533 | static int check_kill_permission(int sig, struct siginfo *info, |
534 | struct task_struct *t) | 534 | struct task_struct *t) |
535 | { | 535 | { |
536 | struct pid *sid; | ||
536 | int error; | 537 | int error; |
537 | 538 | ||
538 | if (!valid_signal(sig)) | 539 | if (!valid_signal(sig)) |
@@ -545,11 +546,24 @@ static int check_kill_permission(int sig, struct siginfo *info, | |||
545 | if (error) | 546 | if (error) |
546 | return error; | 547 | return error; |
547 | 548 | ||
548 | if (((sig != SIGCONT) || (task_session_nr(current) != task_session_nr(t))) | 549 | if ((current->euid ^ t->suid) && (current->euid ^ t->uid) && |
549 | && (current->euid ^ t->suid) && (current->euid ^ t->uid) | 550 | (current->uid ^ t->suid) && (current->uid ^ t->uid) && |
550 | && (current->uid ^ t->suid) && (current->uid ^ t->uid) | 551 | !capable(CAP_KILL)) { |
551 | && !capable(CAP_KILL)) | 552 | switch (sig) { |
552 | return -EPERM; | 553 | case SIGCONT: |
554 | read_lock(&tasklist_lock); | ||
555 | sid = task_session(t); | ||
556 | read_unlock(&tasklist_lock); | ||
557 | /* | ||
558 | * We don't return the error if sid == NULL. The | ||
559 | * task was unhashed, the caller must notice this. | ||
560 | */ | ||
561 | if (!sid || sid == task_session(current)) | ||
562 | break; | ||
563 | default: | ||
564 | return -EPERM; | ||
565 | } | ||
566 | } | ||
553 | 567 | ||
554 | return security_task_kill(t, info, sig, 0); | 568 | return security_task_kill(t, info, sig, 0); |
555 | } | 569 | } |