Re: [PATCH 002/437] fs: add generic read/write iterator helpers

From: Al Viro
Date: Mon Apr 15 2024 - 17:08:46 EST


On Mon, Apr 15, 2024 at 02:11:56PM -0600, Jens Axboe wrote:

> do_loop_{readv,writev} need to look like the one io_uring had, which was
> just an augmented version of the fs/ version. At least for handling
> anything that is IOVEC/UBUF/BVEC.

IOVEC and UBUF: pointer will be __user one; copy_from_user() works.
KVEC: kernel pointer. Try copy_from_user() on that on x86 with SMAP (or
on e.g. sparc64, etc.) and you'll get an oops.
BVEC: page + offset, page quite possibly not mapped anywhere in kernel page
tables. And "just kmap() around the call of your callback" is not a good
idea either, for even more reason that for KVEC.