Skip to contentSkip to conversation

io_uring: implement compat handling for IORING_REGISTER_IOWQ_AFF

PATCH Applied Eugene Syromiatnikov 2 participants 2 messages Apr 6, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring: implement compat handling for IORING_REGISTER_IOWQ_AFF

Similarly to the way it is done im mbind syscall.

Fixes fe76421d1da1dcdb ("io_uring: allow user configurable IO thread CPU affinity")
---
 fs/io_uring.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
fs/io_uring.c +9 -1
index de9c9de..83e194f 100644
@@ -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;
 	}
Signature · 1 line
2.1.4
maintainer Applied
#1 lore raw
Quoted 1 line · Eugene Syromiatnikov

Similarly to the way it is done im mbind syscall.

Thanks, applied.

Signature · 1 line
Jens Axboe