All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto"
@ 2022-03-30  7:08 Geliang Tang
  2022-03-30 13:29 ` Matthieu Baerts
  0 siblings, 1 reply; 7+ messages in thread
From: Geliang Tang @ 2022-03-30  7:08 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang, kernel test robot

Fix the build breaks reported by kernel test robot:

[mptcp:export 32/40] ld.lld: error: undefined symbol: bpf_mptcp_sock_from_subflow
[mptcp:export 32/40] filter.c:undefined reference to `bpf_mptcp_sock_from_subflow'

- add defined(CONFIG_BPF_JIT) too.
- move bpf_mptcp_sock_from_subflow from bpf.h to mptcp.h.

base-commit: export/20220329T195411

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 include/linux/bpf.h | 9 ---------
 include/net/mptcp.h | 6 ++++++
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 117ae3f9451e..bdb5298735ce 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -2372,15 +2372,6 @@ static inline u32 bpf_xdp_sock_convert_ctx_access(enum bpf_access_type type,
 }
 #endif /* CONFIG_INET */
 
-#if defined(CONFIG_MPTCP) && defined(CONFIG_BPF_SYSCALL)
-struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk);
-#else
-static inline struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk)
-{
-	return NULL;
-}
-#endif /* defined(CONFIG_MPTCP) && defined(CONFIG_BPF_SYSCALL) */
-
 enum bpf_text_poke_type {
 	BPF_MOD_CALL,
 	BPF_MOD_JUMP,
diff --git a/include/net/mptcp.h b/include/net/mptcp.h
index 8b1afd6f5cc4..877077b53200 100644
--- a/include/net/mptcp.h
+++ b/include/net/mptcp.h
@@ -284,4 +284,10 @@ static inline int mptcpv6_init(void) { return 0; }
 static inline void mptcpv6_handle_mapped(struct sock *sk, bool mapped) { }
 #endif
 
+#if defined(CONFIG_MPTCP) && defined(CONFIG_BPF_JIT) && defined(CONFIG_BPF_SYSCALL)
+struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk);
+#else
+static inline struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk) { return NULL; }
+#endif
+
 #endif /* __NET_MPTCP_H */
-- 
2.34.1


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

