All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin KaFai Lau <kafai@fb.com>
To: John Fastabend <john.fastabend@gmail.com>
Cc: <jakub@cloudflare.com>, <daniel@iogearbox.net>,
	<netdev@vger.kernel.org>, <bpf@vger.kernel.org>, <ast@kernel.org>
Subject: Re: [PATCH 1/2] bpf: sockmap, msg_pop_data can incorrecty set an sge length
Date: Tue, 5 May 2020 11:59:44 -0700	[thread overview]
Message-ID: <20200505185944.wkwu47cat4k2awxr@kafai-mbp> (raw)
In-Reply-To: <158861288359.14306.7654891716919968144.stgit@john-Precision-5820-Tower>

On Mon, May 04, 2020 at 10:21:23AM -0700, John Fastabend wrote:
> When sk_msg_pop() is called where the pop operation is working on
> the end of a sge element and there is no additional trailing data
> and there _is_ data in front of pop, like the following case,
> 
> 
>    |____________a_____________|__pop__|
> 
> We have out of order operations where we incorrectly set the pop
> variable so that instead of zero'ing pop we incorrectly leave it
> untouched, effectively. This can cause later logic to shift the
> buffers around believing it should pop extra space. The result is
> we have 'popped' more data then we expected potentially breaking
> program logic.
> 
> It took us a while to hit this case because typically we pop headers
> which seem to rarely be at the end of a scatterlist elements but
> we can't rely on this.
> 
> Fixes: 7246d8ed4dcce ("bpf: helper to pop data from messages")
> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>

  reply	other threads:[~2020-05-05 19:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-04 17:21 [PATCH 0/2] sockmap, fix for some error paths with helpers John Fastabend
2020-05-04 17:21 ` [PATCH 1/2] bpf: sockmap, msg_pop_data can incorrecty set an sge length John Fastabend
2020-05-05 18:59   ` Martin KaFai Lau [this message]
2020-05-04 17:21 ` [PATCH 2/2] bpf: sockmap, bpf_tcp_ingress needs to subtract bytes from sg.size John Fastabend
2020-05-05 19:05   ` Martin KaFai Lau
2020-05-05  9:30 ` [PATCH 0/2] sockmap, fix for some error paths with helpers Jakub Sitnicki
2020-05-05 22:28 ` Daniel Borkmann

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=20200505185944.wkwu47cat4k2awxr@kafai-mbp \
    --to=kafai@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jakub@cloudflare.com \
    --cc=john.fastabend@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 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.