From: Oleg Nesterov <oleg@redhat.com>
Date: Mon, 6 Apr 2009 14:16:02 +0000 (+0200)
Subject: exit_notify: kill the wrong capable(CAP_KILL) check
X-Git-Tag: firefly_0821_release~14717
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=432870dab85a2f69dc417022646cb9a70acf7f94;p=firefly-linux-kernel-4.4.55.git

exit_notify: kill the wrong capable(CAP_KILL) check

The CAP_KILL check in exit_notify() looks just wrong, kill it.

Whatever logic we have to reset ->exit_signal, the malicious user
can bypass it if it execs the setuid application before exiting.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Acked-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---

diff --git a/kernel/exit.c b/kernel/exit.c
index 6686ed1e4aa3..32cbf2607cb0 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -837,8 +837,7 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
 	 */
 	if (tsk->exit_signal != SIGCHLD && !task_detached(tsk) &&
 	    (tsk->parent_exec_id != tsk->real_parent->self_exec_id ||
-	     tsk->self_exec_id != tsk->parent_exec_id) &&
-	    !capable(CAP_KILL))
+	     tsk->self_exec_id != tsk->parent_exec_id))
 		tsk->exit_signal = SIGCHLD;
 
 	signal = tracehook_notify_death(tsk, &cookie, group_dead);