Re: [PATCH v3 RESEND] io_uring: add timeout support for io_uring_enter()

Jens Axboe
2020-11-04T18:32:57Z

On 11/4/20 10:50 AM, Jens Axboe wrote:
> +struct io_uring_getevents_arg {
> + sigset_t *sigmask;
> + struct __kernel_timespec *ts;
> +};
> +

I missed that this is still not right, I did bring it up in your last
posting though - you can't have pointers as a user API, since the size
of the pointer will vary depending on whether this is a 32-bit or 64-bit
arch (or 32-bit app running on 64-bit kernel).

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 7e6945383907..2f533f6815ea 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -9158,8 +9158,8 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
return -EINVAL;
if (copy_from_user(&arg, argp, sizeof(arg)))
return -EFAULT;
- sig = arg.sigmask;
- ts = arg.ts;
+ sig = u64_to_user_ptr(arg.sigmask);
+ ts = u64_to_user_ptr(arg.ts);
} else {
sig = (const sigset_t __user *)argp;
ts = NULL;
diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
index fefee28c3ed8..0b104891df68 100644
--- a/include/uapi/linux/io_uring.h
+++ b/include/uapi/linux/io_uring.h
@@ -338,8 +338,8 @@ enum {
};

struct io_uring_getevents_arg {
- sigset_t *sigmask;
- struct __kernel_timespec *ts;
+ __u64 sigmask;
+ __u64 ts;
};

#endif

--
Jens Axboe