signals: cleanup security_task_kill() usage/implementation

Every implementation of ->task_kill() does nothing when the signal comes from
the kernel.  This is correct, but means that check_kill_permission() should
call security_task_kill() only for SI_FROMUSER() case, and we can remove the
same check from ->task_kill() implementations.

(sadly, check_kill_permission() is the last user of signal->session/__session
 but we can't s/task_session_nr/task_session/ here).

NOTE: Eric W.  Biederman pointed out cap_task_kill() should die, and I think
he is very right.

Signed-off-by: Oleg Nesterov <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: Serge Hallyn <[email protected]>
Cc: Roland McGrath <[email protected]>
Cc: Casey Schaufler <[email protected]>
Cc: David Quigley <[email protected]>
Cc: Eric Paris <[email protected]>
Cc: Harald Welte <[email protected]>
Cc: Pavel Emelyanov <[email protected]>
Cc: Stephen Smalley <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Oleg Nesterov 2008-04-30 00:52:42 -07:00 • committed by Linus Torvalds
commit 3b5e9e53c6
3 changed files with 14 additions and 25 deletions

View file

@ -3286,9 +3286,6 @@ static int selinux_task_kill(struct task_struct *p, struct siginfo *info,
if (rc)
return rc;
if (info != SEND_SIG_NOINFO && (is_si_special(info) || SI_FROMKERNEL(info)))
return 0;
if (!sig)
perm = PROCESS__SIGNULL; /* null signal; existence test */
else

View file

@ -1130,15 +1130,6 @@ static int smack_task_movememory(struct task_struct *p)
static int smack_task_kill(struct task_struct *p, struct siginfo *info,
int sig, u32 secid)
{
/*
* Special cases where signals really ought to go through
* in spite of policy. Stephen Smalley suggests it may
* make sense to change the caller so that it doesn't
* bother with the LSM hook in these cases.
*/
if (info != SEND_SIG_NOINFO &&
(is_si_special(info) || SI_FROMKERNEL(info)))
return 0;
/*
* Sending a signal requires that the sender
* can write the receiver.