mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-23 05:07:37 -04:00
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: d0e437b76b ("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>
29 lines
496 B
C
29 lines
496 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef IOU_BPF_OPS_H
|
|
#define IOU_BPF_OPS_H
|
|
|
|
#include <linux/io_uring_types.h>
|
|
|
|
enum {
|
|
IOU_REGION_MEM,
|
|
IOU_REGION_CQ,
|
|
IOU_REGION_SQ,
|
|
};
|
|
|
|
struct io_uring_bpf_ops {
|
|
int (*loop_step)(struct iou_ctx *, struct iou_loop_params *lp);
|
|
|
|
__u32 ring_fd;
|
|
void *priv;
|
|
};
|
|
|
|
#ifdef CONFIG_IO_URING_BPF_OPS
|
|
void io_unregister_bpf_ops(struct io_ring_ctx *ctx);
|
|
#else
|
|
static inline void io_unregister_bpf_ops(struct io_ring_ctx *ctx)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
#endif /* IOU_BPF_OPS_H */
|