From: Geliang Tang <tanggeliang@kylinos.cn>
Define .filter as Martin suggested.
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
net/mptcp/bpf.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c
index 2b0cfb57df8c..4044a8f2c477 100644
--- a/net/mptcp/bpf.c
+++ b/net/mptcp/bpf.c
@@ -317,9 +317,22 @@ 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->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)
--
2.43.0
Hi Geliang,
kernel test robot noticed the following build errors:
[auto build test ERROR on mptcp/export]
[cannot apply to mptcp/export-net linus/master v6.15-rc7 next-20250516]
[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/Squash-to-selftests-bpf-Add-mptcp_subflow-bpf_iter-subtest/20250520-165020
base: https://github.com/multipath-tcp/mptcp_net-next.git export
patch link: https://lore.kernel.org/r/9c089a245833c43d55ec240be1b880909af849ce.1747730598.git.tanggeliang%40kylinos.cn
patch subject: [PATCH mptcp-next 2/2] Squash to "bpf: Export mptcp packet scheduler helpers"
config: i386-buildonly-randconfig-005-20250521 (https://download.01.org/0day-ci/archive/20250521/202505210809.DJ1jeY8P-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250521/202505210809.DJ1jeY8P-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/202505210809.DJ1jeY8P-lkp@intel.com/
All errors (new ones prefixed by >>):
net/mptcp/bpf.c: In function 'bpf_mptcp_common_kfunc_filter':
>> net/mptcp/bpf.c:326:35: error: 'bpf_mptcp_sched_ops' undeclared (first use in this function); did you mean 'mptcp_sched_ops'?
326 | prog->aux->st_ops != &bpf_mptcp_sched_ops)
| ^~~~~~~~~~~~~~~~~~~
| mptcp_sched_ops
net/mptcp/bpf.c:326:35: note: each undeclared identifier is reported only once for each function it appears in
vim +326 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->aux->st_ops &&
> 326 prog->aux->st_ops != &bpf_mptcp_sched_ops)
327 return -EACCES;
328
329 return 0;
330 }
331
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Geliang,
On 20/05/2025 10:48, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> Define .filter as Martin suggested.
>
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
> net/mptcp/bpf.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c
> index 2b0cfb57df8c..4044a8f2c477 100644
> --- a/net/mptcp/bpf.c
> +++ b/net/mptcp/bpf.c
> @@ -317,9 +317,22 @@ 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->aux->st_ops &&
See my message on the previous patch: maybe we don't need this condition
then.
> + 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)
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
© 2016 - 2025 Red Hat, Inc.