diff options
author | Serge E. Hallyn <serue@us.ibm.com> | 2007-11-28 19:21:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-29 12:24:53 -0500 |
commit | 8ec2328f1138a58eaea55ec6150985a1623b01c5 (patch) | |
tree | ebaecf41dd8c8789f0c49ee9c0f30c0ce40e3e39 /security | |
parent | d0eec99ce50baa5cc2ac02363cdb2a771ed4e1e2 (diff) |
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.
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Cc: Andrew Morgan <morgan@kernel.org>
Cc: Stephen Smalley <sds@epoch.ncsc.mil>
Cc: Chris Wright <chrisw@sous-sol.org>
Cc: James Morris <jmorris@namei.org>
Cc: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'security')
-rw-r--r-- | security/commoncap.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/security/commoncap.c b/security/commoncap.c index 302e8d0839a9..5bc1895f3f9c 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
@@ -526,6 +526,15 @@ int cap_task_kill(struct task_struct *p, struct siginfo *info, | |||
526 | if (info != SEND_SIG_NOINFO && (is_si_special(info) || SI_FROMKERNEL(info))) | 526 | if (info != SEND_SIG_NOINFO && (is_si_special(info) || SI_FROMKERNEL(info))) |
527 | return 0; | 527 | return 0; |
528 | 528 | ||
529 | /* | ||
530 | * Running a setuid root program raises your capabilities. | ||
531 | * Killing your own setuid root processes was previously | ||
532 | * allowed. | ||
533 | * We must preserve legacy signal behavior in this case. | ||
534 | */ | ||
535 | if (p->euid == 0 && p->uid == current->uid) | ||
536 | return 0; | ||
537 | |||
529 | /* sigcont is permitted within same session */ | 538 | /* sigcont is permitted within same session */ |
530 | if (sig == SIGCONT && (task_session_nr(current) == task_session_nr(p))) | 539 | if (sig == SIGCONT && (task_session_nr(current) == task_session_nr(p))) |
531 | return 0; | 540 | return 0; |