Re: [PATCH 2/9] mm: arm ready for split ptlock

From: Russell King
Date: Mon Oct 31 2005 - 17:50:15 EST


On Mon, Oct 31, 2005 at 11:34:39PM +0100, Jesper Juhl wrote:
> On 10/31/05, Russell King <rmk+lkml@xxxxxxxxxxxxxxxx> wrote:
> > On Mon, Oct 31, 2005 at 11:19:21PM +0100, Jesper Juhl wrote:
> > > Yes, I removed verify_area() since it was just a wrapper for access_ok().
> > > If verify_area() was/is needed, then access_ok() should be just fine
> > > as a replacement as far as I can see.
> >
> > Except verify_area() would pre-fault the pages in whereas access_ok()
> > just verifies that the address is a user page. That's quite important
> > in this case because in order to fault the page in, we need to use
> > put_user() to get the permission checking correct.
> >
> > However, we can't use put_user() because then the cmpxchg emulation
> > becomes completely non-atomic.
> >
> Colour me stupid, but I don't see how that can be.
>
> Looking at verify_area() from 2.6.13 - the arm version (
> http://sosdg.org/~coywolf/lxr/source/include/asm-arm/uaccess.h?v=2.6.13#L81
> ) :
>
> static inline int __deprecated verify_area(int type, const void __user
> *addr, unsigned long size)
> {
> return access_ok(type, addr, size) ? 0 : -EFAULT;
> }
>
> How will this cause pre-faulting if a call to access_ok() will not?
> Please enlighten me.

This is true because we haven't had this requirement up until the
introduction of this. I am referring to some functionality which
was present a while back in the kernel - the old version of
verify_area which, when passed a VERIFY_WRITE argument, would
prefault the pages... as required for some i386 CPUs.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/