Commit b257bab5 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security

Pull SELinux fixes from James Morris.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
  selinux: selinux_setprocattr()->ptrace_parent() needs rcu_read_lock()
  selinux: fix broken peer recv check
parents dc0a6b4f c0c14395
...@@ -4334,8 +4334,10 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) ...@@ -4334,8 +4334,10 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
} }
err = avc_has_perm(sk_sid, peer_sid, SECCLASS_PEER, err = avc_has_perm(sk_sid, peer_sid, SECCLASS_PEER,
PEER__RECV, &ad); PEER__RECV, &ad);
if (err) if (err) {
selinux_netlbl_err(skb, err, 0); selinux_netlbl_err(skb, err, 0);
return err;
}
} }
if (secmark_active) { if (secmark_active) {
...@@ -5586,11 +5588,11 @@ static int selinux_setprocattr(struct task_struct *p, ...@@ -5586,11 +5588,11 @@ static int selinux_setprocattr(struct task_struct *p,
/* Check for ptracing, and update the task SID if ok. /* Check for ptracing, and update the task SID if ok.
Otherwise, leave SID unchanged and fail. */ Otherwise, leave SID unchanged and fail. */
ptsid = 0; ptsid = 0;
task_lock(p); rcu_read_lock();
tracer = ptrace_parent(p); tracer = ptrace_parent(p);
if (tracer) if (tracer)
ptsid = task_sid(tracer); ptsid = task_sid(tracer);
task_unlock(p); rcu_read_unlock();
if (tracer) { if (tracer) {
error = avc_has_perm(ptsid, sid, SECCLASS_PROCESS, error = avc_has_perm(ptsid, sid, SECCLASS_PROCESS,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment