[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220406115533.GA5165@asgard.redhat.com>
Date: Wed, 6 Apr 2022 13:55:33 +0200
From: Eugene Syromiatnikov <esyr@...hat.com>
To: Jens Axboe <axboe@...nel.dk>,
Pavel Begunkov <asml.silence@...il.com>
Cc: io-uring@...r.kernel.org, linux-kernel@...r.kernel.org,
Artem Savkov <asavkov@...hat.com>
Subject: [PATCH] io_uring: implement compat handling for
IORING_REGISTER_IOWQ_AFF
Similarly to the way it is done im mbind syscall.
Cc: stable@...r.kernel.org # 5.14
Fixes: fe76421d1da1dcdb ("io_uring: allow user configurable IO thread CPU affinity")
Signed-off-by: Eugene Syromiatnikov <esyr@...hat.com>
---
fs/io_uring.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index de9c9de..83e194f 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -10803,7 +10803,15 @@ static __cold int io_register_iowq_aff(struct io_ring_ctx *ctx,
if (len > cpumask_size())
len = cpumask_size();
- if (copy_from_user(new_mask, arg, len)) {
+ if (in_compat_syscall()) {
+ ret = compat_get_bitmap(cpumask_bits(new_mask),
+ (const compat_ulong_t __user *)arg,
+ len * 8 /* CHAR_BIT */);
+ } else {
+ ret = copy_from_user(new_mask, arg, len);
+ }
+
+ if (ret) {
free_cpumask_var(new_mask);
return -EFAULT;
}
--
2.1.4
Powered by blists - more mailing lists