__u32 type;
__u32 protocol;
} socket;
+ struct {
+ __u64 flags;
+ __u64 mode;
+ __u64 resolve;
+ } open;
};
};
#include "io_uring.h"
#include "bpf_filter.h"
#include "net.h"
+#include "openclose.h"
struct io_bpf_filter {
struct bpf_prog *prog;
bctx->pdu_size = sizeof(bctx->socket);
io_socket_bpf_populate(bctx, req);
break;
+ case IORING_OP_OPENAT:
+ case IORING_OP_OPENAT2:
+ bctx->pdu_size = sizeof(bctx->open);
+ io_openat_bpf_populate(bctx, req);
+ break;
}
}
return 0;
}
+void io_openat_bpf_populate(struct io_uring_bpf_ctx *bctx, struct io_kiocb *req)
+{
+ struct io_open *open = io_kiocb_to_cmd(req, struct io_open);
+
+ bctx->open.flags = open->how.flags;
+ bctx->open.mode = open->how.mode;
+ bctx->open.resolve = open->how.resolve;
+}
+
int io_openat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
{
struct io_open *open = io_kiocb_to_cmd(req, struct io_open);
// SPDX-License-Identifier: GPL-2.0
+#include "bpf_filter.h"
+
int __io_close_fixed(struct io_ring_ctx *ctx, unsigned int issue_flags,
unsigned int offset);
int io_openat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
int io_openat(struct io_kiocb *req, unsigned int issue_flags);
void io_open_cleanup(struct io_kiocb *req);
+void io_openat_bpf_populate(struct io_uring_bpf_ctx *bctx, struct io_kiocb *req);
int io_openat2_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
int io_openat2(struct io_kiocb *req, unsigned int issue_flags);