File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -317,18 +317,32 @@ BTF_ID_FLAGS(func, bpf_mptcp_subflow_queues_empty)
317317BTF_ID_FLAGS (func , mptcp_pm_subflow_chk_stale , KF_SLEEPABLE )
318318BTF_KFUNCS_END (bpf_mptcp_common_kfunc_ids )
319319
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+ #ifdef CONFIG_BPF_JIT
329+ if (prog -> aux -> st_ops == & bpf_mptcp_sched_ops )
330+ return 0 ;
331+ #endif
332+ return - EACCES ;
333+ }
334+
320335static const struct btf_kfunc_id_set bpf_mptcp_common_kfunc_set = {
321336 .owner = THIS_MODULE ,
322337 .set = & bpf_mptcp_common_kfunc_ids ,
338+ .filter = bpf_mptcp_common_kfunc_filter ,
323339};
324340
325341static int __init bpf_mptcp_kfunc_init (void )
326342{
327343 int ret ;
328344
329345 ret = register_btf_fmodret_id_set (& bpf_mptcp_fmodret_set );
330- ret = ret ?: register_btf_kfunc_id_set (BPF_PROG_TYPE_CGROUP_SOCKOPT ,
331- & bpf_mptcp_common_kfunc_set );
332346 ret = ret ?: register_btf_kfunc_id_set (BPF_PROG_TYPE_STRUCT_OPS ,
333347 & bpf_mptcp_common_kfunc_set );
334348#ifdef CONFIG_BPF_JIT
You can’t perform that action at this time.
0 commit comments