netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 net] openvswitch: Scrub skb between namespaces
@ 2015-10-16 18:08 Joe Stringer
  2015-10-16 18:08 ` [PATCHv2 net 1/3] openvswitch: Reject ct_state masks for unknown bits Joe Stringer
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Joe Stringer @ 2015-10-16 18:08 UTC (permalink / raw)
  To: netdev, pshelar; +Cc: tgraf, hannes, jesse

If OVS receives a packet from another namespace, then the packet should
be scrubbed. However, people have already begun to rely on the behaviour
that skb->mark is preserved across namespaces, so retain this one field.

This is mainly to address information leakage between namespaces when
using OVS internal ports, but by placing it in ovs_vport_receive() it is
more generally applicable, meaning it should not be overlooked if other
port types are allowed to be moved into namespaces in future.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
---
v2: Add unlikely(), shift all within the netns check block.
---
 net/openvswitch/vport.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index fc5c0b9ccfe9..12a36ac21eda 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -444,6 +444,15 @@ int ovs_vport_receive(struct vport *vport, struct sk_buff *skb,
 
 	OVS_CB(skb)->input_vport = vport;
 	OVS_CB(skb)->mru = 0;
+	if (unlikely(dev_net(skb->dev) != ovs_dp_get_net(vport->dp))) {
+		u32 mark;
+
+		mark = skb->mark;
+		skb_scrub_packet(skb, true);
+		skb->mark = mark;
+		tun_info = NULL;
+	}
+
 	/* Extract flow from 'skb' into 'key'. */
 	error = ovs_flow_key_extract(tun_info, skb, &key);
 	if (unlikely(error)) {
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-10-20  0:25 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-16 18:08 [PATCHv2 net] openvswitch: Scrub skb between namespaces Joe Stringer
2015-10-16 18:08 ` [PATCHv2 net 1/3] openvswitch: Reject ct_state masks for unknown bits Joe Stringer
2015-10-17  7:46   ` Thomas Graf
2015-10-16 18:08 ` [PATCHv2 net 2/3] openvswitch: Treat IP_CT_RELATED as new Joe Stringer
2015-10-17  7:52   ` Thomas Graf
2015-10-19  7:07     ` Joe Stringer
2015-10-19  9:03       ` Thomas Graf
2015-10-19 23:13         ` Joe Stringer
2015-10-20  0:25           ` Thomas Graf
2015-10-16 18:08 ` [PATCHv2 net 3/3] openvswitch: Serialize nested ct actions if provided Joe Stringer
2015-10-16 19:03   ` Pravin Shelar
2015-10-17  7:54   ` Thomas Graf
2015-10-16 18:47 ` [PATCHv2 net] openvswitch: Scrub skb between namespaces Pravin Shelar
2015-10-17  7:55 ` Thomas Graf
2015-10-19  5:25 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).