Linux kernel -stable discussions
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] io_uring: don't touch sqd->thread off tw add" failed to apply to 6.12-stable tree
@ 2025-01-12  9:36 gregkh
  2025-01-12  9:57 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: gregkh @ 2025-01-12  9:36 UTC (permalink / raw)
  To: asml.silence, axboe, lizetao1, minhquangbui99; +Cc: stable


The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x bd2703b42decebdcddf76e277ba76b4c4a142d73
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2025011256-extinct-expanse-d059@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^..

Possible dependencies:



thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From bd2703b42decebdcddf76e277ba76b4c4a142d73 Mon Sep 17 00:00:00 2001
From: Pavel Begunkov <asml.silence@gmail.com>
Date: Fri, 10 Jan 2025 20:36:45 +0000
Subject: [PATCH] io_uring: don't touch sqd->thread off tw add

With IORING_SETUP_SQPOLL all requests are created by the SQPOLL task,
which means that req->task should always match sqd->thread. Since
accesses to sqd->thread should be separately protected, use req->task
in io_req_normal_work_add() instead.

Note, in the eyes of io_req_normal_work_add(), the SQPOLL task struct
is always pinned and alive, and sqd->thread can either be the task or
NULL. It's only problematic if the compiler decides to reload the value
after the null check, which is not so likely.

Cc: stable@vger.kernel.org
Cc: Bui Quang Minh <minhquangbui99@gmail.com>
Reported-by: lizetao <lizetao1@huawei.com>
Fixes: 78f9b61bd8e54 ("io_uring: wake SQPOLL task when task_work is added to an empty queue")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/1cbbe72cf32c45a8fee96026463024cd8564a7d7.1736541357.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index d3403c8216db..5eb119002099 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -1226,10 +1226,7 @@ static void io_req_normal_work_add(struct io_kiocb *req)
 
 	/* SQPOLL doesn't need the task_work added, it'll run it itself */
 	if (ctx->flags & IORING_SETUP_SQPOLL) {
-		struct io_sq_data *sqd = ctx->sq_data;
-
-		if (sqd->thread)
-			__set_notify_signal(sqd->thread);
+		__set_notify_signal(tctx->task);
 		return;
 	}
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: FAILED: patch "[PATCH] io_uring: don't touch sqd->thread off tw add" failed to apply to 6.12-stable tree
  2025-01-12  9:36 FAILED: patch "[PATCH] io_uring: don't touch sqd->thread off tw add" failed to apply to 6.12-stable tree gregkh
@ 2025-01-12  9:57 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2025-01-12  9:57 UTC (permalink / raw)
  To: asml.silence, axboe, lizetao1, minhquangbui99; +Cc: stable

On Sun, Jan 12, 2025 at 10:36:56AM +0100, gregkh@linuxfoundation.org wrote:
> 
> The patch below does not apply to the 6.12-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
> 
> To reproduce the conflict and resubmit, you may use the following commands:
> 
> git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
> git checkout FETCH_HEAD
> git cherry-pick -x bd2703b42decebdcddf76e277ba76b4c4a142d73
> # <resolve conflicts, build, test, etc.>
> git commit -s
> git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2025011256-extinct-expanse-d059@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^..
> 
> Possible dependencies:
> 
> 
> 
> thanks,
> 
> greg k-h
> 
> ------------------ original commit in Linus's tree ------------------
> 
> >From bd2703b42decebdcddf76e277ba76b4c4a142d73 Mon Sep 17 00:00:00 2001
> From: Pavel Begunkov <asml.silence@gmail.com>
> Date: Fri, 10 Jan 2025 20:36:45 +0000
> Subject: [PATCH] io_uring: don't touch sqd->thread off tw add
> 
> With IORING_SETUP_SQPOLL all requests are created by the SQPOLL task,
> which means that req->task should always match sqd->thread. Since
> accesses to sqd->thread should be separately protected, use req->task
> in io_req_normal_work_add() instead.
> 
> Note, in the eyes of io_req_normal_work_add(), the SQPOLL task struct
> is always pinned and alive, and sqd->thread can either be the task or
> NULL. It's only problematic if the compiler decides to reload the value
> after the null check, which is not so likely.
> 
> Cc: stable@vger.kernel.org
> Cc: Bui Quang Minh <minhquangbui99@gmail.com>
> Reported-by: lizetao <lizetao1@huawei.com>
> Fixes: 78f9b61bd8e54 ("io_uring: wake SQPOLL task when task_work is added to an empty queue")
> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
> Link: https://lore.kernel.org/r/1cbbe72cf32c45a8fee96026463024cd8564a7d7.1736541357.git.asml.silence@gmail.com
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> 
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
> index d3403c8216db..5eb119002099 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -1226,10 +1226,7 @@ static void io_req_normal_work_add(struct io_kiocb *req)
>  
>  	/* SQPOLL doesn't need the task_work added, it'll run it itself */
>  	if (ctx->flags & IORING_SETUP_SQPOLL) {
> -		struct io_sq_data *sqd = ctx->sq_data;
> -
> -		if (sqd->thread)
> -			__set_notify_signal(sqd->thread);
> +		__set_notify_signal(tctx->task);
>  		return;
>  	}

Note, this breaks the build, it applies just fine, it's just that ->task
is not a valid field here :(

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-12  9:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-12  9:36 FAILED: patch "[PATCH] io_uring: don't touch sqd->thread off tw add" failed to apply to 6.12-stable tree gregkh
2025-01-12  9:57 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox