MPTCP Linux Development
 help / color / mirror / Atom feed
* [PATCH bpf-next v5 0/3] bpf, btf: Add DEBUG_INFO_BTF checks for __register_bpf_struct_ops
@ 2024-02-08  6:24 Geliang Tang
  2024-02-08  6:24 ` [PATCH bpf-next v5 1/3] bpf, btf: Fix return value of register_btf_id_dtor_kfuncs Geliang Tang
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Geliang Tang @ 2024-02-08  6:24 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, Matthieu Baerts,
	Eduard Zingerman, John Fastabend, KP Singh, Stanislav Fomichev,
	Hao Luo, Jiri Olsa
  Cc: Geliang Tang, bpf, mptcp, kernel test robot

From: Geliang Tang <tanggeliang@kylinos.cn>

v5:
 - drop CONFIG_MODULE_ALLOW_BTF_MISMATCH check as Martin suggested.

v4:
 - add a new patch to fix error checks for btf_get_module_btf.
 - rename the helper to check_btf_kconfigs.

v3:
 - fix this build error:
kernel/bpf/btf.c:7750:11: error: incomplete definition of type 'struct module'

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202402040934.Fph0XeEo-lkp@intel.com/

v2:
 - add register_check_missing_btf helper as Jiri suggested.

Geliang Tang (3):
  bpf, btf: Fix return value of register_btf_id_dtor_kfuncs
  bpf, btf: Add check_btf_kconfigs helper
  bpf, btf: Check btf for register_bpf_struct_ops

 kernel/bpf/btf.c | 39 ++++++++++++++++++---------------------
 1 file changed, 18 insertions(+), 21 deletions(-)

-- 
2.40.1


^ permalink raw reply	[flat|nested] 17+ messages in thread
* [PATCH bpf-next v4 3/3] bpf, btf: Check btf for register_bpf_struct_ops
@ 2024-02-07 14:07 Geliang Tang
  2024-02-07 15:01 ` bpf, btf: Check btf for register_bpf_struct_ops: Tests Results MPTCP CI
  2024-02-07 15:46 ` MPTCP CI
  0 siblings, 2 replies; 17+ messages in thread
From: Geliang Tang @ 2024-02-07 14:07 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, Matthieu Baerts,
	Eduard Zingerman, John Fastabend, KP Singh, Stanislav Fomichev,
	Hao Luo, Jiri Olsa
  Cc: Geliang Tang, bpf, mptcp

From: Geliang Tang <tanggeliang@kylinos.cn>

Similar to the handling in the functions __register_btf_kfunc_id_set()
and register_btf_id_dtor_kfuncs(), this patch uses the newly added
helper check_btf_kconfigs() and IS_ERR() to check the return value of
btf_get_module_btf().

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 kernel/bpf/btf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index eedbee04de89..9aae5a4bba24 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -8885,7 +8885,9 @@ int __register_bpf_struct_ops(struct bpf_struct_ops *st_ops)
 
 	btf = btf_get_module_btf(st_ops->owner);
 	if (!btf)
-		return -EINVAL;
+		return check_btf_kconfigs(st_ops->owner);
+	if (IS_ERR(btf))
+		return PTR_ERR(btf);
 
 	log = kzalloc(sizeof(*log), GFP_KERNEL | __GFP_NOWARN);
 	if (!log) {
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread
* [PATCH bpf-next v3 2/2] bpf, btf: Check btf for register_bpf_struct_ops
@ 2024-02-04  6:58 Geliang Tang
  2024-02-04  7:48 ` bpf, btf: Check btf for register_bpf_struct_ops: Tests Results MPTCP CI
  2024-02-04  8:08 ` MPTCP CI
  0 siblings, 2 replies; 17+ messages in thread
From: Geliang Tang @ 2024-02-04  6:58 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, Matthieu Baerts,
	Eduard Zingerman, John Fastabend, KP Singh, Stanislav Fomichev,
	Hao Luo, Jiri Olsa
  Cc: Geliang Tang, bpf, mptcp

From: Geliang Tang <tanggeliang@kylinos.cn>

Similar to the handling in the functions __register_btf_kfunc_id_set()
and register_btf_id_dtor_kfuncs(), this patch uses the newly added
helper register_check_missing_btf() and IS_ERR() to check the return
value of btf_get_module_btf().

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 kernel/bpf/btf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index d166c12206ea..714f13121f1c 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -8890,7 +8890,9 @@ int __register_bpf_struct_ops(struct bpf_struct_ops *st_ops)
 
 	btf = btf_get_module_btf(st_ops->owner);
 	if (!btf)
-		return -EINVAL;
+		return register_check_missing_btf(st_ops->owner, "structs");
+	if (IS_ERR(btf))
+		return PTR_ERR(btf);
 
 	log = kzalloc(sizeof(*log), GFP_KERNEL | __GFP_NOWARN);
 	if (!log) {
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread
* [PATCH bpf-next v2 2/2] bpf, btf: Check btf for register_bpf_struct_ops
@ 2024-02-03  7:51 Geliang Tang
  2024-02-03  8:45 ` bpf, btf: Check btf for register_bpf_struct_ops: Tests Results MPTCP CI
  2024-02-03  9:08 ` MPTCP CI
  0 siblings, 2 replies; 17+ messages in thread
From: Geliang Tang @ 2024-02-03  7:51 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, Matthieu Baerts,
	Eduard Zingerman, John Fastabend, KP Singh, Stanislav Fomichev,
	Hao Luo, Jiri Olsa
  Cc: Geliang Tang, bpf, mptcp

From: Geliang Tang <tanggeliang@kylinos.cn>

Similar to the handling in the functions __register_btf_kfunc_id_set()
and register_btf_id_dtor_kfuncs(), this patch uses the newly added
helper register_check_missing_btf() and IS_ERR() to check the return
value of btf_get_module_btf().

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 kernel/bpf/btf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 1ebe26a3a7a5..2d99f85adc82 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -8889,7 +8889,9 @@ int __register_bpf_struct_ops(struct bpf_struct_ops *st_ops)
 
 	btf = btf_get_module_btf(st_ops->owner);
 	if (!btf)
-		return -EINVAL;
+		return register_check_missing_btf(st_ops->owner, "structs");
+	if (IS_ERR(btf))
+		return PTR_ERR(btf);
 
 	log = kzalloc(sizeof(*log), GFP_KERNEL | __GFP_NOWARN);
 	if (!log) {
-- 
2.40.1


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

end of thread, other threads:[~2024-02-08 19:53 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-08  6:24 [PATCH bpf-next v5 0/3] bpf, btf: Add DEBUG_INFO_BTF checks for __register_bpf_struct_ops Geliang Tang
2024-02-08  6:24 ` [PATCH bpf-next v5 1/3] bpf, btf: Fix return value of register_btf_id_dtor_kfuncs Geliang Tang
2024-02-08  6:24 ` [PATCH bpf-next v5 2/3] bpf, btf: Add check_btf_kconfigs helper Geliang Tang
2024-02-08 10:07   ` Jiri Olsa
2024-02-08 19:53     ` Martin KaFai Lau
2024-02-08  6:24 ` [PATCH bpf-next v5 3/3] bpf, btf: Check btf for register_bpf_struct_ops Geliang Tang
2024-02-08  7:16   ` bpf, btf: Check btf for register_bpf_struct_ops: Tests Results MPTCP CI
2024-02-08  7:32   ` MPTCP CI
2024-02-08 10:57   ` MPTCP CI
2024-02-08 11:14   ` MPTCP CI
2024-02-08 19:50 ` [PATCH bpf-next v5 0/3] bpf, btf: Add DEBUG_INFO_BTF checks for __register_bpf_struct_ops patchwork-bot+netdevbpf
  -- strict thread matches above, loose matches on Subject: below --
2024-02-07 14:07 [PATCH bpf-next v4 3/3] bpf, btf: Check btf for register_bpf_struct_ops Geliang Tang
2024-02-07 15:01 ` bpf, btf: Check btf for register_bpf_struct_ops: Tests Results MPTCP CI
2024-02-07 15:46 ` MPTCP CI
2024-02-04  6:58 [PATCH bpf-next v3 2/2] bpf, btf: Check btf for register_bpf_struct_ops Geliang Tang
2024-02-04  7:48 ` bpf, btf: Check btf for register_bpf_struct_ops: Tests Results MPTCP CI
2024-02-04  8:08 ` MPTCP CI
2024-02-03  7:51 [PATCH bpf-next v2 2/2] bpf, btf: Check btf for register_bpf_struct_ops Geliang Tang
2024-02-03  8:45 ` bpf, btf: Check btf for register_bpf_struct_ops: Tests Results MPTCP CI
2024-02-03  9:08 ` MPTCP CI

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