On 9/13/24 1:57 PM, Andrii Nakryiko wrote:
+__bpf_kfunc int bpf_iter_mptcp_subflow_new(struct
bpf_iter_mptcp_subflow *it,
+ struct mptcp_sock *msk)
+{
+ struct bpf_iter_mptcp_subflow_kern *kit = (void *)it;
+
+ kit->msk = msk;
+ if (!msk)
+ return -EINVAL;
+
+ kit->pos = &msk->conn_list;
+ return 0;
+}
[ ... ]
BTF_KFUNCS_START(bpf_mptcp_sched_kfunc_ids)
+BTF_ID_FLAGS(func, bpf_iter_mptcp_subflow_new)
I'm not 100% sure, but I suspect you might need to specify
KF_TRUSTED_ARGS here to ensure that `struct mptcp_sock *msk` is a
+1
@@ -241,6 +286,8 @@ 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_TRACING,
+
&bpf_mptcp_sched_kfunc_set);
This cannot be used in tracing.
Going back to my earlier question in v1. How is the msk->conn_list protected?