[PATCH] arm: use mmap_write_(un)lock for copy_to_user
chunkeey at gmail.com
Tue Sep 29 14:56:28 EDT 2020
On Tue, Sep 29, 2020 at 11:32 AM Russell King - ARM Linux admin
<linux at armlinux.org.uk> wrote:
> On Sat, Sep 26, 2020 at 09:28:54PM +0200, Christian Lamparter wrote:
> > changes ARM's copy_to_user to use mmap_*write*_lock
> > variants. This is because the data is written to
> > user-space and not read.
> The "read" lock is there to ensure that the page tables are not changed
> (e.g. due to a page fault in another thread) while we are making changes
> to the page. It is a "read" lock because we can tolerate other threads
> reading the page tables and mm structures, but not making changes to
> those structures.
> This has nothing to do with whether we are reading or writing userspace.
> Therefore, your patch is incorrect.
I was looking at ARM's copy_to_user, because a faulty out-of-tree RPI
patch that mixed read and write locks and this got me confused. Thanks
to your excellent explanation, I now know as well that this patch is incorrect.
More information about the linux-arm-kernel