From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>, mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next v4 3/5] Squash to "bpf: Register mptcp common kfunc set"
Date: Tue, 10 Dec 2024 12:46:00 +0100 [thread overview]
Message-ID: <b21b4b4c-48ab-460e-8e41-1782ca9a28a7@kernel.org> (raw)
In-Reply-To: <1de02f9ee30ee67ec5eb4bfd9bdef9737e6cd4d8.1733733573.git.tanggeliang@kylinos.cn>
On 09/12/2024 09:47, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> Drop bpf_mptcp_sk() and bpf_mptcp_subflow_tcp_sock() definitions. Use
> bpf_skc_to_mptcp_sock() and mptcp_subflow_tcp_sock() in mptcp_subflow
> bpf_iter selftests instead.
>
> Address Martin's comments in v1:
>
> - add null-check for bpf_mptcp_subflow_ctx.
> - add KF_RET_NULL flags for bpf_mptcp_subflow_ctx.
> - register this kfunc set to BPF_PROG_TYPE_CGROUP_SOCKOPT only,
> not BPF_PROG_TYPE_UNSPEC.
>
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
> net/mptcp/bpf.c | 20 +++++---------------
> 1 file changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c
> index a0f49af85d57..f9ba0a46a9f1 100644
> --- a/net/mptcp/bpf.c
> +++ b/net/mptcp/bpf.c
> @@ -218,21 +218,13 @@ struct bpf_iter_mptcp_subflow_kern {
>
> __bpf_kfunc_start_defs();
>
> -__bpf_kfunc static struct mptcp_sock *bpf_mptcp_sk(struct sock *sk)
> -{
> - return mptcp_sk(sk);
> -}
> -
> __bpf_kfunc static struct mptcp_subflow_context *
> bpf_mptcp_subflow_ctx(const struct sock *sk)
> {
> - return mptcp_subflow_ctx(sk);
> -}
> + if (!sk)
> + return NULL;
Is it enough for the restrictions?
I mean, from what I understood, this helper can be used from any CGROUP
SOCKOPT hooks, with any type of 'struct sock *': then it could be called
from a non MPTCP subflow socket, e.g. a socket with ULP data, no?
Then should we not check this?
sk->sk_protocol == IPPROTO_TCP && sk_is_mptcp(sk)
(and even sk_fullsock(sk)?)
(...)
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2024-12-10 11:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 8:47 [PATCH mptcp-next v4 0/5] Squash to "Add mptcp_subflow bpf_iter support" Geliang Tang
2024-12-09 8:47 ` [PATCH mptcp-next v4 1/5] mptcp: update bpf_mptcp_sock_from_subflow Geliang Tang
2024-12-10 11:43 ` Matthieu Baerts
2024-12-09 8:47 ` [PATCH mptcp-next v4 2/5] bpf: Allow use of skc_to_mptcp_sock in cg_sockopt Geliang Tang
2024-12-10 11:44 ` Matthieu Baerts
2024-12-09 8:47 ` [PATCH mptcp-next v4 3/5] Squash to "bpf: Register mptcp common kfunc set" Geliang Tang
2024-12-10 11:46 ` Matthieu Baerts [this message]
2024-12-09 8:47 ` [PATCH mptcp-next v4 4/5] Squash to "bpf: Add mptcp_subflow bpf_iter" Geliang Tang
2024-12-10 11:48 ` Matthieu Baerts
2024-12-11 3:42 ` Geliang Tang
2024-12-09 8:47 ` [PATCH mptcp-next v4 5/5] Squash to "selftests/bpf: Add mptcp_subflow bpf_iter subtest" Geliang Tang
2024-12-09 9:52 ` [PATCH mptcp-next v4 0/5] Squash to "Add mptcp_subflow bpf_iter support" MPTCP CI
2024-12-10 11:42 ` Matthieu Baerts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b21b4b4c-48ab-460e-8e41-1782ca9a28a7@kernel.org \
--to=matttbe@kernel.org \
--cc=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=tanggeliang@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.