提交 044d8052 编写于 作者: J Jens Axboe 提交者: Cheng Jian

io_uring: statx/openat/openat2 don't support fixed files

mainline inclusion
from mainline-5.6-rc2
commit cf3040ca
category: feature
bugzilla: https://bugzilla.openeuler.org/show_bug.cgi?id=27
CVE: NA
---------------------------

All of these opcodes take a directory file descriptor. We can't easily
support fixed files for these operations, and the use case for that
probably isn't all that clear (or sensible) anyway.

Disable IOSQE_FIXED_FILE for these operations.
Reported-by: NStefan Metzmacher <metze@samba.org>
Signed-off-by: NJens Axboe <axboe@kernel.dk>

Conflicts:
	fs/io_uring.c
[skip openat2 for commit cebdb986
 ("io_uring: add support for IORING_OP_OPENAT2") is not applied]
Signed-off-by: Nyangerkun <yangerkun@huawei.com>
Reviewed-by: Nzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
上级 9a1d3513
...@@ -2511,6 +2511,8 @@ static int io_openat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) ...@@ -2511,6 +2511,8 @@ static int io_openat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
if (sqe->ioprio || sqe->buf_index) if (sqe->ioprio || sqe->buf_index)
return -EINVAL; return -EINVAL;
if (sqe->flags & IOSQE_FIXED_FILE)
return -EBADF;
req->open.dfd = READ_ONCE(sqe->fd); req->open.dfd = READ_ONCE(sqe->fd);
req->open.mode = READ_ONCE(sqe->len); req->open.mode = READ_ONCE(sqe->len);
...@@ -2688,6 +2690,8 @@ static int io_statx_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) ...@@ -2688,6 +2690,8 @@ static int io_statx_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
if (sqe->ioprio || sqe->buf_index) if (sqe->ioprio || sqe->buf_index)
return -EINVAL; return -EINVAL;
if (sqe->flags & IOSQE_FIXED_FILE)
return -EBADF;
req->open.dfd = READ_ONCE(sqe->fd); req->open.dfd = READ_ONCE(sqe->fd);
req->open.mask = READ_ONCE(sqe->len); req->open.mask = READ_ONCE(sqe->len);
...@@ -2761,7 +2765,7 @@ static int io_close_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) ...@@ -2761,7 +2765,7 @@ static int io_close_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
sqe->rw_flags || sqe->buf_index) sqe->rw_flags || sqe->buf_index)
return -EINVAL; return -EINVAL;
if (sqe->flags & IOSQE_FIXED_FILE) if (sqe->flags & IOSQE_FIXED_FILE)
return -EINVAL; return -EBADF;
req->close.fd = READ_ONCE(sqe->fd); req->close.fd = READ_ONCE(sqe->fd);
if (req->file->f_op == &io_uring_fops || if (req->file->f_op == &io_uring_fops ||
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册