From: John Fastabend <john.fastabend@gmail.com>
To: Daniel Borkmann <daniel@iogearbox.net>,
John Fastabend <john.fastabend@gmail.com>,
ast@kernel.org, jakub@cloudflare.com
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [bpf PATCH 1/5] bpf, sockmap: fix partial copy_page_to_iter so progress can still be made
Date: Thu, 12 Nov 2020 11:56:30 -0800 [thread overview]
Message-ID: <5fad936eeee38_2a6120874@john-XPS-13-9370.notmuch> (raw)
In-Reply-To: <1aa5f637-c044-3dc6-09d5-0b5dc0521f91@iogearbox.net>
Daniel Borkmann wrote:
> On 11/7/20 8:37 PM, John Fastabend wrote:
> > If copy_page_to_iter() fails or even partially completes, but with fewer
> > bytes copied than expected we currently reset sg.start and return EFAULT.
> > This proves problematic if we already copied data into the user buffer
> > before we return an error. Because we leave the copied data in the user
> > buffer and fail to unwind the scatterlist so kernel side believes data
> > has been copied and user side believes data has _not_ been received.
[...]
> > + if (!copy) {
> > + return copied ? copied : -EFAULT;
> > }
>
> nit: no need for {}
>
> >
> > copied += copy;
> > @@ -56,6 +55,11 @@ int __tcp_bpf_recvmsg(struct sock *sk, struct sk_psock *psock,
> > put_page(page);
> > }
> > } else {
> > + /* Lets not optimize peek case if copy_page_to_iter
> > + * didn't copy the entire length lets just break.
> > + */
> > + if (copy != sge->length)
> > + goto out;
>
> nit: return copied;
>
> Rest lgtm for this one.
Great, thanks for the review will fixup in v2.
next prev parent reply other threads:[~2020-11-12 19:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-07 19:37 [bpf PATCH 0/5] sockmap fixes John Fastabend
2020-11-07 19:37 ` [bpf PATCH 1/5] bpf, sockmap: fix partial copy_page_to_iter so progress can still be made John Fastabend
2020-11-12 0:19 ` Daniel Borkmann
2020-11-12 19:56 ` John Fastabend [this message]
2020-11-07 19:38 ` [bpf PATCH 2/5] bpf, sockmap: Ensure SO_RCVBUF memory is observed on ingress redirect John Fastabend
2020-11-07 19:38 ` [bpf PATCH 3/5] bpf, sockmap: Avoid returning unneeded EAGAIN when redirecting to self John Fastabend
2020-11-12 0:22 ` Daniel Borkmann
2020-11-12 19:52 ` John Fastabend
2020-11-07 19:38 ` [bpf PATCH 4/5] bpf, sockmap: Handle memory acct if skb_verdict prog redirects " John Fastabend
2020-11-07 19:39 ` [bpf PATCH 5/5] bpf, sockmap: Avoid failures from skb_to_sgvec when skb has frag_list John Fastabend
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=5fad936eeee38_2a6120874@john-XPS-13-9370.notmuch \
--to=john.fastabend@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jakub@cloudflare.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