* Re: [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto"
  2022-03-30  7:08 [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto" Geliang Tang
@ 2022-03-30 13:29 ` Matthieu Baerts
  2022-03-30 14:22   ` Geliang Tang
  0 siblings, 1 reply; 7+ messages in thread
From: Matthieu Baerts @ 2022-03-30 13:29 UTC (permalink / raw)
  To: Geliang Tang, mptcp; +Cc: kernel test robot

Hi Geliang,

On 30/03/2022 09:08, Geliang Tang wrote:
> Fix the build breaks reported by kernel test robot:
> 
> [mptcp:export 32/40] ld.lld: error: undefined symbol: bpf_mptcp_sock_from_subflow
> [mptcp:export 32/40] filter.c:undefined reference to `bpf_mptcp_sock_from_subflow'
> 
> - add defined(CONFIG_BPF_JIT) too.

Thanks for the fix!

> - move bpf_mptcp_sock_from_subflow from bpf.h to mptcp.h.

Should we add an explicit #include <net/mptcp.h> in filter.c.

But maybe it is enough to have net/mptcp.h in net/tcp.h?

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

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

* Re: [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto"
  2022-03-30 13:29 ` Matthieu Baerts
@ 2022-03-30 14:22   ` Geliang Tang
  2022-03-30 14:51     ` Matthieu Baerts
  0 siblings, 1 reply; 7+ messages in thread
From: Geliang Tang @ 2022-03-30 14:22 UTC (permalink / raw)
  To: Matthieu Baerts; +Cc: mptcp

On Wed, Mar 30, 2022 at 03:29:06PM +0200, Matthieu Baerts wrote:
> Hi Geliang,
> 
> On 30/03/2022 09:08, Geliang Tang wrote:
> > Fix the build breaks reported by kernel test robot:
> > 
> > [mptcp:export 32/40] ld.lld: error: undefined symbol: bpf_mptcp_sock_from_subflow
> > [mptcp:export 32/40] filter.c:undefined reference to `bpf_mptcp_sock_from_subflow'
> > 
> > - add defined(CONFIG_BPF_JIT) too.
> 
> Thanks for the fix!
> 
> > - move bpf_mptcp_sock_from_subflow from bpf.h to mptcp.h.
> 
> Should we add an explicit #include <net/mptcp.h> in filter.c.
> 
> But maybe it is enough to have net/mptcp.h in net/tcp.h?

Yes, net/mptcp.h is included in net/tcp.h already. So no need to add it
in filter.c explicitly. No build errors for this occurred in my test.

Thanks,
-Geliang

> 
> Cheers,
> Matt
> -- 
> Tessares | Belgium | Hybrid Access Solutions
> www.tessares.net
> 


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

* Re: [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto"
  2022-03-30 14:22   ` Geliang Tang
@ 2022-03-30 14:51     ` Matthieu Baerts
  0 siblings, 0 replies; 7+ messages in thread
From: Matthieu Baerts @ 2022-03-30 14:51 UTC (permalink / raw)
  To: Geliang Tang; +Cc: mptcp

On 30/03/2022 16:22, Geliang Tang wrote:
> On Wed, Mar 30, 2022 at 03:29:06PM +0200, Matthieu Baerts wrote:
>> Hi Geliang,
>>
>> On 30/03/2022 09:08, Geliang Tang wrote:
>>> Fix the build breaks reported by kernel test robot:
>>>
>>> [mptcp:export 32/40] ld.lld: error: undefined symbol: bpf_mptcp_sock_from_subflow
>>> [mptcp:export 32/40] filter.c:undefined reference to `bpf_mptcp_sock_from_subflow'
>>>
>>> - add defined(CONFIG_BPF_JIT) too.
>>
>> Thanks for the fix!
>>
>>> - move bpf_mptcp_sock_from_subflow from bpf.h to mptcp.h.
>>
>> Should we add an explicit #include <net/mptcp.h> in filter.c.
>>
>> But maybe it is enough to have net/mptcp.h in net/tcp.h?
> 
> Yes, net/mptcp.h is included in net/tcp.h already. So no need to add it
> in filter.c explicitly. No build errors for this occurred in my test.

Yes but I don't know if the recommendation is to add mptcp.h directly
just in case instead of "indirectly" via tcp.h. But that's more a
question for BPF maintainers, easy to fix later if needed!

So good for me to apply this and avoid issues reported by Intel's KBuild!

Now in our tree:

- 3b9cc9f027bf: "squashed" in "bpf: add bpf_skc_to_mptcp_sock_proto"
- Results: d2b06f03e554..ccc95f7c14d9 (export)

Builds and tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20220330T145030
https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

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

* [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto"
@ 2022-04-26  4:26 Geliang Tang
  2022-04-27  0:17 ` Mat Martineau
  0 siblings, 1 reply; 7+ messages in thread
From: Geliang Tang @ 2022-04-26  4:26 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

Update as Daniel suggested.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 include/linux/bpf.h      | 1 +
 include/net/mptcp.h      | 2 +-
 kernel/bpf/verifier.c    | 1 +
 kernel/trace/bpf_trace.c | 2 ++
 net/core/filter.c        | 3 ++-
 net/mptcp/Makefile       | 2 --
 6 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index bdb5298735ce..2493f9601842 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -2249,6 +2249,7 @@ extern const struct bpf_func_proto bpf_skc_to_tcp_timewait_sock_proto;
 extern const struct bpf_func_proto bpf_skc_to_tcp_request_sock_proto;
 extern const struct bpf_func_proto bpf_skc_to_udp6_sock_proto;
 extern const struct bpf_func_proto bpf_skc_to_unix_sock_proto;
+extern const struct bpf_func_proto bpf_skc_to_mptcp_sock_proto;
 extern const struct bpf_func_proto bpf_copy_from_user_proto;
 extern const struct bpf_func_proto bpf_snprintf_btf_proto;
 extern const struct bpf_func_proto bpf_snprintf_proto;
diff --git a/include/net/mptcp.h b/include/net/mptcp.h
index 6b07011c060d..4d761ad530c9 100644
--- a/include/net/mptcp.h
+++ b/include/net/mptcp.h
@@ -284,7 +284,7 @@ static inline int mptcpv6_init(void) { return 0; }
 static inline void mptcpv6_handle_mapped(struct sock *sk, bool mapped) { }
 #endif
 
-#if defined(CONFIG_MPTCP) && defined(CONFIG_BPF_JIT) && defined(CONFIG_BPF_SYSCALL)
+#if defined(CONFIG_MPTCP) && defined(CONFIG_BPF_SYSCALL)
 struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk);
 #else
 static inline struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk) { return NULL; }
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 9c1a02b82ecd..40602ec20c6a 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -517,6 +517,7 @@ static bool is_ptr_cast_function(enum bpf_func_id func_id)
 		func_id == BPF_FUNC_skc_to_tcp_sock ||
 		func_id == BPF_FUNC_skc_to_tcp6_sock ||
 		func_id == BPF_FUNC_skc_to_udp6_sock ||
+		func_id == BPF_FUNC_skc_to_mptcp_sock ||
 		func_id == BPF_FUNC_skc_to_tcp_timewait_sock ||
 		func_id == BPF_FUNC_skc_to_tcp_request_sock;
 }
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index b26f3da943de..c7bf10cf2fa5 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -1685,6 +1685,8 @@ tracing_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
 		return &bpf_skc_to_udp6_sock_proto;
 	case BPF_FUNC_skc_to_unix_sock:
 		return &bpf_skc_to_unix_sock_proto;
+	case BPF_FUNC_skc_to_mptcp_sock:
+		return &bpf_skc_to_mptcp_sock_proto;
 	case BPF_FUNC_sk_storage_get:
 		return &bpf_sk_storage_get_tracing_proto;
 	case BPF_FUNC_sk_storage_delete:
diff --git a/net/core/filter.c b/net/core/filter.c
index 4bcf13b1d0e2..a0dd6f6b17f8 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -11282,10 +11282,11 @@ const struct bpf_func_proto bpf_skc_to_unix_sock_proto = {
 
 BPF_CALL_1(bpf_skc_to_mptcp_sock, struct sock *, sk)
 {
+	BTF_TYPE_EMIT(struct mptcp_sock);
 	return (unsigned long)bpf_mptcp_sock_from_subflow(sk);
 }
 
-static const struct bpf_func_proto bpf_skc_to_mptcp_sock_proto = {
+const struct bpf_func_proto bpf_skc_to_mptcp_sock_proto = {
 	.func		= bpf_skc_to_mptcp_sock,
 	.gpl_only	= false,
 	.ret_type	= RET_PTR_TO_BTF_ID_OR_NULL,
diff --git a/net/mptcp/Makefile b/net/mptcp/Makefile
index 4004347db47e..6e7df47c9584 100644
--- a/net/mptcp/Makefile
+++ b/net/mptcp/Makefile
@@ -11,6 +11,4 @@ mptcp_crypto_test-objs := crypto_test.o
 mptcp_token_test-objs := token_test.o
 obj-$(CONFIG_MPTCP_KUNIT_TEST) += mptcp_crypto_test.o mptcp_token_test.o
 
-ifeq ($(CONFIG_BPF_JIT),y)
 obj-$(CONFIG_BPF_SYSCALL) += bpf.o
-endif
-- 
2.34.1


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

* Re: [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto"
  2022-04-26  4:26 Geliang Tang
@ 2022-04-27  0:17 ` Mat Martineau
  0 siblings, 0 replies; 7+ messages in thread
From: Mat Martineau @ 2022-04-27  0:17 UTC (permalink / raw)
  To: Geliang Tang; +Cc: mptcp

On Tue, 26 Apr 2022, Geliang Tang wrote:

> Update as Daniel suggested.
>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>

Looks good to squash, thanks. The 'base' bpf tests pass, which is what 
Daniel noted as failing.

- Mat


> ---
> include/linux/bpf.h      | 1 +
> include/net/mptcp.h      | 2 +-
> kernel/bpf/verifier.c    | 1 +
> kernel/trace/bpf_trace.c | 2 ++
> net/core/filter.c        | 3 ++-
> net/mptcp/Makefile       | 2 --
> 6 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> index bdb5298735ce..2493f9601842 100644
> --- a/include/linux/bpf.h
> +++ b/include/linux/bpf.h
> @@ -2249,6 +2249,7 @@ extern const struct bpf_func_proto bpf_skc_to_tcp_timewait_sock_proto;
> extern const struct bpf_func_proto bpf_skc_to_tcp_request_sock_proto;
> extern const struct bpf_func_proto bpf_skc_to_udp6_sock_proto;
> extern const struct bpf_func_proto bpf_skc_to_unix_sock_proto;
> +extern const struct bpf_func_proto bpf_skc_to_mptcp_sock_proto;
> extern const struct bpf_func_proto bpf_copy_from_user_proto;
> extern const struct bpf_func_proto bpf_snprintf_btf_proto;
> extern const struct bpf_func_proto bpf_snprintf_proto;
> diff --git a/include/net/mptcp.h b/include/net/mptcp.h
> index 6b07011c060d..4d761ad530c9 100644
> --- a/include/net/mptcp.h
> +++ b/include/net/mptcp.h
> @@ -284,7 +284,7 @@ static inline int mptcpv6_init(void) { return 0; }
> static inline void mptcpv6_handle_mapped(struct sock *sk, bool mapped) { }
> #endif
>
> -#if defined(CONFIG_MPTCP) && defined(CONFIG_BPF_JIT) && defined(CONFIG_BPF_SYSCALL)
> +#if defined(CONFIG_MPTCP) && defined(CONFIG_BPF_SYSCALL)
> struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk);
> #else
> static inline struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk) { return NULL; }
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 9c1a02b82ecd..40602ec20c6a 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -517,6 +517,7 @@ static bool is_ptr_cast_function(enum bpf_func_id func_id)
> 		func_id == BPF_FUNC_skc_to_tcp_sock ||
> 		func_id == BPF_FUNC_skc_to_tcp6_sock ||
> 		func_id == BPF_FUNC_skc_to_udp6_sock ||
> +		func_id == BPF_FUNC_skc_to_mptcp_sock ||
> 		func_id == BPF_FUNC_skc_to_tcp_timewait_sock ||
> 		func_id == BPF_FUNC_skc_to_tcp_request_sock;
> }
> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> index b26f3da943de..c7bf10cf2fa5 100644
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -1685,6 +1685,8 @@ tracing_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
> 		return &bpf_skc_to_udp6_sock_proto;
> 	case BPF_FUNC_skc_to_unix_sock:
> 		return &bpf_skc_to_unix_sock_proto;
> +	case BPF_FUNC_skc_to_mptcp_sock:
> +		return &bpf_skc_to_mptcp_sock_proto;
> 	case BPF_FUNC_sk_storage_get:
> 		return &bpf_sk_storage_get_tracing_proto;
> 	case BPF_FUNC_sk_storage_delete:
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 4bcf13b1d0e2..a0dd6f6b17f8 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -11282,10 +11282,11 @@ const struct bpf_func_proto bpf_skc_to_unix_sock_proto = {
>
> BPF_CALL_1(bpf_skc_to_mptcp_sock, struct sock *, sk)
> {
> +	BTF_TYPE_EMIT(struct mptcp_sock);
> 	return (unsigned long)bpf_mptcp_sock_from_subflow(sk);
> }
>
> -static const struct bpf_func_proto bpf_skc_to_mptcp_sock_proto = {
> +const struct bpf_func_proto bpf_skc_to_mptcp_sock_proto = {
> 	.func		= bpf_skc_to_mptcp_sock,
> 	.gpl_only	= false,
> 	.ret_type	= RET_PTR_TO_BTF_ID_OR_NULL,
> diff --git a/net/mptcp/Makefile b/net/mptcp/Makefile
> index 4004347db47e..6e7df47c9584 100644
> --- a/net/mptcp/Makefile
> +++ b/net/mptcp/Makefile
> @@ -11,6 +11,4 @@ mptcp_crypto_test-objs := crypto_test.o
> mptcp_token_test-objs := token_test.o
> obj-$(CONFIG_MPTCP_KUNIT_TEST) += mptcp_crypto_test.o mptcp_token_test.o
>
> -ifeq ($(CONFIG_BPF_JIT),y)
> obj-$(CONFIG_BPF_SYSCALL) += bpf.o
> -endif
> -- 
> 2.34.1
>
>
>

--
Mat Martineau
Intel

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

* [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto"
@ 2022-05-17  7:43 Geliang Tang
  0 siblings, 0 replies; 7+ messages in thread
From: Geliang Tang @ 2022-05-17  7:43 UTC (permalink / raw)
  To: mptcp; +Cc: Geliang Tang

Drop EXPORT_SYMBOL. (Martin)

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 net/mptcp/bpf.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c
index 535602ba2582..5a0a84ad94af 100644
--- a/net/mptcp/bpf.c
+++ b/net/mptcp/bpf.c
@@ -19,4 +19,3 @@ struct mptcp_sock *bpf_mptcp_sock_from_subflow(struct sock *sk)
 
 	return NULL;
 }
-EXPORT_SYMBOL(bpf_mptcp_sock_from_subflow);
-- 
2.34.1


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

end of thread, other threads:[~2022-05-17  7:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-30  7:08 [PATCH mptcp-next] Squash to "bpf: add bpf_skc_to_mptcp_sock_proto" Geliang Tang
2022-03-30 13:29 ` Matthieu Baerts
2022-03-30 14:22   ` Geliang Tang
2022-03-30 14:51     ` Matthieu Baerts
  -- strict thread matches above, loose matches on Subject: below --
2022-04-26  4:26 Geliang Tang
2022-04-27  0:17 ` Mat Martineau
2022-05-17  7:43 Geliang Tang

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.