[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5fb2fd1778fe5_b976208e5@john-XPS-13-9370.notmuch>
Date: Mon, 16 Nov 2020 14:28:39 -0800
From: John Fastabend <john.fastabend@...il.com>
To: Jakub Sitnicki <jakub@...udflare.com>,
John Fastabend <john.fastabend@...il.com>
Cc: ast@...nel.org, daniel@...earbox.net, bpf@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [bpf PATCH v2 5/6] bpf, sockmap: Handle memory acct if
skb_verdict prog redirects to self
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!
Powered by blists - more mailing lists