summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-01-26 15:17:42 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2024-01-26 15:17:42 -0800
commitcced1c5e72b7466e6c9091370eaf5d55a4ddeecb (patch)
tree3282fa6e2f63ba49edb200da0ce9a6f87fd64ae9
parent667c889308a171748dd19d496a9714b77c688a86 (diff)
parent16bae3e1377846734ec6b87eee459c0f3551692c (diff)
Merge tag 'io_uring-6.8-2024-01-26' of git://git.kernel.dk/linux
Pull io_uring fix from Jens Axboe: "Just a single tweak to the newly added IORING_OP_FIXED_FD_INSTALL from Paul, ensuring it goes via the audit path and playing it safe by excluding it from using registered creds" * tag 'io_uring-6.8-2024-01-26' of git://git.kernel.dk/linux: io_uring: enable audit and restrict cred override for IORING_OP_FIXED_FD_INSTALL
-rw-r--r--io_uring/opdef.c1
-rw-r--r--io_uring/openclose.c4
2 files changed, 4 insertions, 1 deletions
diff --git a/io_uring/opdef.c b/io_uring/opdef.c
index 6705634e5f52..b1ee3a9c3807 100644
--- a/io_uring/opdef.c
+++ b/io_uring/opdef.c
@@ -471,7 +471,6 @@ const struct io_issue_def io_issue_defs[] = {
},
[IORING_OP_FIXED_FD_INSTALL] = {
.needs_file = 1,
- .audit_skip = 1,
.prep = io_install_fixed_fd_prep,
.issue = io_install_fixed_fd,
},
diff --git a/io_uring/openclose.c b/io_uring/openclose.c
index 0fe0dd305546..e3357dfa14ca 100644
--- a/io_uring/openclose.c
+++ b/io_uring/openclose.c
@@ -277,6 +277,10 @@ int io_install_fixed_fd_prep(struct io_kiocb *req, const struct io_uring_sqe *sq
if (flags & ~IORING_FIXED_FD_NO_CLOEXEC)
return -EINVAL;
+ /* ensure the task's creds are used when installing/receiving fds */
+ if (req->flags & REQ_F_CREDS)
+ return -EPERM;
+
/* default to O_CLOEXEC, disable if IORING_FIXED_FD_NO_CLOEXEC is set */
ifi = io_kiocb_to_cmd(req, struct io_fixed_install);
ifi->o_flags = O_CLOEXEC;