public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring: Fix io_cqring_wait() not restoring sigmask on get_timespec64() failure
@ 2024-04-05 12:55 Alexey Izbyshev
  2024-04-06  2:06 ` Jens Axboe
  2024-04-06  2:06 ` Jens Axboe
  0 siblings, 2 replies; 5+ messages in thread
From: Alexey Izbyshev @ 2024-04-05 12:55 UTC (permalink / raw)
  To: Jens Axboe, Pavel Begunkov, Olivier Langlois; +Cc: io-uring, linux-kernel

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.

Fixes: 950e79dd7313 ("io_uring: minor io_cqring_wait() optimization")
Signed-off-by: Alexey Izbyshev <[email protected]>
---
 io_uring/io_uring.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index cd9a137ad6ce..b764a18f3a49 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -2595,19 +2595,6 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
 	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);
@@ -2624,6 +2611,19 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
 		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 {
 		unsigned long check_cq;
-- 
2.44.0


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

* Re: [PATCH] io_uring: Fix io_cqring_wait() not restoring sigmask on get_timespec64() failure
  2024-04-05 12:55 [PATCH] io_uring: Fix io_cqring_wait() not restoring sigmask on get_timespec64() failure Alexey Izbyshev
@ 2024-04-06  2:06 ` Jens Axboe
  2024-04-06 11:12   ` Alexey Izbyshev
  2024-04-06  2:06 ` Jens Axboe
  1 sibling, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2024-04-06  2:06 UTC (permalink / raw)
  To: Alexey Izbyshev, Pavel Begunkov, Olivier Langlois; +Cc: io-uring, linux-kernel

On 4/5/24 6:55 AM, Alexey Izbyshev wrote:
> 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.

Thanks - ironically I had to hand apply this one, as some of the
commits you mention above are not in the base you used for the
patch...

-- 
Jens Axboe



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

* Re: [PATCH] io_uring: Fix io_cqring_wait() not restoring sigmask on get_timespec64() failure
  2024-04-05 12:55 [PATCH] io_uring: Fix io_cqring_wait() not restoring sigmask on get_timespec64() failure Alexey Izbyshev
  2024-04-06  2:06 ` Jens Axboe
@ 2024-04-06  2:06 ` Jens Axboe
  1 sibling, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2024-04-06  2:06 UTC (permalink / raw)
  To: Pavel Begunkov, Olivier Langlois, Alexey Izbyshev; +Cc: io-uring, linux-kernel


On Fri, 05 Apr 2024 15:55:51 +0300, Alexey Izbyshev wrote:
> 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.
> 
> 
> [...]

Applied, thanks!

[1/1] io_uring: Fix io_cqring_wait() not restoring sigmask on get_timespec64() failure
      commit: 978e5c19dfefc271e5550efba92fcef0d3f62864

Best regards,
-- 
Jens Axboe




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

* Re: [PATCH] io_uring: Fix io_cqring_wait() not restoring sigmask on get_timespec64() failure
  2024-04-06  2:06 ` Jens Axboe
@ 2024-04-06 11:12   ` Alexey Izbyshev
  2024-04-06 12:57     ` Jens Axboe
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Izbyshev @ 2024-04-06 11:12 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Pavel Begunkov, Olivier Langlois, io-uring, linux-kernel

On 2024-04-06 05:06, Jens Axboe wrote:
> On 4/5/24 6:55 AM, Alexey Izbyshev wrote:
>> 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.
> 
> Thanks - ironically I had to hand apply this one, as some of the
> commits you mention above are not in the base you used for the
> patch...

I used v6.8 as the base, and all three commits mentioned above are 
there. However, the patch indeed doesn't apply to the current tip 
because of post-v6.8 changes, sorry for that!

Thanks,
Alexey

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

* Re: [PATCH] io_uring: Fix io_cqring_wait() not restoring sigmask on get_timespec64() failure
  2024-04-06 11:12   ` Alexey Izbyshev
@ 2024-04-06 12:57     ` Jens Axboe
  0 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2024-04-06 12:57 UTC (permalink / raw)
  To: Alexey Izbyshev; +Cc: Pavel Begunkov, Olivier Langlois, io-uring, linux-kernel

On 4/6/24 5:12 AM, Alexey Izbyshev wrote:
> On 2024-04-06 05:06, Jens Axboe wrote:
>> On 4/5/24 6:55 AM, Alexey Izbyshev wrote:
>>> 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.
>>
>> Thanks - ironically I had to hand apply this one, as some of the
>> commits you mention above are not in the base you used for the
>> patch...
> 
> I used v6.8 as the base, and all three commits mentioned above are
> there. However, the patch indeed doesn't apply to the current tip
> because of post-v6.8 changes, sorry for that!

Not a problem, but it does highlight that this will certainly throw a
reject once stable tries to pick it up. Just something to keep an eye
on.

-- 
Jens Axboe


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

end of thread, other threads:[~2024-04-06 12:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-05 12:55 [PATCH] io_uring: Fix io_cqring_wait() not restoring sigmask on get_timespec64() failure Alexey Izbyshev
2024-04-06  2:06 ` Jens Axboe
2024-04-06 11:12   ` Alexey Izbyshev
2024-04-06 12:57     ` Jens Axboe
2024-04-06  2:06 ` Jens Axboe

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