public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: Daniel Axtens <dja@axtens.net>,
	ast@kernel.org, netdev@vger.kernel.org,
	Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Subject: Re: [PATCH bpf] bpf: fix bpf_skb_adjust_net/bpf_skb_proto_xlat to deal with gso sctp skbs
Date: Sat, 3 Mar 2018 13:08:16 -0800	[thread overview]
Message-ID: <20180303210814.g3eashpcdudk4pgz@ast-mbp> (raw)
In-Reply-To: <98ceaf0e-1f53-36f4-3310-3ceae1a9ff2d@iogearbox.net>

On Sat, Mar 03, 2018 at 09:57:15PM +0100, Daniel Borkmann wrote:
> On 03/03/2018 05:02 PM, Daniel Axtens wrote:
> >> From: Daniel Axtens <dja@axtens.net>
> >>
> >> SCTP GSO skbs have a gso_size of GSO_BY_FRAGS, so any sort of
> >> unconditionally mangling of that will result in nonsense value
> >> and would corrupt the skb later on.
> >>
> >> Therefore, i) add two helpers skb_increase_gso_size() and
> >> skb_decrease_gso_size() that would throw a one time warning and
> >> bail out for such skbs and ii) refuse and return early with an
> >> error in those BPF helpers that are affected. We do need to bail
> >> out as early as possible from there before any changes on the
> >> skb have been performed.
> >>
> >> Fixes: 6578171a7ff0 ("bpf: add bpf_skb_change_proto helper")
> >> Co-authored-by: Daniel Borkmann <daniel@iogearbox.net>
> >> Signed-off-by: Daniel Axtens <dja@axtens.net>
> >> Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> >> Acked-by: Alexei Starovoitov <ast@kernel.org>
> > 
> > I've looked over your changes and they all look good to me.
> > 
> >> +/* Note: Should be called only if skb_is_gso(skb) is true */
> >> +static inline bool skb_is_gso_sctp(const struct sk_buff *skb)
> >> +{
> >> +	return skb_shinfo(skb)->gso_type & SKB_GSO_SCTP;
> >> +}
> >> +
> > 
> > This helper is a fantastic idea and I will send a docs update to
> > highlight it.
> 
> Sounds good. There are infact several places in the code that
> could make use of this right away. If you have a chance, this
> could be done in net-next along with the doc update or so.

Applied to bpf tree, Thanks everyone.

      reply	other threads:[~2018-03-03 21:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-03  2:03 [PATCH bpf] bpf: fix bpf_skb_adjust_net/bpf_skb_proto_xlat to deal with gso sctp skbs Daniel Borkmann
2018-03-03 16:02 ` Daniel Axtens
2018-03-03 20:57   ` Daniel Borkmann
2018-03-03 21:08     ` Alexei Starovoitov [this message]

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=20180303210814.g3eashpcdudk4pgz@ast-mbp \
    --to=alexei.starovoitov@gmail.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dja@axtens.net \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox