Re: [PATCH 04/11] iov_iter: explicitly check for CHECK_IOVEC_ONLY in rw_copy_check_uvector
From: Al Viro
Date: Mon Sep 21 2020 - 11:11:30 EST
On Mon, Sep 21, 2020 at 03:05:32PM +0000, David Laight wrote:
> I've actually no idea:
> 1) Why there is an access_ok() check here.
> It will be repeated by the user copy functions.
Early sanity check.
> 2) Why it isn't done when called from mm/process_vm_access.c.
> Ok, the addresses refer to a different process, but they
> must still be valid user addresses.
> Is 2 a legacy from when access_ok() actually checked that the
> addresses were mapped into the process's address space?
It never did. 2 is for the situation when a 32bit process
accesses 64bit one; addresses that are perfectly legitimate
for 64bit userland (and fitting into the first 4Gb of address
space, so they can be represented by 32bit pointers just fine)
might be rejected by access_ok() if the caller is 32bit.