aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
authorStephen Smalley <sds@tycho.nsa.gov>2017-09-08 12:40:01 -0400
committerJames Morris <james.morris@microsoft.com>2018-03-06 17:05:53 -0500
commit6b4f3d01052a479c7ebbe99d52a663558dc1be2a (patch)
tree430c1d7c7be50abb1fe71f88426a4376d37de3ab /security/selinux/hooks.c
parenta02633e9b13dcb9b1a656b08f81bc8ba2d4d2294 (diff)
usb, signal, security: only pass the cred, not the secid, to kill_pid_info_as_cred and security_task_kill
commit d178bc3a708f39cbfefc3fab37032d3f2511b4ec ("user namespace: usb: make usb urbs user namespace aware (v2)") changed kill_pid_info_as_uid to kill_pid_info_as_cred, saving and passing a cred structure instead of uids. Since the secid can be obtained from the cred, drop the secid fields from the usb_dev_state and async structures, and drop the secid argument to kill_pid_info_as_cred. Replace the secid argument to security_task_kill with the cred. Update SELinux, Smack, and AppArmor to use the cred, which avoids the need for Smack and AppArmor to use a secid at all in this hook. Further changes to Smack might still be required to take full advantage of this change, since it should now be possible to perform capability checking based on the supplied cred. The changes to Smack and AppArmor have only been compile-tested. Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov> Acked-by: Paul Moore <paul@paul-moore.com> Acked-by: Casey Schaufler <casey@schaufler-ca.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: John Johansen <john.johansen@canonical.com> Signed-off-by: James Morris <james.morris@microsoft.com>
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r--security/selinux/hooks.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 8644d864e3c1..8abd542c6b7c 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -4036,16 +4036,19 @@ static int selinux_task_movememory(struct task_struct *p)
4036} 4036}
4037 4037
4038static int selinux_task_kill(struct task_struct *p, struct siginfo *info, 4038static int selinux_task_kill(struct task_struct *p, struct siginfo *info,
4039 int sig, u32 secid) 4039 int sig, const struct cred *cred)
4040{ 4040{
4041 u32 secid;
4041 u32 perm; 4042 u32 perm;
4042 4043
4043 if (!sig) 4044 if (!sig)
4044 perm = PROCESS__SIGNULL; /* null signal; existence test */ 4045 perm = PROCESS__SIGNULL; /* null signal; existence test */
4045 else 4046 else
4046 perm = signal_to_av(sig); 4047 perm = signal_to_av(sig);
4047 if (!secid) 4048 if (!cred)
4048 secid = current_sid(); 4049 secid = current_sid();
4050 else
4051 secid = cred_sid(cred);
4049 return avc_has_perm(secid, task_sid(p), SECCLASS_PROCESS, perm, NULL); 4052 return avc_has_perm(secid, task_sid(p), SECCLASS_PROCESS, perm, NULL);
4050} 4053}
4051 4054