Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring: use __kernel_timespec in timeout ABI

All system calls use struct __kernel_timespec instead of the old struct
timespec, but this one was just added with the old-style ABI. Change it
now to enforce the use of __kernel_timespec, avoiding ABI confusion and
the need for compat handlers on 32-bit architectures.

Any user space caller will have to use __kernel_timespec now, but this
is unambiguous and works for any C library regardless of the time_t
definition. A nicer way to specify the timeout would have been a less
ambiguous 64-bit nanosecond value, but I suppose it's too late now to
change that as this would impact both 32-bit and 64-bit users.

Fixes: 5262f567987d ("io_uring: IORING_OP_TIMEOUT support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Arnd Bergmann and committed by
Jens Axboe
bdf20073 85560117

+4 -4
+4 -4
fs/io_uring.c
··· 1892 1892 unsigned count, req_dist, tail_index; 1893 1893 struct io_ring_ctx *ctx = req->ctx; 1894 1894 struct list_head *entry; 1895 - struct timespec ts; 1895 + struct timespec64 ts; 1896 1896 1897 1897 if (unlikely(ctx->flags & IORING_SETUP_IOPOLL)) 1898 1898 return -EINVAL; 1899 1899 if (sqe->flags || sqe->ioprio || sqe->buf_index || sqe->timeout_flags || 1900 1900 sqe->len != 1) 1901 1901 return -EINVAL; 1902 - if (copy_from_user(&ts, (void __user *) (unsigned long) sqe->addr, 1903 - sizeof(ts))) 1902 + 1903 + if (get_timespec64(&ts, u64_to_user_ptr(sqe->addr))) 1904 1904 return -EFAULT; 1905 1905 1906 1906 /* ··· 1934 1934 1935 1935 hrtimer_init(&req->timeout.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 1936 1936 req->timeout.timer.function = io_timeout_fn; 1937 - hrtimer_start(&req->timeout.timer, timespec_to_ktime(ts), 1937 + hrtimer_start(&req->timeout.timer, timespec64_to_ktime(ts), 1938 1938 HRTIMER_MODE_REL); 1939 1939 return 0; 1940 1940 }