All of lore.kernel.org
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@fb.com>
To: Martin Lau <kafai@fb.com>
Cc: "bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	Networking <netdev@vger.kernel.org>,
	Alexei Starovoitov <ast@fb.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	David Miller <davem@davemloft.net>,
	Kernel Team <Kernel-team@fb.com>,
	Tom Herbert <tom@herbertland.com>
Subject: Re: [PATCH bpf 2/2] bpf: udp: Avoid calling reuseport's bpf_prog from udp_gro
Date: Sat, 1 Jun 2019 23:54:46 +0000	[thread overview]
Message-ID: <AB1E485E-DAEE-49BD-BC86-1299C6830B7F@fb.com> (raw)
In-Reply-To: <20190531222913.2500781-1-kafai@fb.com>



> On May 31, 2019, at 3:29 PM, Martin KaFai Lau <kafai@fb.com> wrote:
> 
> When the commit a6024562ffd7 ("udp: Add GRO functions to UDP socket")
> added udp[46]_lib_lookup_skb to the udp_gro code path, it broke
> the reuseport_select_sock() assumption that skb->data is pointing
> to the transport header.
> 
> This patch follows an earlier __udp6_lib_err() fix by
> passing a NULL skb to avoid calling the reuseport's bpf_prog.
> 
> Fixes: a6024562ffd7 ("udp: Add GRO functions to UDP socket")
> Cc: Tom Herbert <tom@herbertland.com>
> Signed-off-by: Martin KaFai Lau <kafai@fb.com>
> ---
> net/ipv4/udp.c | 6 +++++-
> net/ipv6/udp.c | 2 +-
> 2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index 8fb250ed53d4..85db0e3d7f3f 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -503,7 +503,11 @@ static inline struct sock *__udp4_lib_lookup_skb(struct sk_buff *skb,
> struct sock *udp4_lib_lookup_skb(struct sk_buff *skb,
> 				 __be16 sport, __be16 dport)
> {
> -	return __udp4_lib_lookup_skb(skb, sport, dport, &udp_table);
> +	const struct iphdr *iph = ip_hdr(skb);
> +
> +	return __udp4_lib_lookup(dev_net(skb->dev), iph->saddr, sport,
> +				 iph->daddr, dport, inet_iif(skb),
> +				 inet_sdif(skb), &udp_table, NULL);

I think we can now remove the last argument of __udp4_lib_lookup()?


> }
> EXPORT_SYMBOL_GPL(udp4_lib_lookup_skb);
> 
> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> index 133e6370f89c..4e52c37bb836 100644
> --- a/net/ipv6/udp.c
> +++ b/net/ipv6/udp.c
> @@ -243,7 +243,7 @@ struct sock *udp6_lib_lookup_skb(struct sk_buff *skb,
> 
> 	return __udp6_lib_lookup(dev_net(skb->dev), &iph->saddr, sport,
> 				 &iph->daddr, dport, inet6_iif(skb),
> -				 inet6_sdif(skb), &udp_table, skb);
> +				 inet6_sdif(skb), &udp_table, NULL);
> }
> EXPORT_SYMBOL_GPL(udp6_lib_lookup_skb);
> 
> -- 
> 2.17.1
> 


  reply	other threads:[~2019-06-01 23:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31 22:29 [PATCH bpf 0/2] bpf: udp: A few reuseport's bpf_prog for udp lookup Martin KaFai Lau
2019-05-31 22:29 ` [PATCH bpf 1/2] bpf: udp: ipv6: Avoid running reuseport's bpf_prog from __udp6_lib_err Martin KaFai Lau
2019-06-01 23:54   ` Song Liu
2019-06-03 13:07   ` Craig Gallek
2019-05-31 22:29 ` [PATCH bpf 2/2] bpf: udp: Avoid calling reuseport's bpf_prog from udp_gro Martin KaFai Lau
2019-06-01 23:54   ` Song Liu [this message]
2019-06-02  1:09     ` Martin Lau
2019-06-02  7:05       ` Song Liu
2019-06-03 20:42 ` [PATCH bpf 0/2] bpf: udp: A few reuseport's bpf_prog for udp lookup Alexei Starovoitov

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=AB1E485E-DAEE-49BD-BC86-1299C6830B7F@fb.com \
    --to=songliubraving@fb.com \
    --cc=Kernel-team@fb.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=kafai@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=tom@herbertland.com \
    /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.