diff options
| author | Shouvik Kar <auxcorelabs@gmail.com> | 2026-05-12 16:32:42 +0530 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-05-14 07:23:01 -0600 |
| commit | 899bea8248cee35d54760a5e7d61a76af8e64411 (patch) | |
| tree | 58dee729a3cfbfa802084725e726cdd5b7703c39 /include/uapi/linux/io_uring | |
| parent | c84701cfc90a90a6a9dfbdb138706a6d79f5b186 (diff) | |
| download | lwn-899bea8248cee35d54760a5e7d61a76af8e64411.tar.gz lwn-899bea8248cee35d54760a5e7d61a76af8e64411.zip | |
io_uring/net: allow filtering on IORING_OP_CONNECT
This adds custom filtering for IORING_OP_CONNECT, where the target
family is always exposed, and (for AF_INET / AF_INET6) port and
address are exposed. port and v4_addr are in network byte order so
filter authors can compare against on-wire constants.
Skip population unless addr_len covers the populated fields, to
avoid leaking stale io_async_msghdr data on short connects.
Signed-off-by: Shouvik Kar <auxcorelabs@gmail.com>
Link: https://patch.msgid.link/20260512110242.26219-1-auxcorelabs@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/uapi/linux/io_uring')
| -rw-r--r-- | include/uapi/linux/io_uring/bpf_filter.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/uapi/linux/io_uring/bpf_filter.h b/include/uapi/linux/io_uring/bpf_filter.h index 1b461d792a7b..ce7d78ab13b3 100644 --- a/include/uapi/linux/io_uring/bpf_filter.h +++ b/include/uapi/linux/io_uring/bpf_filter.h @@ -27,6 +27,22 @@ struct io_uring_bpf_ctx { __u64 mode; __u64 resolve; } open; + /* + * For CONNECT: fields are populated only when addr_len covers + * them; unpopulated fields are zero from the caller-side memset + * in io_uring_populate_bpf_ctx(). port and v4_addr are network + * byte order. Filters may only issue BPF_LD|BPF_W|BPF_ABS at + * 4-byte aligned offsets; load + mask for sub-word fields. + */ + struct { + __u32 family; /* sa_family_t zero-extended */ + __be16 port; + __u8 pad[2]; + union { + __be32 v4_addr; + __u8 v6_addr[16]; + }; + } connect; }; }; |
