[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5918e491-f3fa-4123-8cb6-42436346cca6@meta.com>
Date: Mon, 1 Dec 2025 20:11:47 -0500
From: Chris Mason <clm@...a.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>, bot+bpf-ci@...nel.org
Cc: Amery Hung <ameryhung@...il.com>, bpf <bpf@...r.kernel.org>,
Network Development <netdev@...r.kernel.org>,
Andrii Nakryiko <andrii@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <martin.lau@...nel.org>,
Kernel Team
<kernel-team@...a.com>,
Alexei Starovoitov <ast@...nel.org>, Eduard <eddyz87@...il.com>,
Yonghong Song <yonghong.song@...ux.dev>,
Ihor Solodrai <ihor.solodrai@...ux.dev>
Subject: Re: [PATCH bpf v1 2/2] selftests/bpf: Test using cgroup storage in a
tail call callee program
On 12/1/25 8:09 PM, Alexei Starovoitov wrote:
> On Mon, Dec 1, 2025 at 4:35 PM <bot+bpf-ci@...nel.org> wrote:
>>
>>> diff --git a/tools/testing/selftests/bpf/prog_tests/tailcalls.c b/tools/testing/selftests/bpf/prog_tests/tailcalls.c
>>> index 0ab36503c..e4a5287f1 100644
>>> --- a/tools/testing/selftests/bpf/prog_tests/tailcalls.c
>>> +++ b/tools/testing/selftests/bpf/prog_tests/tailcalls.c
>>
>> [ ... ]
>>
>>> @@ -1648,6 +1649,28 @@ static void test_tailcall_bpf2bpf_freplace(void)
>>> tc_bpf2bpf__destroy(tc_skel);
>>> }
>>>
>>> +/*
>>> + * test_tail_call_cgrp_storage makes sure that callee programs cannot
>>> + * use cgroup storage
>>> + */
>>> +static void test_tailcall_cgrp_storage(void)
>>> +{
>>> + int err, prog_fd, prog_array_fd, key = 0;
>>> + struct tailcall_cgrp_storage *skel;
>>> +
>>> + skel = tailcall_cgrp_storage__open_and_load();
>>> + if (!ASSERT_OK_PTR(skel, "tailcall_cgrp_storage__open_and_load"))
>>> + return;
>>> +
>>> + prog_fd = bpf_program__fd(skel->progs.callee_prog);
>>> + prog_array_fd = bpf_map__fd(skel->maps.prog_array);
>> ^^^^
>>
>> Should the return values of bpf_program__fd() and bpf_map__fd() be
>> checked before use? Other tests in this file validate these return
>> values (see test_tailcall_1 and similar tests which check for < 0).
>>
>> Without checking, if either function returns a negative error value,
>> bpf_map_update_elem() could fail for the wrong reason (invalid FD),
>> and ASSERT_ERR would still pass, potentially masking issues with the
>> actual kernel restriction being tested.
>
> Chris,
>
> note... AI is wrong here.
> We don't check FDs returned by these getters because skeleton open_and_load()
> succeeded.
Thanks Alexei, I'll fix this up.
-chris
Powered by blists - more mailing lists