On Tue, Jun 22, 2021 at 6:52 PM Pavel Begunkov <asml.silence@xxxxxxxxx> wrote: > > On 6/3/21 6:18 AM, Dmitry Kadashev wrote: > > IORING_OP_MKNODAT behaves like mknodat(2) and takes the same flags and > > arguments. > > > > Suggested-by: Christian Brauner <christian.brauner@xxxxxxxxxx> > > Link: https://lore.kernel.org/io-uring/20210514145259.wtl4xcsp52woi6ab@wittgenstein/ > > Signed-off-by: Dmitry Kadashev <dkadashev@xxxxxxxxx> > > --- > > fs/internal.h | 2 ++ > > fs/io_uring.c | 56 +++++++++++++++++++++++++++++++++++ > > fs/namei.c | 2 +- > > include/uapi/linux/io_uring.h | 2 ++ > > 4 files changed, 61 insertions(+), 1 deletion(-) > > > > diff --git a/fs/internal.h b/fs/internal.h > > index 15a7d210cc67..c6fb9974006f 100644 > > [...] > > > static bool io_disarm_next(struct io_kiocb *req); > > @@ -3687,6 +3697,44 @@ static int io_linkat(struct io_kiocb *req, int issue_flags) > > io_req_complete(req, ret); > > return 0; > > } > > +static int io_mknodat_prep(struct io_kiocb *req, > > + const struct io_uring_sqe *sqe) > > +{ > > + struct io_mknod *mkn = &req->mknod; > > + const char __user *fname; > > + > > + if (unlikely(req->flags & REQ_F_FIXED_FILE)) > > + return -EBADF; > > IOPOLL won't support it, and the check is missing. > Probably for other opcodes as well. > > if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL)) > return -EINVAL; This change is based on some other similar opcodes (unlinkat, renameat) that were added a while ago. Those lack the check as well. I guess I'll just prepare a patch that adds the checks to all of them. Thanks, Pavel. Jens, separately it's my understanding that you do not want the MKNODAT opcode at all, should I drop this from the subsequent series? -- Dmitry Kadashev