From: "Serge E. Hallyn" <serue@us.ibm.com>
To: lkml <linux-kernel@vger.kernel.org>
Cc: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
linux-security-module@vger.kernel.org,
Andrew Morgan <morgan@kernel.org>,
Stephen Smalley <sds@epoch.ncsc.mil>,
Chris Wright <chrisw@sous-sol.org>,
chris@friedhoff.org
Subject: [PATCH] file capabilities: don't prevent signaling setuid root programs.
Date: Mon, 26 Nov 2007 12:00:28 -0600 [thread overview]
Message-ID: <20071126180028.GA9106@sergelap.austin.ibm.com> (raw)
This patch is needed to preserve legacy behavior when
CONFIG_SECURITY_FILE_CAPABILITIES=y. Without this patch, xinit can't
kill X, so manually starting X in runlevel 3 then exiting your window
manager will not cause X to exit.
thanks,
-serge
>From 81a6d780ad570f9a326fc27912ec0e373f5fa14f Mon Sep 17 00:00:00 2001
From: Serge E. Hallyn <serue@us.ibm.com>
Date: Tue, 20 Nov 2007 08:47:35 +0000
Subject: [PATCH] file capabilities: don't prevent signaling setuid root programs.
An unprivileged process must be able to kill a setuid root
program started by the same user. This is legacy behavior
needed for instance for xinit to kill X when the window manager
exits.
When an unprivileged user runs a setuid root program in !SECURE_NOROOT
mode, fP, fI, and fE are set full on, so pP' and pE' are full on.
Then cap_task_kill() prevents the user from signaling the setuid root
task. This is a change in behavior compared to when
!CONFIG_SECURITY_FILE_CAPABILITIES.
This patch introduces a special check into cap_task_kill() just
to check whether a non-root user is signaling a setuid root
program started by the same user. If so, then signal is allowed.
Changelog:
Nov 26: move test up above CAP_KILL test as per Andrew
Morgan's suggestion.
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 302e8d0..5bc1895 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;
+ /*
+ * Running a setuid root program raises your capabilities.
+ * Killing your own setuid root processes was previously
+ * allowed.
+ * We must preserve legacy signal behavior in this case.
+ */
+ if (p->euid == 0 && p->uid == current->uid)
+ return 0;
+
/* sigcont is permitted within same session */
if (sig == SIGCONT && (task_session_nr(current) == task_session_nr(p)))
return 0;
--
1.5.2.5
next reply other threads:[~2007-11-26 18:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-26 18:00 Serge E. Hallyn [this message]
2007-11-27 4:14 ` Andrew Morgan
2007-11-27 16:53 ` Serge E. Hallyn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071126180028.GA9106@sergelap.austin.ibm.com \
--to=serue@us.ibm.com \
--cc=akpm@osdl.org \
--cc=chris@friedhoff.org \
--cc=chrisw@sous-sol.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=morgan@kernel.org \
--cc=sds@epoch.ncsc.mil \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®