Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8ec2328f1138a58eaea55ec6150985a1623b01c5 Commit: 8ec2328f1138a58eaea55ec6150985a1623b01c5 Parent: d0eec99ce50baa5cc2ac02363cdb2a771ed4e1e2 Author: Serge E. Hallyn <[EMAIL PROTECTED]> AuthorDate: Wed Nov 28 16:21:47 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Thu Nov 29 09:24:53 2007 -0800
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 <[EMAIL PROTECTED]> Cc: Andrew Morgan <[EMAIL PROTECTED]> Cc: Stephen Smalley <[EMAIL PROTECTED]> Cc: Chris Wright <[EMAIL PROTECTED]> Cc: James Morris <[EMAIL PROTECTED]> Cc: Casey Schaufler <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- 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; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html