aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/selinux/hooks.c')
-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,