Skip to contentSkip to conversation

io_uring: Use original task for req identity in io_identity_cow()

PATCH In review Lee Jones 3 participants 3 messages Jul 19, 2022 – Jul 23, 2022

Subsystems (3)
lore
Share & tools
lore

Lee Jones

author
#0 lore raw

PATCH 1/1 io_uring: Use original task for req identity in io_identity_cow()

This issue is conceptually identical to the one fixed in 29f077d07051 ("io_uring: always use original task when preparing req identity"), so rather than reinvent the wheel, I'm shamelessly quoting the commit message from that patch - thanks Jens:

"If the ring is setup with IORING_SETUP_IOPOLL and we have more than
one task doing submissions on a ring, we can up in a situation where we assign the context from the current task rather than the request originator.

Always use req->task rather than assume it's the same as current.

No upstream patch exists for this issue, as only older kernels with the non-native workers have this problem."

Cc Jens Axboe <[email protected]>
Cc Pavel Begunkov <[email protected]>
Cc Alexander Viro <[email protected]>
Fixes 5c3462cfd123b ("io_uring: store io_identity in io_uring_task")
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/io_uring.c +1 -1
index 023c3eb34dcca..a952288b2ab8e 100644
@@ -1325,7 +1325,7 @@ static void io_req_clean_work(struct io_kiocb *req)
  */
 static bool io_identity_cow(struct io_kiocb *req)
 {
-	struct io_uring_task *tctx = current->io_uring;
+	struct io_uring_task *tctx = req->task->io_uring;
 	const struct cred *creds = NULL;
 	struct io_identity *id;
 
Signature · 1 line
2.37.0.170.g444d1eabd0-goog
maintainer
#1 lore raw
Quoted 10 lines · Lee Jones

This issue is conceptually identical to the one fixed in 29f077d07051 ("io_uring: always use original task when preparing req identity"), so rather than reinvent the wheel, I'm shamelessly quoting the commit message from that patch - thanks Jens:

"If the ring is setup with IORING_SETUP_IOPOLL and we have more than
one task doing submissions on a ring, we can up in a situation where we assign the context from the current task rather than the request originator.

Quoted 4 lines

Always use req->task rather than assume it's the same as current.

No upstream patch exists for this issue, as only older kernels with the non-native workers have this problem."

Greg, can you pick this one up for 5.10-stable? Thanks!

Signature · 1 line
Jens Axboe
#2 lore raw
Quoted 11 lines · Jens Axboe
Quoted 10 lines · Lee Jones

This issue is conceptually identical to the one fixed in 29f077d07051 ("io_uring: always use original task when preparing req identity"), so rather than reinvent the wheel, I'm shamelessly quoting the commit message from that patch - thanks Jens:

"If the ring is setup with IORING_SETUP_IOPOLL and we have more than
one task doing submissions on a ring, we can up in a situation where we assign the context from the current task rather than the request originator.

Quoted 6 lines
Quoted 4 lines

Always use req->task rather than assume it's the same as current.

No upstream patch exists for this issue, as only older kernels with the non-native workers have this problem."

Greg, can you pick this one up for 5.10-stable? Thanks!

Now queued up, thanks.

greg k-h