aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-15 12:00:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-15 12:00:47 -0400
commit6c373ca89399c5a3f7ef210ad8f63dc3437da345 (patch)
tree74d1ec65087df1da1021b43ac51acc1ee8601809 /security
parentbb0fd7ab0986105765d11baa82e619c618a235aa (diff)
parent9f9151412dd7aae0e3f51a89ae4a1f8755fdb4d0 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: 1) Add BQL support to via-rhine, from Tino Reichardt. 2) Integrate SWITCHDEV layer support into the DSA layer, so DSA drivers can support hw switch offloading. From Floria Fainelli. 3) Allow 'ip address' commands to initiate multicast group join/leave, from Madhu Challa. 4) Many ipv4 FIB lookup optimizations from Alexander Duyck. 5) Support EBPF in cls_bpf classifier and act_bpf action, from Daniel Borkmann. 6) Remove the ugly compat support in ARP for ugly layers like ax25, rose, etc. And use this to clean up the neigh layer, then use it to implement MPLS support. All from Eric Biederman. 7) Support L3 forwarding offloading in switches, from Scott Feldman. 8) Collapse the LOCAL and MAIN ipv4 FIB tables when possible, to speed up route lookups even further. From Alexander Duyck. 9) Many improvements and bug fixes to the rhashtable implementation, from Herbert Xu and Thomas Graf. In particular, in the case where an rhashtable user bulk adds a large number of items into an empty table, we expand the table much more sanely. 10) Don't make the tcp_metrics hash table per-namespace, from Eric Biederman. 11) Extend EBPF to access SKB fields, from Alexei Starovoitov. 12) Split out new connection request sockets so that they can be established in the main hash table. Much less false sharing since hash lookups go direct to the request sockets instead of having to go first to the listener then to the request socks hashed underneath. From Eric Dumazet. 13) Add async I/O support for crytpo AF_ALG sockets, from Tadeusz Struk. 14) Support stable privacy address generation for RFC7217 in IPV6. From Hannes Frederic Sowa. 15) Hash network namespace into IP frag IDs, also from Hannes Frederic Sowa. 16) Convert PTP get/set methods to use 64-bit time, from Richard Cochran. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1816 commits) fm10k: Bump driver version to 0.15.2 fm10k: corrected VF multicast update fm10k: mbx_update_max_size does not drop all oversized messages fm10k: reset head instead of calling update_max_size fm10k: renamed mbx_tx_dropped to mbx_tx_oversized fm10k: update xcast mode before synchronizing multicast addresses fm10k: start service timer on probe fm10k: fix function header comment fm10k: comment next_vf_mbx flow fm10k: don't handle mailbox events in iov_event path and always process mailbox fm10k: use separate workqueue for fm10k driver fm10k: Set PF queues to unlimited bandwidth during virtualization fm10k: expose tx_timeout_count as an ethtool stat fm10k: only increment tx_timeout_count in Tx hang path fm10k: remove extraneous "Reset interface" message fm10k: separate PF only stats so that VF does not display them fm10k: use hw->mac.max_queues for stats fm10k: only show actual queues, not the maximum in hardware fm10k: allow creation of VLAN on default vid fm10k: fix unused warnings ...
Diffstat (limited to 'security')
-rw-r--r--security/capability.c6
-rw-r--r--security/security.c5
-rw-r--r--security/selinux/hooks.c35
-rw-r--r--security/selinux/nlmsgtab.c13
-rw-r--r--security/smack/smack_netfilter.c8
5 files changed, 24 insertions, 43 deletions
diff --git a/security/capability.c b/security/capability.c
index bdf22034a961..0d03fcc489a4 100644
--- a/security/capability.c
+++ b/security/capability.c
@@ -776,11 +776,6 @@ static int cap_tun_dev_open(void *security)
776{ 776{
777 return 0; 777 return 0;
778} 778}
779
780static void cap_skb_owned_by(struct sk_buff *skb, struct sock *sk)
781{
782}
783
784#endif /* CONFIG_SECURITY_NETWORK */ 779#endif /* CONFIG_SECURITY_NETWORK */
785 780
786#ifdef CONFIG_SECURITY_NETWORK_XFRM 781#ifdef CONFIG_SECURITY_NETWORK_XFRM
@@ -1134,7 +1129,6 @@ void __init security_fixup_ops(struct security_operations *ops)
1134 set_to_cap_if_null(ops, tun_dev_open); 1129 set_to_cap_if_null(ops, tun_dev_open);
1135 set_to_cap_if_null(ops, tun_dev_attach_queue); 1130 set_to_cap_if_null(ops, tun_dev_attach_queue);
1136 set_to_cap_if_null(ops, tun_dev_attach); 1131 set_to_cap_if_null(ops, tun_dev_attach);
1137 set_to_cap_if_null(ops, skb_owned_by);
1138#endif /* CONFIG_SECURITY_NETWORK */ 1132#endif /* CONFIG_SECURITY_NETWORK */
1139#ifdef CONFIG_SECURITY_NETWORK_XFRM 1133#ifdef CONFIG_SECURITY_NETWORK_XFRM
1140 set_to_cap_if_null(ops, xfrm_policy_alloc_security); 1134 set_to_cap_if_null(ops, xfrm_policy_alloc_security);
diff --git a/security/security.c b/security/security.c
index ed890c6d31c5..730ac65a5737 100644
--- a/security/security.c
+++ b/security/security.c
@@ -1359,11 +1359,6 @@ int security_tun_dev_open(void *security)
1359} 1359}
1360EXPORT_SYMBOL(security_tun_dev_open); 1360EXPORT_SYMBOL(security_tun_dev_open);
1361 1361
1362void security_skb_owned_by(struct sk_buff *skb, struct sock *sk)
1363{
1364 security_ops->skb_owned_by(skb, sk);
1365}
1366
1367#endif /* CONFIG_SECURITY_NETWORK */ 1362#endif /* CONFIG_SECURITY_NETWORK */
1368 1363
1369#ifdef CONFIG_SECURITY_NETWORK_XFRM 1364#ifdef CONFIG_SECURITY_NETWORK_XFRM
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index e119cdcffc87..c318b304ee2f 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -51,7 +51,6 @@
51#include <linux/tty.h> 51#include <linux/tty.h>
52#include <net/icmp.h> 52#include <net/icmp.h>
53#include <net/ip.h> /* for local_port_range[] */ 53#include <net/ip.h> /* for local_port_range[] */
54#include <net/sock.h>
55#include <net/tcp.h> /* struct or_callable used in sock_rcv_skb */ 54#include <net/tcp.h> /* struct or_callable used in sock_rcv_skb */
56#include <net/inet_connection_sock.h> 55#include <net/inet_connection_sock.h>
57#include <net/net_namespace.h> 56#include <net/net_namespace.h>
@@ -4646,11 +4645,6 @@ static void selinux_inet_conn_established(struct sock *sk, struct sk_buff *skb)
4646 selinux_skb_peerlbl_sid(skb, family, &sksec->peer_sid); 4645 selinux_skb_peerlbl_sid(skb, family, &sksec->peer_sid);
4647} 4646}
4648 4647
4649static void selinux_skb_owned_by(struct sk_buff *skb, struct sock *sk)
4650{
4651 skb_set_owner_w(skb, sk);
4652}
4653
4654static int selinux_secmark_relabel_packet(u32 sid) 4648static int selinux_secmark_relabel_packet(u32 sid)
4655{ 4649{
4656 const struct task_security_struct *__tsec; 4650 const struct task_security_struct *__tsec;
@@ -4852,21 +4846,17 @@ static unsigned int selinux_ip_forward(struct sk_buff *skb,
4852 4846
4853static unsigned int selinux_ipv4_forward(const struct nf_hook_ops *ops, 4847static unsigned int selinux_ipv4_forward(const struct nf_hook_ops *ops,
4854 struct sk_buff *skb, 4848 struct sk_buff *skb,
4855 const struct net_device *in, 4849 const struct nf_hook_state *state)
4856 const struct net_device *out,
4857 int (*okfn)(struct sk_buff *))
4858{ 4850{
4859 return selinux_ip_forward(skb, in, PF_INET); 4851 return selinux_ip_forward(skb, state->in, PF_INET);
4860} 4852}
4861 4853
4862#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 4854#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
4863static unsigned int selinux_ipv6_forward(const struct nf_hook_ops *ops, 4855static unsigned int selinux_ipv6_forward(const struct nf_hook_ops *ops,
4864 struct sk_buff *skb, 4856 struct sk_buff *skb,
4865 const struct net_device *in, 4857 const struct nf_hook_state *state)
4866 const struct net_device *out,
4867 int (*okfn)(struct sk_buff *))
4868{ 4858{
4869 return selinux_ip_forward(skb, in, PF_INET6); 4859 return selinux_ip_forward(skb, state->in, PF_INET6);
4870} 4860}
4871#endif /* IPV6 */ 4861#endif /* IPV6 */
4872 4862
@@ -4914,9 +4904,7 @@ static unsigned int selinux_ip_output(struct sk_buff *skb,
4914 4904
4915static unsigned int selinux_ipv4_output(const struct nf_hook_ops *ops, 4905static unsigned int selinux_ipv4_output(const struct nf_hook_ops *ops,
4916 struct sk_buff *skb, 4906 struct sk_buff *skb,
4917 const struct net_device *in, 4907 const struct nf_hook_state *state)
4918 const struct net_device *out,
4919 int (*okfn)(struct sk_buff *))
4920{ 4908{
4921 return selinux_ip_output(skb, PF_INET); 4909 return selinux_ip_output(skb, PF_INET);
4922} 4910}
@@ -5091,21 +5079,17 @@ static unsigned int selinux_ip_postroute(struct sk_buff *skb,
5091 5079
5092static unsigned int selinux_ipv4_postroute(const struct nf_hook_ops *ops, 5080static unsigned int selinux_ipv4_postroute(const struct nf_hook_ops *ops,
5093 struct sk_buff *skb, 5081 struct sk_buff *skb,
5094 const struct net_device *in, 5082 const struct nf_hook_state *state)
5095 const struct net_device *out,
5096 int (*okfn)(struct sk_buff *))
5097{ 5083{
5098 return selinux_ip_postroute(skb, out, PF_INET); 5084 return selinux_ip_postroute(skb, state->out, PF_INET);
5099} 5085}
5100 5086
5101#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 5087#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
5102static unsigned int selinux_ipv6_postroute(const struct nf_hook_ops *ops, 5088static unsigned int selinux_ipv6_postroute(const struct nf_hook_ops *ops,
5103 struct sk_buff *skb, 5089 struct sk_buff *skb,
5104 const struct net_device *in, 5090 const struct nf_hook_state *state)
5105 const struct net_device *out,
5106 int (*okfn)(struct sk_buff *))
5107{ 5091{
5108 return selinux_ip_postroute(skb, out, PF_INET6); 5092 return selinux_ip_postroute(skb, state->out, PF_INET6);
5109} 5093}
5110#endif /* IPV6 */ 5094#endif /* IPV6 */
5111 5095
@@ -6035,7 +6019,6 @@ static struct security_operations selinux_ops = {
6035 .tun_dev_attach_queue = selinux_tun_dev_attach_queue, 6019 .tun_dev_attach_queue = selinux_tun_dev_attach_queue,
6036 .tun_dev_attach = selinux_tun_dev_attach, 6020 .tun_dev_attach = selinux_tun_dev_attach,
6037 .tun_dev_open = selinux_tun_dev_open, 6021 .tun_dev_open = selinux_tun_dev_open,
6038 .skb_owned_by = selinux_skb_owned_by,
6039 6022
6040#ifdef CONFIG_SECURITY_NETWORK_XFRM 6023#ifdef CONFIG_SECURITY_NETWORK_XFRM
6041 .xfrm_policy_alloc_security = selinux_xfrm_policy_alloc, 6024 .xfrm_policy_alloc_security = selinux_xfrm_policy_alloc,
diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c
index 2df7b900e259..2bbb41822d8e 100644
--- a/security/selinux/nlmsgtab.c
+++ b/security/selinux/nlmsgtab.c
@@ -73,6 +73,9 @@ static struct nlmsg_perm nlmsg_route_perms[] =
73 { RTM_NEWMDB, NETLINK_ROUTE_SOCKET__NLMSG_WRITE }, 73 { RTM_NEWMDB, NETLINK_ROUTE_SOCKET__NLMSG_WRITE },
74 { RTM_DELMDB, NETLINK_ROUTE_SOCKET__NLMSG_WRITE }, 74 { RTM_DELMDB, NETLINK_ROUTE_SOCKET__NLMSG_WRITE },
75 { RTM_GETMDB, NETLINK_ROUTE_SOCKET__NLMSG_READ }, 75 { RTM_GETMDB, NETLINK_ROUTE_SOCKET__NLMSG_READ },
76 { RTM_NEWNSID, NETLINK_ROUTE_SOCKET__NLMSG_WRITE },
77 { RTM_DELNSID, NETLINK_ROUTE_SOCKET__NLMSG_READ },
78 { RTM_GETNSID, NETLINK_ROUTE_SOCKET__NLMSG_READ },
76}; 79};
77 80
78static struct nlmsg_perm nlmsg_tcpdiag_perms[] = 81static struct nlmsg_perm nlmsg_tcpdiag_perms[] =
@@ -100,6 +103,13 @@ static struct nlmsg_perm nlmsg_xfrm_perms[] =
100 { XFRM_MSG_FLUSHPOLICY, NETLINK_XFRM_SOCKET__NLMSG_WRITE }, 103 { XFRM_MSG_FLUSHPOLICY, NETLINK_XFRM_SOCKET__NLMSG_WRITE },
101 { XFRM_MSG_NEWAE, NETLINK_XFRM_SOCKET__NLMSG_WRITE }, 104 { XFRM_MSG_NEWAE, NETLINK_XFRM_SOCKET__NLMSG_WRITE },
102 { XFRM_MSG_GETAE, NETLINK_XFRM_SOCKET__NLMSG_READ }, 105 { XFRM_MSG_GETAE, NETLINK_XFRM_SOCKET__NLMSG_READ },
106 { XFRM_MSG_REPORT, NETLINK_XFRM_SOCKET__NLMSG_READ },
107 { XFRM_MSG_MIGRATE, NETLINK_XFRM_SOCKET__NLMSG_WRITE },
108 { XFRM_MSG_NEWSADINFO, NETLINK_XFRM_SOCKET__NLMSG_READ },
109 { XFRM_MSG_GETSADINFO, NETLINK_XFRM_SOCKET__NLMSG_READ },
110 { XFRM_MSG_NEWSPDINFO, NETLINK_XFRM_SOCKET__NLMSG_WRITE },
111 { XFRM_MSG_GETSPDINFO, NETLINK_XFRM_SOCKET__NLMSG_READ },
112 { XFRM_MSG_MAPPING, NETLINK_XFRM_SOCKET__NLMSG_READ },
103}; 113};
104 114
105static struct nlmsg_perm nlmsg_audit_perms[] = 115static struct nlmsg_perm nlmsg_audit_perms[] =
@@ -143,6 +153,8 @@ int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm)
143 153
144 switch (sclass) { 154 switch (sclass) {
145 case SECCLASS_NETLINK_ROUTE_SOCKET: 155 case SECCLASS_NETLINK_ROUTE_SOCKET:
156 /* RTM_MAX always point to RTM_SETxxxx, ie RTM_NEWxxx + 3 */
157 BUILD_BUG_ON(RTM_MAX != (RTM_NEWNSID + 3));
146 err = nlmsg_perm(nlmsg_type, perm, nlmsg_route_perms, 158 err = nlmsg_perm(nlmsg_type, perm, nlmsg_route_perms,
147 sizeof(nlmsg_route_perms)); 159 sizeof(nlmsg_route_perms));
148 break; 160 break;
@@ -153,6 +165,7 @@ int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm)
153 break; 165 break;
154 166
155 case SECCLASS_NETLINK_XFRM_SOCKET: 167 case SECCLASS_NETLINK_XFRM_SOCKET:
168 BUILD_BUG_ON(XFRM_MSG_MAX != XFRM_MSG_MAPPING);
156 err = nlmsg_perm(nlmsg_type, perm, nlmsg_xfrm_perms, 169 err = nlmsg_perm(nlmsg_type, perm, nlmsg_xfrm_perms,
157 sizeof(nlmsg_xfrm_perms)); 170 sizeof(nlmsg_xfrm_perms));
158 break; 171 break;
diff --git a/security/smack/smack_netfilter.c b/security/smack/smack_netfilter.c
index c952632afb0d..a455cfc9ec1f 100644
--- a/security/smack/smack_netfilter.c
+++ b/security/smack/smack_netfilter.c
@@ -23,9 +23,7 @@
23 23
24static unsigned int smack_ipv6_output(const struct nf_hook_ops *ops, 24static unsigned int smack_ipv6_output(const struct nf_hook_ops *ops,
25 struct sk_buff *skb, 25 struct sk_buff *skb,
26 const struct net_device *in, 26 const struct nf_hook_state *state)
27 const struct net_device *out,
28 int (*okfn)(struct sk_buff *))
29{ 27{
30 struct socket_smack *ssp; 28 struct socket_smack *ssp;
31 struct smack_known *skp; 29 struct smack_known *skp;
@@ -42,9 +40,7 @@ static unsigned int smack_ipv6_output(const struct nf_hook_ops *ops,
42 40
43static unsigned int smack_ipv4_output(const struct nf_hook_ops *ops, 41static unsigned int smack_ipv4_output(const struct nf_hook_ops *ops,
44 struct sk_buff *skb, 42 struct sk_buff *skb,
45 const struct net_device *in, 43 const struct nf_hook_state *state)
46 const struct net_device *out,
47 int (*okfn)(struct sk_buff *))
48{ 44{
49 struct socket_smack *ssp; 45 struct socket_smack *ssp;
50 struct smack_known *skp; 46 struct smack_known *skp;