All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.duyck@gmail.com>
To: John Fastabend <john.fastabend@gmail.com>
Cc: "Daniel Borkmann" <daniel@iogearbox.net>,
	"Jeff Kirsher" <jeffrey.t.kirsher@intel.com>,
	Netdev <netdev@vger.kernel.org>,
	"Björn Töpel" <bjorn.topel@intel.com>,
	intel-wired-lan <intel-wired-lan@lists.osuosl.org>,
	keith.busch@linux.intel.com, makita.toshiaki@lab.ntt.co.jp
Subject: Re: [Intel-wired-lan] [PATCH net/jkirsher] bpf, xdp, i40e: fix i40e_build_skb skb reserve and truesize
Date: Wed, 13 Jun 2018 10:10:21 -0700	[thread overview]
Message-ID: <CAKgT0Ud_1Tb3oQXJfq6ibcCvR3pk_Bz-OU1_PP_p=t2gfdnK9Q@mail.gmail.com> (raw)
In-Reply-To: <d56adbb7-12df-c197-1976-3eb161af8484@gmail.com>

On Wed, Jun 13, 2018 at 9:26 AM, John Fastabend
<john.fastabend@gmail.com> wrote:
> On 06/13/2018 02:04 AM, Daniel Borkmann wrote:
>> Using skb_reserve(skb, I40E_SKB_PAD + (xdp->data - xdp->data_hard_start))
>> is clearly wrong since I40E_SKB_PAD already points to the offset where
>> the original xdp->data was sitting since xdp->data_hard_start is defined
>> as xdp->data - i40e_rx_offset(rx_ring) where latter offsets to I40E_SKB_PAD
>> when build skb is used.
>>
>> However, also before cc5b114dcf98 ("bpf, i40e: add meta data support")
>> this seems broken since bpf_xdp_adjust_head() helper could have been used
>> to alter headroom and enlarge / shrink the frame and with that the assumption
>> that the xdp->data remains unchanged does not hold and would push a bogus
>> packet to upper stack.
>>
>> ixgbe got this right in 924708081629 ("ixgbe: add XDP support for pass and
>> drop actions"). In any case, fix it by removing the I40E_SKB_PAD from both
>> skb_reserve() and truesize calculation.
>>
>> Fixes: cc5b114dcf98 ("bpf, i40e: add meta data support")
>> Fixes: 0c8493d90b6b ("i40e: add XDP support for pass and drop actions")
>> Reported-by: Keith Busch <keith.busch@linux.intel.com>
>> Reported-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
>> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
>> Cc: Björn Töpel <bjorn.topel@intel.com>
>> Cc: John Fastabend <john.fastabend@gmail.com>
>> ---
>>  drivers/net/ethernet/intel/i40e/i40e_txrx.c | 7 +++----
>>  1 file changed, 3 insertions(+), 4 deletions(-)
>>
>
> Thanks! I missed this during review.
>
> Acked-by: John Fastabend <john.fastabend@gmail.com>

Looks good to me. Thanks for taking care of this.

Acked-by: Alexander Duyck <alexander.h.duyck@intel.com>

WARNING: multiple messages have this Message-ID (diff)
From: Alexander Duyck <alexander.duyck@gmail.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH net/jkirsher] bpf, xdp, i40e: fix i40e_build_skb skb reserve and truesize
Date: Wed, 13 Jun 2018 10:10:21 -0700	[thread overview]
Message-ID: <CAKgT0Ud_1Tb3oQXJfq6ibcCvR3pk_Bz-OU1_PP_p=t2gfdnK9Q@mail.gmail.com> (raw)
In-Reply-To: <d56adbb7-12df-c197-1976-3eb161af8484@gmail.com>

On Wed, Jun 13, 2018 at 9:26 AM, John Fastabend
<john.fastabend@gmail.com> wrote:
> On 06/13/2018 02:04 AM, Daniel Borkmann wrote:
>> Using skb_reserve(skb, I40E_SKB_PAD + (xdp->data - xdp->data_hard_start))
>> is clearly wrong since I40E_SKB_PAD already points to the offset where
>> the original xdp->data was sitting since xdp->data_hard_start is defined
>> as xdp->data - i40e_rx_offset(rx_ring) where latter offsets to I40E_SKB_PAD
>> when build skb is used.
>>
>> However, also before cc5b114dcf98 ("bpf, i40e: add meta data support")
>> this seems broken since bpf_xdp_adjust_head() helper could have been used
>> to alter headroom and enlarge / shrink the frame and with that the assumption
>> that the xdp->data remains unchanged does not hold and would push a bogus
>> packet to upper stack.
>>
>> ixgbe got this right in 924708081629 ("ixgbe: add XDP support for pass and
>> drop actions"). In any case, fix it by removing the I40E_SKB_PAD from both
>> skb_reserve() and truesize calculation.
>>
>> Fixes: cc5b114dcf98 ("bpf, i40e: add meta data support")
>> Fixes: 0c8493d90b6b ("i40e: add XDP support for pass and drop actions")
>> Reported-by: Keith Busch <keith.busch@linux.intel.com>
>> Reported-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
>> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
>> Cc: Bj?rn T?pel <bjorn.topel@intel.com>
>> Cc: John Fastabend <john.fastabend@gmail.com>
>> ---
>>  drivers/net/ethernet/intel/i40e/i40e_txrx.c | 7 +++----
>>  1 file changed, 3 insertions(+), 4 deletions(-)
>>
>
> Thanks! I missed this during review.
>
> Acked-by: John Fastabend <john.fastabend@gmail.com>

Looks good to me. Thanks for taking care of this.

Acked-by: Alexander Duyck <alexander.h.duyck@intel.com>

  reply	other threads:[~2018-06-13 17:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-13  9:04 [PATCH net/jkirsher] bpf, xdp, i40e: fix i40e_build_skb skb reserve and truesize Daniel Borkmann
2018-06-13  9:04 ` [Intel-wired-lan] " Daniel Borkmann
2018-06-13 13:30 ` Keith Busch
2018-06-13 13:30   ` [Intel-wired-lan] " Keith Busch
2018-06-13 16:26 ` John Fastabend
2018-06-13 16:26   ` [Intel-wired-lan] " John Fastabend
2018-06-13 17:10   ` Alexander Duyck [this message]
2018-06-13 17:10     ` Alexander Duyck

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='CAKgT0Ud_1Tb3oQXJfq6ibcCvR3pk_Bz-OU1_PP_p=t2gfdnK9Q@mail.gmail.com' \
    --to=alexander.duyck@gmail.com \
    --cc=bjorn.topel@intel.com \
    --cc=daniel@iogearbox.net \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=john.fastabend@gmail.com \
    --cc=keith.busch@linux.intel.com \
    --cc=makita.toshiaki@lab.ntt.co.jp \
    --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 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.