Squash to "BPF packet scheduler"
Subsystems (5)
Geliang Tang
reviewerv2 cover Squash to "BPF packet scheduler"
From: Geliang Tang <[email protected]>
v2:
- Drop mptcp_subflow bpf_iter subtest.
Two squash-to patches based on Martin's feedback for "bpf: Add mptcp_subflow bpf_iter support" v3.
Geliang Tang (2):
Revert "selftests/bpf: Add mptcp_subflow bpf_iter subtest" Squash to "bpf: Export mptcp packet scheduler helpers"
net/mptcp/bpf.c | 23 +++++- .../testing/selftests/bpf/bpf_experimental.h | 8 -- .../testing/selftests/bpf/prog_tests/mptcp.c | 73 ------------------- .../selftests/bpf/progs/mptcp_bpf_iters.c | 59 --------------- 4 files changed, 21 insertions(+), 142 deletions(-) delete mode 100644 tools/testing/selftests/bpf/progs/mptcp_bpf_iters.c
Signature · 1 line
2.43.0
Geliang Tang
reviewerPATCH v2 1/2 Revert "selftests/bpf: Add mptcp_subflow bpf_iter subtest"
From: Geliang Tang <[email protected]>
Drop this patch as Martin suggested.
--- .../testing/selftests/bpf/bpf_experimental.h | 8 -- .../testing/selftests/bpf/prog_tests/mptcp.c | 73 ------------------- .../selftests/bpf/progs/mptcp_bpf_iters.c | 59 --------------- 3 files changed, 140 deletions(-) delete mode 100644 tools/testing/selftests/bpf/progs/mptcp_bpf_iters.c
tools/testing/selftests/bpf/bpf_experimental.h +0 -8
@@ -578,14 +578,6 @@ extern int bpf_iter_css_new(struct bpf_iter_css *it,extern struct cgroup_subsys_state *bpf_iter_css_next (struct bpf_iter_css *it)__weak __ksym; extern void bpf_iter_css_destroy(struct bpf_iter_css *it) __weak __ksym; -struct bpf_iter_mptcp_subflow ; -extern int bpf_iter_mptcp_subflow_new(struct bpf_iter_mptcp_subflow *it, - struct sock *sk) __weak __ksym; -extern struct mptcp_subflow_context * -bpf_iter_mptcp_subflow_next (struct bpf_iter_mptcp_subflow *it)__weak __ksym; -extern void -bpf_iter_mptcp_subflow_destroy(struct bpf_iter_mptcp_subflow *it) __weak __ksym; - extern int bpf_wq_init(struct bpf_wq *wq, void *p__map, unsigned int flags) __weak __ksym; extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ksym; extern int bpf_wq_set_callback_impl(struct bpf_wq *wq,
tools/testing/selftests/bpf/prog_tests/mptcp.c +0 -73
97 lines not on this page · raw message
tools/testing/selftests/bpf/progs/mptcp_bpf_iters.c deleted +0 -59
59 lines not on this page · raw message
Signature · 1 line
2.43.0
Geliang Tang
reviewerPATCH v2 2/2 Squash to "bpf: Export mptcp packet scheduler helpers"
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
Define .filter as Martin suggested.
--- net/mptcp/bpf.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
net/mptcp/bpf.c +21 -2
@@ -317,9 +317,30 @@ BTF_ID_FLAGS(func, bpf_mptcp_subflow_queues_empty) BTF_ID_FLAGS(func, mptcp_pm_subflow_chk_stale, KF_SLEEPABLE)BTF_KFUNCS_END (bpf_mptcp_common_kfunc_ids) +static int bpf_mptcp_common_kfunc_filter(const struct bpf_prog *prog, u32 kfunc_id) +{ +if (!btf_id_set8_contains (&bpf_mptcp_common_kfunc_ids, kfunc_id)) +return 0 ; + +if (prog->type !=BPF_PROG_TYPE_STRUCT_OPS ) +return -EACCES ; + +/* .filter is called sometimes before prog->aux->st_ops is set, +* then prog->aux->st_ops is NULL. If return -EACCES in this case, +* an error occur: +* bug: bad parent state for iter next call +*/ +if (prog->aux->st_ops && + prog->aux->st_ops != &bpf_mptcp_sched_ops) +return -EACCES ; + +return 0 ; +} +static const struct btf_kfunc_id_set bpf_mptcp_common_kfunc_set = { .owner =THIS_MODULE , .set = &bpf_mptcp_common_kfunc_ids, + .filter = bpf_mptcp_common_kfunc_filter, };static int __init bpf_mptcp_kfunc_init (void )
@@ -327,8 +348,6 @@ static int __init bpf_mptcp_kfunc_init(void)int ret; ret =register_btf_fmodret_id_set (&bpf_mptcp_fmodret_set); - ret = ret ?:register_btf_kfunc_id_set (BPF_PROG_TYPE_CGROUP_SOCKOPT , - &bpf_mptcp_common_kfunc_set); ret = ret ?:register_btf_kfunc_id_set (BPF_PROG_TYPE_STRUCT_OPS , &bpf_mptcp_common_kfunc_set);#ifdef CONFIG_BPF_JIT
Signature · 1 line
2.43.0
Matthieu Baerts
maintainerRe: [PATCH mptcp-next v2 2/2] Squash to "bpf: Export mptcp packet scheduler helpers"
Hi Geliang,
Quoted 3 lines · Geliang Tang
From: Geliang Tang <[email protected]>
Define .filter as Martin suggested.
Thank you for the v2.
Quoted 15 lines
Signed-off-by Geliang Tang <[email protected]>--- net/mptcp/bpf.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)net/mptcp/bpf.c +2
-0@@ -317,9 +317,30 @@ BTF_ID_FLAGS(func, bpf_mptcp_subflow_queues_empty) BTF_ID_FLAGS(func, mptcp_pm_subflow_chk_stale, KF_SLEEPABLE)BTF_KFUNCS_END (bpf_mptcp_common_kfunc_ids) +static int bpf_mptcp_common_kfunc_filter(const struct bpf_prog *prog, u32 kfunc_id) +{
net/mptcp/bpf.c BTF_ID_FLAGS(func, bpf_mptcp_subflow_queues_empty) · line 331
Quoted 10 lines
net/mptcp/bpf.c +10
-0+if (!btf_id_set8_contains (&bpf_mptcp_common_kfunc_ids, kfunc_id)) +return 0 ; + +if (prog->type !=BPF_PROG_TYPE_STRUCT_OPS ) +return -EACCES ; + +/* .filter is called sometimes before prog->aux->st_ops is set, +* then prog->aux->st_ops is NULL. If return -EACCES in this case, +* an error occur: +* bug: bad parent state for iter next call
That's interesting. Did you have this after having removed the register for BPF_PROG_TYPE_CGROUP_SOCKOPT?
With this extra "prog->aux->st_ops != NULL" check, it sounds like the filter could allow other ops to use these KFunc, and thus that's an issue.
Do you have more details about the error, and what exactly caused this? Maybe we should report this issue to BPF maintainers, because what you did sounds incorrect for a filter, and they didn't have to do that in QDisc.
Quoted 16 lines
net/mptcp/bpf.c +9
-0+*/ +if (prog->aux->st_ops && + prog->aux->st_ops != &bpf_mptcp_sched_ops) +return -EACCES ; + +return 0 ; +} +static const struct btf_kfunc_id_set bpf_mptcp_common_kfunc_set = { .owner =THIS_MODULE , .set = &bpf_mptcp_common_kfunc_ids, + .filter = bpf_mptcp_common_kfunc_filter, };static int __init bpf_mptcp_kfunc_init (void )
net/mptcp/bpf.c static int __init bpf_mptcp_kfunc_init(void) · line 353
Quoted 8 lines
net/mptcp/bpf.c +0
-2@@ -327,8 +348,6 @@ static int __init bpf_mptcp_kfunc_init(void)int ret; ret =register_btf_fmodret_id_set (&bpf_mptcp_fmodret_set); - ret = ret ?:register_btf_kfunc_id_set (BPF_PROG_TYPE_CGROUP_SOCKOPT , - &bpf_mptcp_common_kfunc_set); ret = ret ?:register_btf_kfunc_id_set (BPF_PROG_TYPE_STRUCT_OPS , &bpf_mptcp_common_kfunc_set);#ifdef CONFIG_BPF_JIT
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Geliang Tang
reviewerRe: [PATCH mptcp-next v2 2/2] Squash to "bpf: Export mptcp packet scheduler helpers"
Hi Matt,
Thanks for your review.
Quoted 31 lines · Matthieu Baerts
Hi Geliang,
Quoted 3 lines · Geliang Tang
From: Geliang Tang <[email protected]>
Define .filter as Martin suggested.
Thank you for the v2.
Quoted 22 lines
Signed-off-by Geliang Tang <[email protected]>---
net/mptcp/bpf.c | 23 +++++++++++++++++++++--1 file changed, 21 insertions(+), 2 deletions(-)net/mptcp/bpf.c +0
-0@@ -317,9 +317,30 @@ BTF_ID_FLAGS(func, bpf_mptcp_subflow_queues_empty) BTF_ID_FLAGS(func, mptcp_pm_subflow_chk_stale, KF_SLEEPABLE) BTF_KFUNCS_END(bpf_mptcp_common_kfunc_ids)
+static intbpf_mptcp_common_kfunc_filter(const struct bpf_prog *prog, u32 kfunc_id)net/mptcp/bpf.c +6
-0+{ +if (!btf_id_set8_contains (&bpf_mptcp_common_kfunc_ids, kfunc_id)) +return 0 ; + +if (prog->type !=BPF_PROG_TYPE_STRUCT_OPS ) +return -EACCES ;
Quoted 8 lines
Quoted 5 lines
+
+ /* .filter is called sometimes beforeprog->aux->st_opsis set,
+ * thenprog->aux->st_opsis NULL. If return-EACCESin this case,
+ * an error occur:
+ * bug: bad parent state for iter next callThat's interesting. Did you have this after having removed the register
forBPF_PROG_TYPE_CGROUP_SOCKOPT?
Yes, I have removed this.
Quoted 7 lines
With this extra "
prog->aux->st_ops!= NULL" check, it sounds like the filter could allow other ops to use these KFunc, and thus that's an issue.Do you have more details about the error, and what exactly caused this?
bpf_iter_mptcp_subflow_next in the kfunc_set caused this:
# #198/5 mptcp/first:OK
# libbpf: prog 'bpf_bkup_get_send': BPF program load failed: -EFAULT # libbpf: prog 'bpf_bkup_get_send': -- BEGIN PROG LOAD LOG -- # 0: R1=ctx() R10=fp0
# ; int BPF_PROG(bpf_bkup_get_send, struct mptcp_sock *msk) @ mptcp_bpf_bkup.c:20
# 0: (79) r2 = *(u64 *)(r1 +0)
# func 'get_send' arg0 has btf_id 37366 type STRUCT 'mptcp_sock'
# 1: R1=ctx() R2_w=trusted_ptr_mptcp_sock()
# 1: (bf) r1 = r10 ; R1_w=fp0 R10=fp0
# 2: (07) r1 += -16 ; R1_w=fp-16
# ; bpf_for_each(mptcp_subflow, subflow, (struct sock *)msk) { @
mptcp_bpf_bkup.c:24
# 3: (85) call bpf_iter_mptcp_subflow_new#53836 ; R0_w=scalar()
fp-16_w=iter_mptcp_subflow(ref_id=1,state=active,depth=0) refs=1
# 4: (b7) r7 = 0 ; R7_w=0 refs=1
# 5: (b7) r9 = 0 ; R9_w=0 refs=1
# 6: (b7) r8 = 0 ; R8_w=0 refs=1
# 7: (05) goto pc+16
# ; if (!BPF_CORE_READ_BITFIELD_PROBED(subflow, backup) || @
mptcp_bpf_bkup.c:25
# 24: (bf) r1 = r10 ; R1_w=fp0 R10=fp0 refs=1
# 25: (07) r1 += -16 ; R1_w=fp-16 refs=1
# ; bpf_for_each(mptcp_subflow, subflow, (struct sock *)msk) { @
mptcp_bpf_bkup.c:24
# 26: (85) call bpf_iter_mptcp_subflow_next#53838
# bug: bad parent state for iter next callprocessed 11 insns (limit
1000000) max_states_per_insn 0 total_states 1 peak_states 1 mark_read 1
# -- END PROG LOAD LOG --
# libbpf: prog 'bpf_bkup_get_send': failed to load: -EFAULT
# libbpf: failed to load object 'mptcp_bpf_bkup'
# libbpf: failed to load BPF skeleton 'mptcp_bpf_bkup': -EFAULT
# test_bkup:FAIL:open_and_load: bkup unexpected error: -14
# #198/6 mptcp/bkup:FAILQuoted 4 lines
Maybe we should report this issue to BPF maintainers, because what you
did sounds incorrect for a filter, and they didn't have to do that in QDisc.
Since QDisc's kfunc_set does not include an iter next function.
This can solve the problem by putting this iter next function in another kfunc_set, but it is not a perfect solution:
'''BTF_KFUNCS_START(bpf_mptcp_common_kfunc_ids) BTF_ID_FLAGS(func, bpf_mptcp_subflow_ctx, KF_RET_NULL) BTF_ID_FLAGS(func, bpf_mptcp_subflow_tcp_sock, KF_RET_NULL) BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_new, KF_ITER_NEW | KF_TRUSTED_ARGS)BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_destroy, KF_ITER_DESTROY) BTF_ID_FLAGS(func, mptcp_subflow_set_scheduled) BTF_ID_FLAGS(func, mptcp_subflow_active) BTF_ID_FLAGS(func, mptcp_set_timeout)BTF_ID_FLAGS(func, mptcp_wnd_end)BTF_ID_FLAGS(func, bpf_sk_stream_memory_free, KF_RET_NULL) BTF_ID_FLAGS(func, bpf_mptcp_subflow_queues_empty) BTF_ID_FLAGS(func, mptcp_pm_subflow_chk_stale, KF_SLEEPABLE) BTF_KFUNCS_END(bpf_mptcp_common_kfunc_ids)
static int bpf_mptcp_common_kfunc_filter(const struct bpf_prog *prog, u32 kfunc_id)
{
if (!btf_id_set8_contains(&bpf_mptcp_common_kfunc_ids,kfunc_id))
return 0;
if (prog->type != BPF_PROG_TYPE_STRUCT_OPS)
return -EACCES;#ifdef CONFIG_BPF_JIT
if (prog->aux->st_ops != &bpf_mptcp_sched_ops)
return -EACCES;#endif
return 0; }
static const struct btf_kfunc_id_set bpf_mptcp_common_kfunc_set = {
.owner = THIS_MODULE,
.set = &bpf_mptcp_common_kfunc_ids,
.filter = bpf_mptcp_common_kfunc_filter,
};
BTF_KFUNCS_START(bpf_mptcp_iter_next_kfunc_ids) BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_next, KF_ITER_NEXT | KF_RET_NULL) BTF_KFUNCS_END(bpf_mptcp_iter_next_kfunc_ids)
static const struct btf_kfunc_id_set bpf_mptcp_iter_next_kfunc_set = {
.owner = THIS_MODULE,
.set = &bpf_mptcp_iter_next_kfunc_ids,
};
...
ret = register_btf_kfunc_id_set(BPF_PROG_TYPE_STRUCT_OPS,
&bpf_mptcp_common_kfunc_set);
ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_STRUCT_OPS,
&bpf_mptcp_iter_next_kfunc_set);...
'''
WDYT?
Thanks,
-Geliang
Quoted 30 lines
Quoted 19 lines
+ */
+ if (prog->aux->st_ops&&
+prog->aux->st_ops!=&bpf_mptcp_sched_ops)
+ return-EACCES;net/mptcp/bpf.c +4
-0+ +return 0 ; +} +static const struct
btf_kfunc_id_setbpf_mptcp_common_kfunc_set= {
.owner =THIS_MODULE,
.set =&bpf_mptcp_common_kfunc_ids,
+ .filter =bpf_mptcp_common_kfunc_filter,
};
static int__initbpf_mptcp_kfunc_init(void)net/mptcp/bpf.c +0
-0@@ -327,8 +348,6 @@ static int __init bpf_mptcp_kfunc_init(void) int ret;Quoted 8 lines
ret =register_btf_fmodret_id_set(&bpf_mptcp_fmodret_set);
- ret = ret ?:
register_btf_kfunc_id_set(BPF_PROG_TYPE_CGROUP_SOCKOPT,
-&bpf_mptcp_common_kfunc_set);
ret = ret ?:register_btf_kfunc_id_set(BPF_PROG_TYPE_STRUCT_OPS, &bpf_mptcp_common_kfunc_set);
#ifdefCONFIG_BPF_JITCheers,
Matt
Matthieu Baerts
maintainerRe: [PATCH mptcp-next v2 2/2] Squash to "bpf: Export mptcp packet scheduler helpers"
Hi Geliang,
Quoted 128 lines · Geliang Tang
Hi Matt,
Thanks for your review.
Quoted 31 lines · Matthieu Baerts
Hi Geliang,
Quoted 3 lines · Geliang Tang
From: Geliang Tang <[email protected]>
Define .filter as Martin suggested.
Thank you for the v2.
Quoted 22 lines
Signed-off-by Geliang Tang <[email protected]>---
net/mptcp/bpf.c | 23 +++++++++++++++++++++--1 file changed, 21 insertions(+), 2 deletions(-)net/mptcp/bpf.c +0
-0@@ -317,9 +317,30 @@ BTF_ID_FLAGS(func, bpf_mptcp_subflow_queues_empty) BTF_ID_FLAGS(func, mptcp_pm_subflow_chk_stale, KF_SLEEPABLE) BTF_KFUNCS_END(bpf_mptcp_common_kfunc_ids)
+static intbpf_mptcp_common_kfunc_filter(const struct bpf_prog *prog, u32 kfunc_id)net/mptcp/bpf.c +6
-0+{ +if (!btf_id_set8_contains (&bpf_mptcp_common_kfunc_ids, kfunc_id)) +return 0 ; + +if (prog->type !=BPF_PROG_TYPE_STRUCT_OPS ) +return -EACCES ;Quoted 8 lines
Quoted 5 lines
+
+ /* .filter is called sometimes beforeprog->aux->st_opsis set,
+ * thenprog->aux->st_opsis NULL. If return-EACCESin this case,
+ * an error occur:
+ * bug: bad parent state for iter next callThat's interesting. Did you have this after having removed the register
forBPF_PROG_TYPE_CGROUP_SOCKOPT?Yes, I have removed this.
Quoted 7 lines
With this extra "
prog->aux->st_ops!= NULL" check, it sounds like the filter could allow other ops to use these KFunc, and thus that's an issue.Do you have more details about the error, and what exactly caused this?
bpf_iter_mptcp_subflow_nextin thekfunc_setcaused this:# #198/5 mptcp/first:OK
# libbpf: prog 'bpf_bkup_get_send': BPF program load failed:-EFAULT# libbpf: prog 'bpf_bkup_get_send': -- BEGIN PROG LOAD LOG -- # 0: R1=ctx() R10=fp0
# ; intBPF_PROG(bpf_bkup_get_send, struct mptcp_sock *msk)@ mptcp_bpf_bkup.c:20
# 0: (79) r2 = *(u64 *)(r1 +0)# func 'get_send' arg0 has btf_id 37366 type STRUCT 'mptcp_sock' # 1: R1=ctx() R2_w=trusted_ptr_mptcp_sock() # 1: (bf) r1 = r10 ; R1_w=fp0 R10=fp0 # 2: (07) r1 += -16 ; R1_w=fp-16 # ; bpf_for_each(mptcp_subflow, subflow, (struct sock *)msk) { @ mptcp_bpf_bkup.c:24 # 3: (85) call bpf_iter_mptcp_subflow_new#53836 ; R0_w=scalar() fp-16_w=iter_mptcp_subflow(ref_id=1,state=active,depth=0) refs=1 # 4: (b7) r7 = 0 ; R7_w=0 refs=1 # 5: (b7) r9 = 0 ; R9_w=0 refs=1 # 6: (b7) r8 = 0 ; R8_w=0 refs=1 # 7: (05) goto pc+16 # ; if (!BPF_CORE_READ_BITFIELD_PROBED(subflow, backup) || @ mptcp_bpf_bkup.c:25 # 24: (bf) r1 = r10 ; R1_w=fp0 R10=fp0 refs=1 # 25: (07) r1 += -16 ; R1_w=fp-16 refs=1 # ; bpf_for_each(mptcp_subflow, subflow, (struct sock *)msk) { @ mptcp_bpf_bkup.c:24 # 26: (85) call bpf_iter_mptcp_subflow_next#53838 # bug: bad parent state for iter next callprocessed 11 insns (limit 1000000) max_states_per_insn 0 total_states 1 peak_states 1 mark_read 1 # -- END PROG LOAD LOG -- # libbpf: prog 'bpf_bkup_get_send': failed to load: -EFAULT # libbpf: failed to load object 'mptcp_bpf_bkup' # libbpf: failed to load BPF skeleton 'mptcp_bpf_bkup': -EFAULT # test_bkup:FAIL:open_and_load: bkup unexpected error: -14 # #198/6 mptcp/bkup:FAILQuoted 4 lines
Maybe we should report this issue to BPF maintainers, because what you
did sounds incorrect for a filter, and they didn't have to do that in QDisc.Since QDisc's
kfunc_setdoes not include an iter next function.This can solve the problem by putting this iter next function in another
kfunc_set, but it is not a perfect solution:'''
BTF_KFUNCS_START(bpf_mptcp_common_kfunc_ids)BTF_ID_FLAGS(func, bpf_mptcp_subflow_ctx, KF_RET_NULL)BTF_ID_FLAGS(func, bpf_mptcp_subflow_tcp_sock, KF_RET_NULL)BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_new, KF_ITER_NEW | KF_TRUSTED_ARGS)BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_destroy, KF_ITER_DESTROY)BTF_ID_FLAGS(func, mptcp_subflow_set_scheduled)BTF_ID_FLAGS(func, mptcp_subflow_active)BTF_ID_FLAGS(func, mptcp_set_timeout)BTF_ID_FLAGS(func, mptcp_wnd_end)BTF_ID_FLAGS(func, bpf_sk_stream_memory_free, KF_RET_NULL)BTF_ID_FLAGS(func, bpf_mptcp_subflow_queues_empty)BTF_ID_FLAGS(func, mptcp_pm_subflow_chk_stale, KF_SLEEPABLE)BTF_KFUNCS_END(bpf_mptcp_common_kfunc_ids)static int
bpf_mptcp_common_kfunc_filter(const struct bpf_prog *prog, u32 kfunc_id)
{
if (!btf_id_set8_contains(&bpf_mptcp_common_kfunc_ids,kfunc_id))return 0; if (prog->type != BPF_PROG_TYPE_STRUCT_OPS) return -EACCES;
Quoted 4 lines
#ifdef CONFIG_BPF_JIT if (prog->aux->st_ops != &bpf_mptcp_sched_ops) return -EACCES;#endif
I think you should move the "#endif" before the return, so one line above where it is for the moment: if CONFIG_BPF_JIT is not set, it means the struct ops cannot be ours, so these kfunc cannot be used.
Quoted 22 lines
return 0; }static const struct
btf_kfunc_id_setbpf_mptcp_common_kfunc_set= {
.owner =THIS_MODULE,
.set =&bpf_mptcp_common_kfunc_ids,
.filter =bpf_mptcp_common_kfunc_filter,
};
BTF_KFUNCS_START(bpf_mptcp_iter_next_kfunc_ids)BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_next, KF_ITER_NEXT | KF_RET_NULL)BTF_KFUNCS_END(bpf_mptcp_iter_next_kfunc_ids)static const struct
btf_kfunc_id_setbpf_mptcp_iter_next_kfunc_set= {
.owner =THIS_MODULE,
.set =&bpf_mptcp_iter_next_kfunc_ids,
};...
Quoted 8 lines
ret = register_btf_kfunc_id_set(BPF_PROG_TYPE_STRUCT_OPS,
&bpf_mptcp_common_kfunc_set); ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_STRUCT_OPS, &bpf_mptcp_iter_next_kfunc_set);...
'''WDYT?
Thank you for having checked!
Your solution looks good. If we need to take this direction, I would put all the bpf_iter_mptcp_* kfunc in this set, not just the "next" one. WDYT? Also, if we do that, please add a comment before declaring this set, something mentioning that with bpf_iter_mptcp_subflow_next, prog->aux->st_ops is not set, and the filter doesn't work. So we can have a discussion with BPF maintainers about that if needed.
But before, do you mind checking if something else is set in prog->aux (or prog) when this bpf_iter_mptcp_subflow_next kfunc is used? Maybe we could keep a single group and in the filter, having something like:
if (/* is bpf_iter_mptcp_subflow_next */ ||
prog->aux->st_ops != &bpf_mptcp_sched_ops)
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
kernel test robot
build botRe: [PATCH mptcp-next v2 2/2] Squash to "bpf: Export mptcp packet scheduler helpers"
In reply to Geliang Tangkernel test robot noticed the following build errors:
Hi Geliang,
kernel test robot noticed the following build errors:
[auto build test ERROR on mptcp/export]
[cannot apply to mptcp/export-net bpf-next/net bpf-next/master bpf/master linus/master v6.15-rc7 next-20250522] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Geliang-Tang/Revert-selftests-bpf-Add-mptcp_subflow-bpf_iter-subtest/20250522-150813 base: https://github.com/multipath-tcp/mptcp_net-next.git export patch link: https://lore.kernel.org/r/dfd9d56e608ea3f68297092c9e90134e4807d3d6.1747897261.git.tanggeliang%40kylinos.cn patch subject: [PATCH mptcp-next v2 2/2] Squash to "bpf: Export mptcp packet scheduler helpers" config: x86_64-kexec (https://download.01.org/0day-ci/archive/20250523/[email protected]/config) compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250523/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> net/mptcp/bpf.c:334:28: error: use of undeclared identifier 'bpf_mptcp_sched_ops'
334 | prog->aux->st_ops != &bpf_mptcp_sched_ops)
| ^1 error generated.
vim +/bpf_mptcp_sched_ops +334 net/mptcp/bpf.c
319
320 static int bpf_mptcp_common_kfunc_filter(const struct bpf_prog *prog, u32 kfunc_id)
321 {
322 if (!btf_id_set8_contains(&bpf_mptcp_common_kfunc_ids, kfunc_id))
323 return 0;
324
325 if (prog->type != BPF_PROG_TYPE_STRUCT_OPS)
326 return -EACCES;
327
328 /* .filter is called sometimes before prog->aux->st_ops is set,
329 * then prog->aux->st_ops is NULL. If return -EACCES in this case,
330 * an error occur:
331 * bug: bad parent state for iter next call
332 */
333 if (prog->aux->st_ops &&
> 334 prog->aux->st_ops != &bpf_mptcp_sched_ops)
335 return -EACCES;
336
337 return 0;
338 }
339
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki