summaryrefslogtreecommitdiff
path: root/include/linux/timerqueue.h
diff options
context:
space:
mode:
authorAndrea Parri <parri.andrea@gmail.com>2026-10-26 19:06:18 +0100
committerChristian Brauner <brauner@kernel.org>2026-11-05 18:21:57 +0100
commit965e5e451146a19f69523fbcbc73d07e401a3775 (patch)
treed6ce9f2fce1045b05bbe44a8bd8f668a64bc57bf /include/linux/timerqueue.h
parent1d91141f6722822c8ba6a1c7dda791b006eb129d (diff)
iov_iter: take an unsigned long segment count in import_iovec()
readv(), writev() and their positional variants, process_vm_readv(), process_vm_writev(), vmsplice(), process_madvise(), vectored aio and the btrfs encoded I/O ioctls all take a full-width segment count, and all of them hand it to import_iovec() or __import_iovec(). Those take an unsigned int count, so on 64-bit kernels the upper 32 bits are dropped before iovec_from_user() checks the count against UIO_MAXIOV. A count of 0x100000001 is therefore imported as one segment: writev() on a pipe writes a byte and readv() reads it back, instead of both failing with EINVAL. A count of 0x100000000 returns 0 as an empty vector. import_iovec() was added with an unsigned int count, but the helper it wrapped, rw_copy_check_uvector(), took an unsigned long, as does iovec_from_user() today. Until v4.1, readv(), writev(), preadv(), pwritev(), process_vm_readv(), process_vm_writev() and vectored aio therefore failed these counts with EINVAL, as did vmsplice() until v4.18. Widen nr_segs in both import helpers so the UIO_MAXIOV check sees the count the caller passed. Callers with 32-bit counts are unaffected. AI assistance was used to find the bug, develop the fix, and run the reproducers. Fixes: bc917be81059 ("saner iov_iter initialization primitives") Signed-off-by: Andrea Parri <parri.andrea@gmail.com> Link: https://patch.msgid.link/20261026180619.4147910-1-parri.andrea@gmail.com Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'include/linux/timerqueue.h')
0 files changed, 0 insertions, 0 deletions