Skip to contentSkip to conversation

selinux: Assign proper class to PF_UNIX/SOCK_RAW sockets

PATCH In review Luis Ressel 2 participants 2 messages Jun 18, 2017 – Jun 19, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selinux: Assign proper class to PF_UNIX/SOCK_RAW sockets

For PF_UNIX, SOCK_RAW is synonymous with SOCK_DGRAM (cf. net/unix/af_unix.c). This is a tad obscure, but libpcap uses it.

---
 security/selinux/hooks.c | 1 +
 1 file changed, 1 insertion(+)
security/selinux/hooks.c +1 -0
index 819fd6858b49..1a331fba4a3c 100644
@@ -1275,6 +1275,7 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
 		case SOCK_SEQPACKET:
 			return SECCLASS_UNIX_STREAM_SOCKET;
 		case SOCK_DGRAM:
+		case SOCK_RAW:
 			return SECCLASS_UNIX_DGRAM_SOCKET;
 		}
 		break;
Signature · 6 lines
2.13.1

--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Luis Ressel

For PF_UNIX, SOCK_RAW is synonymous with SOCK_DGRAM (cf. net/unix/af_unix.c). This is a tad obscure, but libpcap uses it.

No Signed-off-by?

Feel free to add my:

Quoted 17 lines

---
 security/selinux/hooks.c | 1 +

 1 file changed, 1 insertion(+)
security/selinux/hooks.c +0 -0
index 819fd6858b49..1a331fba4a3c 100644
@@ -1275,6 +1275,7 @@ static inline u16

socket_type_to_security_class(int family, int type, int protoc case SOCK_SEQPACKET:
  return SECCLASS_UNIX_STREAM_SOCKET; case SOCK_DGRAM:

security/selinux/hooks.c +1 -0
+		case SOCK_RAW:

  return SECCLASS_UNIX_DGRAM_SOCKET; }
  break;