@@ -5825,6 +5825,11 @@ static unsigned int selinux_ipv6_postroute(void *priv,
#endif /* CONFIG_NETFILTER */
+static int selinux_netlink_receive(struct sock *sk, struct sk_buff *skb)
+{
+ return sock_has_perm(current, sk, NETLINK_ROUTE_SOCKET__NLMSG_READPRIV);
+}
+
static int selinux_netlink_send(struct sock *sk, struct sk_buff *skb)
{
return selinux_nlmsg_perm(sk, skb);
@@ -6765,6 +6770,7 @@ static struct security_hook_list selinux_hooks[] __lsm_ro_after_init = {
LSM_HOOK_INIT(syslog, selinux_syslog),
LSM_HOOK_INIT(vm_enough_memory, selinux_vm_enough_memory),
+ LSM_HOOK_INIT(netlink_receive, selinux_netlink_receive),
LSM_HOOK_INIT(netlink_send, selinux_netlink_send),
LSM_HOOK_INIT(bprm_set_creds, selinux_bprm_set_creds),
@@ -115,7 +115,7 @@ struct security_class_mapping secclass_map[] = {
{ COMMON_IPC_PERMS, NULL } },
{ "netlink_route_socket",
{ COMMON_SOCK_PERMS,
- "nlmsg_read", "nlmsg_write", NULL } },
+ "nlmsg_read", "nlmsg_write", "nlmsg_readpriv", NULL } },
{ "netlink_tcpdiag_socket",
{ COMMON_SOCK_PERMS,
"nlmsg_read", "nlmsg_write", NULL } },
Add the nlmsg_readpriv permission to netlink_route socket class. Currently this is only used to restrict MAC address access. Signed-off-by: Jeff Vander Stoep <jeffv@google.com> --- security/selinux/hooks.c | 6 ++++++ security/selinux/include/classmap.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)