Re: [PATCH liburing] tests: add cBPF filter tests for IORING_OP_CONNECT
Jens Axboe <[email protected]>
| Newsgroups | org.kernel.vger.io-uring |
|---|---|
| Message-ID | <[email protected]> |
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