public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* Re: [PATCH v2 bpf-next 10/11] bpf: tcp: Support arbitrary SYN Cookie.
       [not found] <20231120222341.54776-11-kuniyu@amazon.com>
@ 2023-11-21  5:17 ` kernel test robot
  2023-11-21  5:37   ` Kuniyuki Iwashima
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2023-11-21  5:17 UTC (permalink / raw)
  To: Kuniyuki Iwashima, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, David Ahern, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Mykola Lysenko
  Cc: llvm, oe-kbuild-all, netdev, Kuniyuki Iwashima, bpf

Hi Kuniyuki,

kernel test robot noticed the following build errors:

[auto build test ERROR on bpf-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Kuniyuki-Iwashima/tcp-Clean-up-reverse-xmas-tree-in-cookie_v-46-_check/20231121-063036
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link:    https://lore.kernel.org/r/20231120222341.54776-11-kuniyu%40amazon.com
patch subject: [PATCH v2 bpf-next 10/11] bpf: tcp: Support arbitrary SYN Cookie.
config: arm-spear3xx_defconfig (https://download.01.org/0day-ci/archive/20231121/202311211310.E8pJEsnT-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231121/202311211310.E8pJEsnT-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311211310.E8pJEsnT-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from net/core/sock.c:142:
   In file included from include/net/tcp.h:32:
>> include/net/inet_hashtables.h:472:22: error: use of undeclared identifier 'sock_pfree'
                           skb->destructor = sock_pfree;
                                             ^
   1 error generated.
--
   In file included from net/core/filter.c:39:
   In file included from include/linux/skmsg.h:13:
   In file included from include/net/tcp.h:32:
>> include/net/inet_hashtables.h:472:22: error: use of undeclared identifier 'sock_pfree'
                           skb->destructor = sock_pfree;
                                             ^
   net/core/filter.c:11812:13: warning: declaration of 'struct tcp_cookie_attributes' will not be visible outside of this function [-Wvisibility]
                                           struct tcp_cookie_attributes *attr,
                                                  ^
   net/core/filter.c:11821:24: error: invalid application of 'sizeof' to an incomplete type 'struct tcp_cookie_attributes'
           if (attr__sz != sizeof(*attr))
                                 ^~~~~~~
   net/core/filter.c:11812:13: note: forward declaration of 'struct tcp_cookie_attributes'
                                           struct tcp_cookie_attributes *attr,
                                                  ^
   net/core/filter.c:11851:10: error: incomplete definition of type 'struct tcp_cookie_attributes'
           if (attr->tcp_opt.mss_clamp < min_mss) {
               ~~~~^
   net/core/filter.c:11812:13: note: forward declaration of 'struct tcp_cookie_attributes'
                                           struct tcp_cookie_attributes *attr,
                                                  ^
   net/core/filter.c:11856:10: error: incomplete definition of type 'struct tcp_cookie_attributes'
           if (attr->tcp_opt.wscale_ok &&
               ~~~~^
   net/core/filter.c:11812:13: note: forward declaration of 'struct tcp_cookie_attributes'
                                           struct tcp_cookie_attributes *attr,
                                                  ^
   net/core/filter.c:11857:10: error: incomplete definition of type 'struct tcp_cookie_attributes'
               attr->tcp_opt.snd_wscale > TCP_MAX_WSCALE) {
               ~~~~^
   net/core/filter.c:11812:13: note: forward declaration of 'struct tcp_cookie_attributes'
                                           struct tcp_cookie_attributes *attr,
                                                  ^
   net/core/filter.c:11875:17: error: incomplete definition of type 'struct tcp_cookie_attributes'
           req->mss = attr->tcp_opt.mss_clamp;
                      ~~~~^
   net/core/filter.c:11812:13: note: forward declaration of 'struct tcp_cookie_attributes'
                                           struct tcp_cookie_attributes *attr,
                                                  ^
   net/core/filter.c:11877:25: error: incomplete definition of type 'struct tcp_cookie_attributes'
           ireq->snd_wscale = attr->tcp_opt.snd_wscale;
                              ~~~~^
   net/core/filter.c:11812:13: note: forward declaration of 'struct tcp_cookie_attributes'
                                           struct tcp_cookie_attributes *attr,
                                                  ^
   net/core/filter.c:11878:24: error: incomplete definition of type 'struct tcp_cookie_attributes'
           ireq->wscale_ok = attr->tcp_opt.wscale_ok;
                             ~~~~^
   net/core/filter.c:11812:13: note: forward declaration of 'struct tcp_cookie_attributes'
                                           struct tcp_cookie_attributes *attr,
                                                  ^
   net/core/filter.c:11879:24: error: incomplete definition of type 'struct tcp_cookie_attributes'
           ireq->tstamp_ok = attr->tcp_opt.tstamp_ok;
                             ~~~~^
   net/core/filter.c:11812:13: note: forward declaration of 'struct tcp_cookie_attributes'
                                           struct tcp_cookie_attributes *attr,
                                                  ^
   net/core/filter.c:11880:22: error: incomplete definition of type 'struct tcp_cookie_attributes'
           ireq->sack_ok = attr->tcp_opt.sack_ok;
                           ~~~~^
   net/core/filter.c:11812:13: note: forward declaration of 'struct tcp_cookie_attributes'
                                           struct tcp_cookie_attributes *attr,
                                                  ^
   net/core/filter.c:11881:21: error: incomplete definition of type 'struct tcp_cookie_attributes'
           ireq->ecn_ok = attr->ecn_ok;
                          ~~~~^
   net/core/filter.c:11812:13: note: forward declaration of 'struct tcp_cookie_attributes'
                                           struct tcp_cookie_attributes *attr,
                                                  ^
   net/core/filter.c:11883:26: error: incomplete definition of type 'struct tcp_cookie_attributes'
           treq->req_usec_ts = attr->usec_ts_ok;
                               ~~~~^
   net/core/filter.c:11812:13: note: forward declaration of 'struct tcp_cookie_attributes'
                                           struct tcp_cookie_attributes *attr,
                                                  ^
>> net/core/filter.c:11887:20: error: use of undeclared identifier 'sock_pfree'
           skb->destructor = sock_pfree;
                             ^
   1 warning and 13 errors generated.


vim +/sock_pfree +472 include/net/inet_hashtables.h

   451	
   452	static inline
   453	struct sock *inet_steal_sock(struct net *net, struct sk_buff *skb, int doff,
   454				     const __be32 saddr, const __be16 sport,
   455				     const __be32 daddr, const __be16 dport,
   456				     bool *refcounted, inet_ehashfn_t *ehashfn)
   457	{
   458		struct sock *sk, *reuse_sk;
   459		bool prefetched;
   460	
   461		sk = skb_steal_sock(skb, refcounted, &prefetched);
   462		if (!sk)
   463			return NULL;
   464	
   465		if (!prefetched)
   466			return sk;
   467	
   468		if (sk->sk_state == TCP_NEW_SYN_RECV) {
   469			if (inet_reqsk(sk)->syncookie) {
   470				*refcounted = false;
   471				skb->sk = sk;
 > 472				skb->destructor = sock_pfree;
   473				return inet_reqsk(sk)->rsk_listener;
   474			}
   475			return sk;
   476		} else if (sk->sk_state == TCP_TIME_WAIT) {
   477			return sk;
   478		}
   479	
   480		if (sk->sk_protocol == IPPROTO_TCP) {
   481			if (sk->sk_state != TCP_LISTEN)
   482				return sk;
   483		} else if (sk->sk_protocol == IPPROTO_UDP) {
   484			if (sk->sk_state != TCP_CLOSE)
   485				return sk;
   486		} else {
   487			return sk;
   488		}
   489	
   490		reuse_sk = inet_lookup_reuseport(net, sk, skb, doff,
   491						 saddr, sport, daddr, ntohs(dport),
   492						 ehashfn);
   493		if (!reuse_sk)
   494			return sk;
   495	
   496		/* We've chosen a new reuseport sock which is never refcounted. This
   497		 * implies that sk also isn't refcounted.
   498		 */
   499		WARN_ON_ONCE(*refcounted);
   500	
   501		return reuse_sk;
   502	}
   503	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 bpf-next 10/11] bpf: tcp: Support arbitrary SYN Cookie.
  2023-11-21  5:17 ` [PATCH v2 bpf-next 10/11] bpf: tcp: Support arbitrary SYN Cookie kernel test robot
@ 2023-11-21  5:37   ` Kuniyuki Iwashima
  0 siblings, 0 replies; 2+ messages in thread
From: Kuniyuki Iwashima @ 2023-11-21  5:37 UTC (permalink / raw)
  To: lkp
  Cc: andrii, ast, bpf, daniel, davem, dsahern, edumazet, haoluo,
	john.fastabend, jolsa, kpsingh, kuba, kuniyu, llvm, martin.lau,
	mykolal, netdev, oe-kbuild-all, pabeni, sdf, song, yonghong.song

From: kernel test robot <lkp@intel.com>
Date: Tue, 21 Nov 2023 13:17:40 +0800
> Hi Kuniyuki,
> 
> kernel test robot noticed the following build errors:
> 
> [auto build test ERROR on bpf-next/master]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Kuniyuki-Iwashima/tcp-Clean-up-reverse-xmas-tree-in-cookie_v-46-_check/20231121-063036
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
> patch link:    https://lore.kernel.org/r/20231120222341.54776-11-kuniyu%40amazon.com
> patch subject: [PATCH v2 bpf-next 10/11] bpf: tcp: Support arbitrary SYN Cookie.
> config: arm-spear3xx_defconfig (https://download.01.org/0day-ci/archive/20231121/202311211310.E8pJEsnT-lkp@intel.com/config)
> compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231121/202311211310.E8pJEsnT-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202311211310.E8pJEsnT-lkp@intel.com/
> 
> All errors (new ones prefixed by >>):
> 
>    In file included from net/core/sock.c:142:
>    In file included from include/net/tcp.h:32:
> >> include/net/inet_hashtables.h:472:22: error: use of undeclared identifier 'sock_pfree'
>                            skb->destructor = sock_pfree;
>                                              ^

Ok, sock_pfree is available with CONFIG_INET.

I'll guard the req->syncookie part in inet6?_steal_sock() by
CONFIG_SYN_COOKIE too.

---8<---
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index b6c0ed5a1e3c..9a67f47a5e64 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -120,12 +120,14 @@ struct sock *inet6_steal_sock(struct net *net, struct sk_buff *skb, int doff,
 		return sk;
 
 	if (sk->sk_state == TCP_NEW_SYN_RECV) {
+#if IS_ENABLED(CONFIG_SYN_COOKIE)
 		if (inet_reqsk(sk)->syncookie) {
 			*refcounted = false;
 			skb->sk = sk;
 			skb->destructor = sock_pfree;
 			return inet_reqsk(sk)->rsk_listener;
 		}
+#endif
 		return sk;
 	} else if (sk->sk_state == TCP_TIME_WAIT) {
 		return sk;
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 0f4091112967..36609656a047 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -466,12 +466,14 @@ struct sock *inet_steal_sock(struct net *net, struct sk_buff *skb, int doff,
 		return sk;
 
 	if (sk->sk_state == TCP_NEW_SYN_RECV) {
+#if IS_ENABLED(CONFIG_SYN_COOKIE)
 		if (inet_reqsk(sk)->syncookie) {
 			*refcounted = false;
 			skb->sk = sk;
 			skb->destructor = sock_pfree;
 			return inet_reqsk(sk)->rsk_listener;
 		}
+#endif
 		return sk;
 	} else if (sk->sk_state == TCP_TIME_WAIT) {
 		return sk;
---8<---

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-21  5:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20231120222341.54776-11-kuniyu@amazon.com>
2023-11-21  5:17 ` [PATCH v2 bpf-next 10/11] bpf: tcp: Support arbitrary SYN Cookie kernel test robot
2023-11-21  5:37   ` Kuniyuki Iwashima

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox