This is a note to let you know that I've just added the patch titled io_uring: Fix io_cqring_wait() not restoring sigmask on get_timespec64() failure to the 6.6-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: io_uring-fix-io_cqring_wait-not-restoring-sigmask-on-get_timespec64-failure.patch and it can be found in the queue-6.6 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From dbe77812190e4acd1e6db19e21e29ec6dfd3efed Mon Sep 17 00:00:00 2001 From: Alexey Izbyshev <izbyshev@xxxxxxxxx> Date: Fri, 5 Apr 2024 15:55:51 +0300 Subject: io_uring: Fix io_cqring_wait() not restoring sigmask on get_timespec64() failure From: Alexey Izbyshev <izbyshev@xxxxxxxxx> Commit 978e5c19dfefc271e5550efba92fcef0d3f62864 upstream. This bug was introduced in commit 950e79dd7313 ("io_uring: minor io_cqring_wait() optimization"), which was made in preparation for adc8682ec690 ("io_uring: Add support for napi_busy_poll"). The latter got reverted in cb3182167325 ("Revert "io_uring: Add support for napi_busy_poll""), so simply undo the former as well. Cc: stable@xxxxxxxxxxxxxxx Fixes: 950e79dd7313 ("io_uring: minor io_cqring_wait() optimization") Signed-off-by: Alexey Izbyshev <izbyshev@xxxxxxxxx> Link: https://lore.kernel.org/r/20240405125551.237142-1-izbyshev@xxxxxxxxx Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- io_uring/io_uring.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -2559,19 +2559,6 @@ static int io_cqring_wait(struct io_ring if (__io_cqring_events_user(ctx) >= min_events) return 0; - if (sig) { -#ifdef CONFIG_COMPAT - if (in_compat_syscall()) - ret = set_compat_user_sigmask((const compat_sigset_t __user *)sig, - sigsz); - else -#endif - ret = set_user_sigmask(sig, sigsz); - - if (ret) - return ret; - } - init_waitqueue_func_entry(&iowq.wq, io_wake_function); iowq.wq.private = current; INIT_LIST_HEAD(&iowq.wq.entry); @@ -2588,6 +2575,19 @@ static int io_cqring_wait(struct io_ring iowq.timeout = ktime_add_ns(timespec64_to_ktime(ts), ktime_get_ns()); } + if (sig) { +#ifdef CONFIG_COMPAT + if (in_compat_syscall()) + ret = set_compat_user_sigmask((const compat_sigset_t __user *)sig, + sigsz); + else +#endif + ret = set_user_sigmask(sig, sigsz); + + if (ret) + return ret; + } + trace_io_uring_cqring_wait(ctx, min_events); do { int nr_wait = (int) iowq.cq_tail - READ_ONCE(ctx->rings->cq.tail); Patches currently in stable-queue which might be from izbyshev@xxxxxxxxx are queue-6.6/io_uring-fix-io_cqring_wait-not-restoring-sigmask-on-get_timespec64-failure.patch