Re: [PATCH liburing] tests: add cBPF filter tests for IORING_OP_CONNECT

Shouvik Kar <[email protected]>
Newsgroups org.kernel.vger.io-uring
Message-ID <CABnvZUnvr1D920PvKPtmy95Lrbv+mfAtsAk820WU4v3+KxP3FQ@mail.gmail.com>
Sure. Have sent v2 patch  — added a probe_connect_filter_support()
helper that fork-registers a CONNECT filter once up front and gates
connect subtests behind the result.

Regard,
Shouvik Kar


On Wed, May 13, 2026 at 10:36 PM Jens Axboe <[email protected]> wrote:
>
> On 5/13/26 6:10 AM, Shouvik Kar wrote:
> > Add subtests for IORING_OP_CONNECT to test/cbpf_filter.c, exercising
> > the io_connect_bpf_populate() helper added in the companion kernel
> > patch ("io_uring/net: allow filtering on IORING_OP_CONNECT").
> >
> > Coverage spans both blacklist and whitelist filters for each
> > connect-specific data field (family, v4 address, v6 address, port),
> > plus v4 and v6 subnet matching, and a test for the addr_len guard
> > in io_connect_bpf_populate that prevents stale io_async_msghdr
> > cache from leaking through to the filter on short connects.
>
> If you run this on a kernel that doesn't have your connect changes,
> then you get a lot of:
>
> Child: register failed: Message too long
> Child: register failed: Message too long
> Child: register failed: Message too long
> Child: register failed: Message too long
> Child: register failed: Message too long
> Child: register failed: Message too long
> Child: register failed: Message too long
> Child: register failed: Message too long
> Child: register failed: Message too long
> Child: register failed: Message too long
> Child: register failed: Message too long
> Child: register failed: Message too long
> Child: register failed: Message too long
>
> when the test is run. It's important that any liburing test cases
> handles older kernels appropriately. You get some of it for free with
> this test case, as previous tests will have already checked if cbpf
> filters are supported in the first place. But you still need to handle
> the case where cbpf filters are supported by io_uring, yet the kernel
> doesn't support your filter yet.
>
> It should just check for the error on the first case and skip testing
> the rest of them.
>
> --
> Jens Axboe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.