[PATCH] file capabilities: allow sigcont within session (v2)

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: lkml <linux-kernel@...>
Cc: <linux-security-module@...>, Andrew Morton <akpm@...>, Andrew Morgan <morgan@...>, Chris Wright <chrisw@...>, Theodore Ts'o <tytso@...>, Stephen Smalley <sds@...>, Rafael J. Wysocki <rjw@...>, Natalie Protasevich <protasnb@...>
Date: Wednesday, October 31, 2007 - 7:49 pm

From 5bff8967f45a35f858b96ca673d9bf98eac53d49 Mon Sep 17 00:00:00 2001
From: Serge E. Hallyn <serue@us.ibm.com>
Date: Wed, 31 Oct 2007 11:22:04 -0500
Subject: [PATCH 1/1] file capabilities: allow sigcont within session (v2)

(This is a proposed fix to http://bugzilla.kernel.org/show_bug.cgi?id=9247)

Allow sigcont to be sent to a process with greater capabilities
if it is in the same session.  Otherwise, a shell from which
I've started a root shell and done 'suspend' can't be restarted
by the parent shell.

Also don't do file-capabilities signaling checks when uids for
the processes don't match, since the standard check_kill_permission
will have done those checks.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
---
 security/commoncap.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/security/commoncap.c b/security/commoncap.c
index bf67871..4de6857 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -526,6 +526,15 @@ int cap_task_kill(struct task_struct *p, struct siginfo *info,
 	if (info != SEND_SIG_NOINFO && (is_si_special(info) || SI_FROMKERNEL(info)))
 		return 0;
 
+	/* if tasks have same uid, then check_kill_permission did check */
+	if (current->uid == p->uid || current->euid == p->uid ||
+		current->uid == p->suid || current->euid == p->suid)
+		return 0;
+
+	/* sigcont is permitted within same session */
+	if (sig == SIGCONT && (task_session_nr(current)==task_session_nr(p)))
+		return 0;
+
 	if (secid)
 		/*
 		 * Signal sent as a particular user.
-- 
1.5.1.1.GIT

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] file capabilities: allow sigcont within session (v2), Serge E. Hallyn, (Wed Oct 31, 7:49 pm)