All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Jakub Sitnicki <jakub@cloudflare.com>,
	John Fastabend <john.fastabend@gmail.com>
Cc: ast@kernel.org, daniel@iogearbox.net, bpf@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [bpf PATCH v2 5/6] bpf, sockmap: Handle memory acct if skb_verdict prog redirects to self
Date: Mon, 16 Nov 2020 14:28:39 -0800	[thread overview]
Message-ID: <5fb2fd1778fe5_b976208e5@john-XPS-13-9370.notmuch> (raw)
In-Reply-To: <87blfxweyj.fsf@cloudflare.com>

Jakub Sitnicki wrote:
> On Fri, Nov 13, 2020 at 12:27 AM CET, John Fastabend wrote:
> > If the skb_verdict_prog redirects an skb knowingly to itself, fix your
> > BPF program this is not optimal and an abuse of the API please use
> > SK_PASS. That said there may be cases, such as socket load balancing,
> > where picking the socket is hashed based or otherwise picks the same
> > socket it was received on in some rare cases. If this happens we don't
> > want to confuse userspace giving them an EAGAIN error if we can avoid
> > it.

[...]
 
> 
> I think all the added checks boil down to having:
> 
> 	struct sock *sk = psock->sk;
> 
>         if (unlikely(skb->sk == sk))
>                 return sk_psock_skb_ingress_self(psock, skb);
> 
> ... on entry to sk_psock_skb_ingress().

Agree made the change and sent out v3 thanks. I also carried your
Reviewed-by through on patches 1-4 and 6.

Thanks for reviewing!

  reply	other threads:[~2020-11-16 22:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12 23:26 [bpf PATCH v2 0/6] sockmap fixes John Fastabend
2020-11-12 23:26 ` [bpf PATCH v2 1/6] bpf, sockmap: fix partial copy_page_to_iter so progress can still be made John Fastabend
2020-11-12 23:27 ` [bpf PATCH v2 2/6] bpf, sockmap: Ensure SO_RCVBUF memory is observed on ingress redirect John Fastabend
2020-11-12 23:27 ` [bpf PATCH v2 3/6] bpf, sockmap: Use truesize with sk_rmem_schedule() John Fastabend
2020-11-12 23:27 ` [bpf PATCH v2 4/6] bpf, sockmap: Avoid returning unneeded EAGAIN when redirecting to self John Fastabend
2020-11-12 23:27 ` [bpf PATCH v2 5/6] bpf, sockmap: Handle memory acct if skb_verdict prog redirects " John Fastabend
2020-11-16 14:31   ` Jakub Sitnicki
2020-11-16 22:28     ` John Fastabend [this message]
2020-11-12 23:28 ` [bpf PATCH v2 6/6] bpf, sockmap: Avoid failures from skb_to_sgvec when skb has frag_list John Fastabend
2020-11-16 14:49 ` [bpf PATCH v2 0/6] sockmap fixes Jakub Sitnicki

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=5fb2fd1778fe5_b976208e5@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 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.