From: Kui-Feng Lee <sinquersw@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Kui-Feng Lee <thinker.li@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>, Kernel Team <kernel-team@meta.com>,
Andrii Nakryiko <andrii@kernel.org>,
Kui-Feng Lee <kuifeng@meta.com>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH bpf-next v3 1/3] x86/cfi,bpf: Add a stub function for get_info of struct tcp_congestion_ops.
Date: Tue, 20 Feb 2024 14:26:52 -0800 [thread overview]
Message-ID: <9e885f05-7aba-4b1b-803e-a092c9b9c0f8@gmail.com> (raw)
In-Reply-To: <CAADnVQ+hXmKGxHQopt8HF5d85sn2vvqZoJ1xNXWV9LzVTtjw1g@mail.gmail.com>
On 2/20/24 09:38, Alexei Starovoitov wrote:
> On Fri, Feb 16, 2024 at 11:34 AM <thinker.li@gmail.com> wrote:
>>
>> From: Kui-Feng Lee <thinker.li@gmail.com>
>>
>> struct tcp_congestion_ops is missing a stub function for get_info. This is
>> required for checking the consistency of cfi_stubs of struct_ops.
>>
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
>> ---
>> net/ipv4/bpf_tcp_ca.c | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/net/ipv4/bpf_tcp_ca.c b/net/ipv4/bpf_tcp_ca.c
>> index 7f518ea5f4ac..6ab5d9c36416 100644
>> --- a/net/ipv4/bpf_tcp_ca.c
>> +++ b/net/ipv4/bpf_tcp_ca.c
>> @@ -321,6 +321,12 @@ static u32 bpf_tcp_ca_sndbuf_expand(struct sock *sk)
>> return 0;
>> }
>>
>> +static size_t bpf_tcp_ca_get_info(struct sock *sk, u32 ext, int *attr,
>> + union tcp_cc_info *info)
>> +{
>> + return 0;
>> +}
>> +
>> static void __bpf_tcp_ca_init(struct sock *sk)
>> {
>> }
>> @@ -340,6 +346,7 @@ static struct tcp_congestion_ops __bpf_ops_tcp_congestion_ops = {
>> .cong_control = bpf_tcp_ca_cong_control,
>> .undo_cwnd = bpf_tcp_ca_undo_cwnd,
>> .sndbuf_expand = bpf_tcp_ca_sndbuf_expand,
>> + .get_info = bpf_tcp_ca_get_info,
>
> No. It was explicitly skipped.
> The plan is to use NULL in cfi_stubs to remove
> static u32 unsupported_ops[] = {
> offsetof(struct tcp_congestion_ops, get_info),
> };
> and manual check of such fields in is_unsupported().
Ok! That means I have to check the result of st_ops->check() to skip
unsupported ops.
> NULL is cfi_stubs will be such an indication.
>
> pw-bot: cr
next prev parent reply other threads:[~2024-02-20 22:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-16 19:34 [PATCH bpf-next v3 0/3] Check cfi_stubs before registering a struct_ops type thinker.li
2024-02-16 19:34 ` [PATCH bpf-next v3 1/3] x86/cfi,bpf: Add a stub function for get_info of struct tcp_congestion_ops thinker.li
2024-02-20 17:38 ` Alexei Starovoitov
2024-02-20 22:26 ` Kui-Feng Lee [this message]
2024-02-16 19:34 ` [PATCH bpf-next v3 2/3] bpf: Check cfi_stubs before registering a struct_ops type thinker.li
2024-02-16 19:34 ` [PATCH bpf-next v3 3/3] selftests/bpf: Test case for lacking CFI stub functions thinker.li
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=9e885f05-7aba-4b1b-803e-a092c9b9c0f8@gmail.com \
--to=sinquersw@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=kernel-team@meta.com \
--cc=kuifeng@meta.com \
--cc=martin.lau@linux.dev \
--cc=peterz@infradead.org \
--cc=song@kernel.org \
--cc=thinker.li@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox