aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux
diff options
context:
space:
mode:
authorDavid Quigley <dpquigl@tycho.nsa.gov>2006-06-30 04:55:46 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-30 14:25:36 -0400
commitf9008e4c5c525941967b67777945aa6266ab6326 (patch)
treea0c9436485b80d548ef74d5f1aec0f6d0309af6e /security/selinux
parented11d9eb2228acc483c819ab353e3c41bcb158fa (diff)
[PATCH] SELinux: extend task_kill hook to handle signals sent by AIO completion
This patch extends the security_task_kill hook to handle signals sent by AIO completion. In this case, the secid of the task responsible for the signal needs to be obtained and saved earlier, so a security_task_getsecid() hook is added, and then this saved value is passed subsequently to the extended task_kill hook for use in checking. Signed-off-by: David Quigley <dpquigl@tycho.nsa.gov> Signed-off-by: James Morris <jmorris@namei.org> Cc: Stephen Smalley <sds@tycho.nsa.gov> Cc: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'security/selinux')
-rw-r--r--security/selinux/hooks.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index b85afcf38527..a5189a347354 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2644,6 +2644,11 @@ static int selinux_task_getsid(struct task_struct *p)
2644 return task_has_perm(current, p, PROCESS__GETSESSION); 2644 return task_has_perm(current, p, PROCESS__GETSESSION);
2645} 2645}
2646 2646
2647static void selinux_task_getsecid(struct task_struct *p, u32 *secid)
2648{
2649 selinux_get_task_sid(p, secid);
2650}
2651
2647static int selinux_task_setgroups(struct group_info *group_info) 2652static int selinux_task_setgroups(struct group_info *group_info)
2648{ 2653{
2649 /* See the comment for setuid above. */ 2654 /* See the comment for setuid above. */
@@ -2700,12 +2705,14 @@ static int selinux_task_movememory(struct task_struct *p)
2700 return task_has_perm(current, p, PROCESS__SETSCHED); 2705 return task_has_perm(current, p, PROCESS__SETSCHED);
2701} 2706}
2702 2707
2703static int selinux_task_kill(struct task_struct *p, struct siginfo *info, int sig) 2708static int selinux_task_kill(struct task_struct *p, struct siginfo *info,
2709 int sig, u32 secid)
2704{ 2710{
2705 u32 perm; 2711 u32 perm;
2706 int rc; 2712 int rc;
2713 struct task_security_struct *tsec;
2707 2714
2708 rc = secondary_ops->task_kill(p, info, sig); 2715 rc = secondary_ops->task_kill(p, info, sig, secid);
2709 if (rc) 2716 if (rc)
2710 return rc; 2717 return rc;
2711 2718
@@ -2716,8 +2723,12 @@ static int selinux_task_kill(struct task_struct *p, struct siginfo *info, int si
2716 perm = PROCESS__SIGNULL; /* null signal; existence test */ 2723 perm = PROCESS__SIGNULL; /* null signal; existence test */
2717 else 2724 else
2718 perm = signal_to_av(sig); 2725 perm = signal_to_av(sig);
2719 2726 tsec = p->security;
2720 return task_has_perm(current, p, perm); 2727 if (secid)
2728 rc = avc_has_perm(secid, tsec->sid, SECCLASS_PROCESS, perm, NULL);
2729 else
2730 rc = task_has_perm(current, p, perm);
2731 return rc;
2721} 2732}
2722 2733
2723static int selinux_task_prctl(int option, 2734static int selinux_task_prctl(int option,
@@ -4434,6 +4445,7 @@ static struct security_operations selinux_ops = {
4434 .task_setpgid = selinux_task_setpgid, 4445 .task_setpgid = selinux_task_setpgid,
4435 .task_getpgid = selinux_task_getpgid, 4446 .task_getpgid = selinux_task_getpgid,
4436 .task_getsid = selinux_task_getsid, 4447 .task_getsid = selinux_task_getsid,
4448 .task_getsecid = selinux_task_getsecid,
4437 .task_setgroups = selinux_task_setgroups, 4449 .task_setgroups = selinux_task_setgroups,
4438 .task_setnice = selinux_task_setnice, 4450 .task_setnice = selinux_task_setnice,
4439 .task_setioprio = selinux_task_setioprio, 4451 .task_setioprio = selinux_task_setioprio,