Re: [PATCH v1 bpf-next 1/8] selftest: bpf: Use BPF_SOCK_OPS_ALL_CB_FLAGS + 1 for bad_cb_test_rv.
Kuniyuki Iwashima <[email protected]> Fri, 8 May 2026 13:21:04 -0700
| Newsgroups | dev.linux.lists.sashiko,org.kernel.vger.bpf |
|---|---|
| Message-ID | <CAAVpQUAh-OiEUJ7PqcLAgYjJq8K9QTFPsDfVVeAcicyvtF4hog@mail.gmail.com> |
On Fri, May 8, 2026 at 12:02 PM <[email protected]> wrote: > > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: > - [Medium] Using `BPF_SOCK_OPS_ALL_CB_FLAGS + 1` to test invalid BPF callback flags creates brittle test logic that assumes contiguous bitmasks and breaks forward compatibility. > -- > > commit dfed6c2387074d0f6f7afb70b6bba777371f7267 > Author: Kuniyuki Iwashima <[email protected]> > > selftest: bpf: Use BPF_SOCK_OPS_ALL_CB_FLAGS + 1 for bad_cb_test_rv. > > Once bpf_sock_ops_cb_flags_set() supports a new flag, > tcpbpf_user.c fails due to the hard-coded max value, 0x80. > > > diff --git a/tools/testing/selftests/bpf/prog_tests/tcpbpf_user.c b/tools/testing/selftests/bpf/prog_tests/tcpbpf_user.c > > index 7e8fe1bad03f5..e4849d2a2956f 100644 > > --- a/tools/testing/selftests/bpf/prog_tests/tcpbpf_user.c > > +++ b/tools/testing/selftests/bpf/prog_tests/tcpbpf_user.c > > @@ -26,7 +26,8 @@ static void verify_result(struct tcpbpf_globals *result) > > ASSERT_EQ(result->bytes_acked, 1002, "bytes_acked"); > > ASSERT_EQ(result->data_segs_in, 1, "data_segs_in"); > > ASSERT_EQ(result->data_segs_out, 1, "data_segs_out"); > > - ASSERT_EQ(result->bad_cb_test_rv, 0x80, "bad_cb_test_rv"); > > + ASSERT_EQ(result->bad_cb_test_rv, BPF_SOCK_OPS_ALL_CB_FLAGS + 1, > > + "bad_cb_test_rv"); > > Is BPF_SOCK_OPS_ALL_CB_FLAGS + 1 robust for forward compatibility? This test is not supposed to run on older kernel.