From: Al Viro > Sent: 21 September 2020 16:11 > 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. Can't 32 bit processes on a 64bit system access all the way to 4GB? Mapping things by default above 3GB will probably break things. But there is no reason to disallow explicit maps. And in any case access_ok() can use the same limit as it does for 64bit processes - the page fault handler will sort it all out. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)