summaryrefslogtreecommitdiff
path: root/io_uring/loop.h
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2026-06-02 11:08:25 +0100
committerJens Axboe <axboe@kernel.dk>2026-06-02 11:20:21 -0600
commitec02fe217fa66d79f8a65e8d28be9295c7f85093 (patch)
tree2b1b98d57278925e8d811850f106f6e6101b187b /io_uring/loop.h
parent29bef9934b2521f787bb15dd1985d4c0d12ae02a (diff)
downloadlinux-next-ec02fe217fa66d79f8a65e8d28be9295c7f85093.tar.gz
linux-next-ec02fe217fa66d79f8a65e8d28be9295c7f85093.zip
io_uring/bpf-ops: restrict ctx access to BPF
BPF programs should have no need in looking into struct io_ring_ctx, if anything, most of such cases would be anti patterns like looking up ring indices directly via the context. Replace it with a new empty structure, which is just an alias to struct io_ring_ctx. It'll create a new BTF type and fail verification if a BPF program tries to access it (beyond the first byte). It'll also give more flexibility for the future, and otherwise it can be made aligned with io_ring_ctx as before with struct groups if ever needed or extended in a different way. Fixes: d0e437b76bd3c ("io_uring/bpf-ops: implement loop_step with BPF struct_ops") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://patch.msgid.link/5f6ca3649e9e0bae8667db4357e28dd00cd07901.1780394491.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/loop.h')
-rw-r--r--io_uring/loop.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/io_uring/loop.h b/io_uring/loop.h
index d7718b9ce61e..4dd4fb3aefef 100644
--- a/io_uring/loop.h
+++ b/io_uring/loop.h
@@ -24,4 +24,14 @@ static inline bool io_has_loop_ops(struct io_ring_ctx *ctx)
int io_run_loop(struct io_ring_ctx *ctx);
+static inline struct iou_ctx *io_loop_mangle_ctx(struct io_ring_ctx *ctx)
+{
+ return (struct iou_ctx *)ctx;
+}
+
+static inline struct io_ring_ctx *io_loop_demangle_ctx(struct iou_ctx *ctx)
+{
+ return (struct io_ring_ctx *)ctx;
+}
+
#endif