Skip to contentSkip to conversation

iucv: properly clone LSM attributes to newly created child sockets

PATCH In review Paul Moore 2 participants 3 messages Jun 9, 2016

Subsystems (4)
lore
Share & tools
lore

Paul Moore

author
#0 lore raw

PATCH 1/1 iucv: properly clone LSM attributes to newly created child sockets

From: Paul Moore <[email protected]>

Much like we had to do for AF_BLUETOOTH and AF_ALG, make sure we properly clone the parent socket's LSM attributes to newly created child sockets.

---
 net/iucv/af_iucv.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/iucv/af_iucv.c +4 -1
index fc3598a..a0d1e36 100644
@@ -22,6 +22,7 @@
 #include <linux/skbuff.h>
 #include <linux/init.h>
 #include <linux/poll.h>
+#include <linux/security.h>
 #include <net/sock.h>
 #include <asm/ebcdic.h>
 #include <asm/cpcmd.h>
@@ -530,8 +531,10 @@ static void iucv_sock_close(struct sock *sk)
 
 static void iucv_sock_init(struct sock *sk, struct sock *parent)
 {
-	if (parent)
+	if (parent) {
 		sk->sk_type = parent->sk_type;
+		security_sk_clone(parent, sk);
+	}
 }
 
 static struct sock *iucv_sock_alloc(struct socket *sock, int proto, gfp_t prio, int kern)
author
#1 lore raw
Quoted 10 lines · Paul Moore

From: Paul Moore <[email protected]>

Much like we had to do for AF_BLUETOOTH and AF_ALG, make sure we properly clone the parent socket's LSM attributes to newly created child sockets.

---
 net/iucv/af_iucv.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Another small, and obvious, fix so I'm going to merge it into selinux#next now, but if anyone has an objection please let me know.

Quoted 25 lines
net/iucv/af_iucv.c +4 -1
index fc3598a..a0d1e36 100644
@@ -22,6 +22,7 @@
 #include <linux/skbuff.h>
 #include <linux/init.h>
 #include <linux/poll.h>
+#include <linux/security.h>
 #include <net/sock.h>
 #include <asm/ebcdic.h>
 #include <asm/cpcmd.h>
@@ -530,8 +531,10 @@ static void iucv_sock_close(struct sock *sk)
 
 static void iucv_sock_init(struct sock *sk, struct sock *parent)
 {
-       if (parent)
+       if (parent) {
                sk->sk_type = parent->sk_type;
+               security_sk_clone(parent, sk);
+       }
 }
 
 static struct sock *iucv_sock_alloc(struct socket *sock, int proto, gfp_t prio, int kern)
Signature · 2 lines
paul moore
security @ redhat
maintainer
#2 lore raw

From: Paul Moore <[email protected]>
Date: Thu, 9 Jun 2016 09:01:52 -0400

Quoted 7 lines · Paul Moore
Quoted 6 lines

From: Paul Moore <[email protected]>

Much like we had to do for AF_BLUETOOTH and AF_ALG, make sure we properly clone the parent socket's LSM attributes to newly created child sockets.

Quoted 7 lines
Quoted 4 lines
---
 net/iucv/af_iucv.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Another small, and obvious, fix so I'm going to merge it into selinux#next now, but if anyone has an objection please let me know.

This is fine.