Re: Patch "io_uring/sqpoll: do not allow pinning outside of cpuset" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2024-10-01 at 09:57 +0200, gregkh@xxxxxxxxxxxxxxxxxxx wrote:
> 
> This is a note to let you know that I've just added the patch titled
> 
>     io_uring/sqpoll: do not allow pinning outside of cpuset
> 
> 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-sqpoll-do-not-allow-pinning-outside-of-cpuset.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 f011c9cf04c06f16b24f583d313d3c012e589e50 Mon Sep 17 00:00:00
> 2001
> From: Felix Moessbauer <felix.moessbauer@xxxxxxxxxxx>
> Date: Mon, 9 Sep 2024 17:00:36 +0200
> Subject: io_uring/sqpoll: do not allow pinning outside of cpuset
> 
> From: Felix Moessbauer <felix.moessbauer@xxxxxxxxxxx>
> 
> commit f011c9cf04c06f16b24f583d313d3c012e589e50 upstream.
> 
> The submit queue polling threads are userland threads that just never
> exit to the userland. When creating the thread with
> IORING_SETUP_SQ_AFF,
> the affinity of the poller thread is set to the cpu specified in
> sq_thread_cpu. However, this CPU can be outside of the cpuset defined
> by the cgroup cpuset controller. This violates the rules defined by
> the
> cpuset controller and is a potential issue for realtime applications.
> 
> In b7ed6d8ffd6 we fixed the default affinity of the poller thread, in
> case no explicit pinning is required by inheriting the one of the
> creating task. In case of explicit pinning, the check is more
> complicated, as also a cpu outside of the parent cpumask is allowed.
> We implemented this by using cpuset_cpus_allowed (that has support
> for
> cgroup cpusets) and testing if the requested cpu is in the set.
> 
> Fixes: 37d1e2e3642e ("io_uring: move SQPOLL thread io-wq forked
> worker")
> Cc: stable@xxxxxxxxxxxxxxx # 6.1+
> Signed-off-by: Felix Moessbauer <felix.moessbauer@xxxxxxxxxxx>
> Link:
> https://lore.kernel.org/r/20240909150036.55921-1-felix.moessbauer@xxxxxxxxxxx
> Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> ---
>  io_uring/sqpoll.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> --- a/io_uring/sqpoll.c
> +++ b/io_uring/sqpoll.c
> @@ -10,6 +10,7 @@
>  #include <linux/slab.h>
>  #include <linux/audit.h>
>  #include <linux/security.h>
> +#include <linux/cpuset.h>
>  #include <linux/io_uring.h>
>  
>  #include <uapi/linux/io_uring.h>
> @@ -401,10 +402,12 @@ __cold int io_sq_offload_create(struct i
>                         return 0;
>  
>                 if (p->flags & IORING_SETUP_SQ_AFF) {
> +                       struct cpumask allowed_mask;
>                         int cpu = p->sq_thread_cpu;
>  
>                         ret = -EINVAL;
> -                       if (cpu >= nr_cpu_ids || !cpu_online(cpu))

This patch contains a bug which is fixed in "io_uring/sqpoll: retain
test for whether the CPU is valid" (upstream
a09c17240bdf2e9fa6d0591afa9448b59785f7d4). I don't know why the fix was
not tagged stable.

Shall I send a09c17240 to stable with a cc stable tag, or do you want
to pick that directly for all stable kernels?

I'm really sorry for this mess.

Felix

> +                       cpuset_cpus_allowed(current, &allowed_mask);
> +                       if (!cpumask_test_cpu(cpu, &allowed_mask))
>                                 goto err_sqpoll;
>                         sqd->sq_cpu = cpu;
>                 } else {
> 
> 
> Patches currently in stable-queue which might be from
> felix.moessbauer@xxxxxxxxxxx are
> 
> queue-6.6/io_uring-io-wq-do-not-allow-pinning-outside-of-cpuse.patch
> queue-6.6/io_uring-sqpoll-do-not-allow-pinning-outside-of-
> cpuset.patch
> queue-6.6/io_uring-io-wq-inherit-cpuset-of-cgroup-in-io-worker.patch

-- 
Siemens AG, Technology
Linux Expert Center






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux