From: Eric Dumazet <eric.dumazet@gmail.com>
To: Daniel Axtens <dja@axtens.net>, netdev@vger.kernel.org
Cc: Jason Wang <jasowang@redhat.com>, Pravin Shelar <pshelar@ovn.org>,
Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
Manish.Chopra@cavium.com, dev@openvswitch.org
Subject: Re: [PATCH v2 0/4] Check size of packets before sending
Date: Thu, 25 Jan 2018 04:40:36 -0800 [thread overview]
Message-ID: <1516884036.3715.45.camel@gmail.com> (raw)
In-Reply-To: <20180125043109.28332-1-dja@axtens.net>
On Thu, 2018-01-25 at 15:31 +1100, Daniel Axtens wrote:
> There are a few ways we can send packets that are too large to a
> network driver.
>
> When non-GSO packets are forwarded, we validate their size, based on
> the MTU of the destination device. However, when GSO packets are
> forwarded, we do not validate their size. We implicitly assume that
> when they are segmented, the resultant packets will be correctly
> sized.
>
> This is not always the case.
>
> We observed a case where a packet received on an ibmveth device had a
> GSO size of around 10kB. This was forwarded by Open vSwitch to a bnx2x
> device, where it caused a firmware assert. This is described in detail
> at [0] and was the genesis of this series.
>
> Rather than fixing this in the driver, this series fixes the
> core path. It does it in 2 steps:
>
> 1) make is_skb_forwardable check GSO packets - this catches bridges
>
> 2) make validate_xmit_skb check the size of all packets, so as to
> catch everything else (e.g. macvlan, tc mired, OVS)
>
> I am a bit nervous about how this series will interact with nested
> VLANs, as the existing code only allows for one VLAN_HLEN. (Previously
> these packets would sail past unchecked.) But I thought it would be
> prudent to get more eyes on this sooner rather than later.
>
> Thanks,
> Daniel
>
> v1: https://www.spinics.net/lists/netdev/msg478634.html
> Changes in v2:
>
> - improve names, thanks Marcelo Ricardo Leitner
>
> - add check to xmit_validate_skb; thanks to everyone who participated
> in the discussion.
>
> - drop extra check in Open vSwitch. Bad packets will be caught by
> validate_xmit_skb for now and we can come back and add it later if
> OVS people would like the extra logging.
>
> [0]: https://patchwork.ozlabs.org/patch/859410/
>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Pravin Shelar <pshelar@ovn.org>
> Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> Cc: Manish.Chopra@cavium.com
> Cc: dev@openvswitch.org
>
> Daniel Axtens (4):
> net: rename skb_gso_validate_mtu -> skb_gso_validate_network_len
> net: move skb_gso_mac_seglen to skbuff.h
> net: is_skb_forwardable: check the size of GSO segments
> net: check the size of a packet in validate_xmit_skb
>
> include/linux/skbuff.h | 18 ++++++++-
> net/core/dev.c | 24 ++++++++----
> net/core/skbuff.c | 66 ++++++++++++++++++++++++++-------
> net/ipv4/ip_forward.c | 2 +-
> net/ipv4/ip_output.c | 2 +-
> net/ipv4/netfilter/nf_flow_table_ipv4.c | 2 +-
> net/ipv6/ip6_output.c | 2 +-
> net/ipv6/netfilter/nf_flow_table_ipv6.c | 2 +-
> net/mpls/af_mpls.c | 2 +-
> net/sched/sch_tbf.c | 10 -----
> net/xfrm/xfrm_device.c | 2 +-
> 11 files changed, 93 insertions(+), 39 deletions(-)
>
May I ask which tree are you targeting ?
( Documentation/networking/netdev-FAQ.txt )
Anything touching GSO is very risky and should target net-next,
especially considering 4.15 is released this week end.
Are we really willing to backport this intrusive series in stable
trees, or do we have a smaller fix for bnx2x ?
Thanks.
next prev parent reply other threads:[~2018-01-25 12:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-25 4:31 [PATCH v2 0/4] Check size of packets before sending Daniel Axtens
2018-01-25 4:31 ` [PATCH v2 1/4] net: rename skb_gso_validate_mtu -> skb_gso_validate_network_len Daniel Axtens
2018-01-25 4:31 ` [PATCH v2 2/4] net: move skb_gso_mac_seglen to skbuff.h Daniel Axtens
2018-01-25 4:31 ` [PATCH v2 3/4] net: is_skb_forwardable: check the size of GSO segments Daniel Axtens
2018-01-25 4:31 ` [PATCH v2 4/4] net: check the size of a packet in validate_xmit_skb Daniel Axtens
2018-01-25 12:40 ` Eric Dumazet [this message]
[not found] ` <1516884036.3715.45.camel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-25 13:44 ` [PATCH v2 0/4] Check size of packets before sending Daniel Axtens
2018-01-25 14:35 ` Eric Dumazet
2018-01-29 3:20 ` Daniel Axtens
2018-01-29 16:37 ` David Miller
[not found] ` <20180125043109.28332-1-dja-Yfaxwxk/+vWsTnJN9+BGXg@public.gmane.org>
2018-01-25 15:24 ` Marcelo Ricardo Leitner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1516884036.3715.45.camel@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=Manish.Chopra@cavium.com \
--cc=dev@openvswitch.org \
--cc=dja@axtens.net \
--cc=jasowang@redhat.com \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pshelar@ovn.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.