[PATCHv3 10/17] arm64: uaccess: simplify __copy_user_flushcache()

Mark Rutland mark.rutland at arm.com
Mon Nov 2 05:14:15 EST 2020


On Tue, Oct 27, 2020 at 05:33:31PM +0000, Robin Murphy wrote:
> On 2020-10-26 13:31, Mark Rutland wrote:
> > Currently __copy_user_flushcache() open-codes raw_copy_from_user(), and
> > doesn't use uaccess_mask_ptr() on the user address. Let's have it call
> > raw_copy_from_user(), which is both a simplification and ensures that
> > user pointers are masked under speculation.
> 
> I think this originally stems from the fact that "raw_*" were merely generic
> aliases for "__arch_*" at the time. Then whichever chump subsequently
> implemented uaccess_mask_ptr() for arm64 clearly did a terrible job... ;)

:)

> > There should be no functional change as a result of this patch.
> 
> Reviewed-by: Robin Murphy <robin.murphy at arm.com>

Thanks!

Mark.

> 
> > Signed-off-by: Mark Rutland <mark.rutland at arm.com>
> > Cc: Catalin Marinas <catalin.marinas at arm.com>
> > Cc: Christoph Hellwig <hch at lst.de>
> > Cc: Robin Murphy <robin.murphy at arm.com>
> > Cc: Will Deacon <will at kernel.org>
> > ---
> >   arch/arm64/lib/uaccess_flushcache.c | 4 +---
> >   1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/arch/arm64/lib/uaccess_flushcache.c b/arch/arm64/lib/uaccess_flushcache.c
> > index bfa30b75b2b8e..c83bb5a4aad2c 100644
> > --- a/arch/arm64/lib/uaccess_flushcache.c
> > +++ b/arch/arm64/lib/uaccess_flushcache.c
> > @@ -30,9 +30,7 @@ unsigned long __copy_user_flushcache(void *to, const void __user *from,
> >   {
> >   	unsigned long rc;
> > -	uaccess_enable_not_uao();
> > -	rc = __arch_copy_from_user(to, from, n);
> > -	uaccess_disable_not_uao();
> > +	rc = raw_copy_from_user(to, from, n);
> >   	/* See above */
> >   	__clean_dcache_area_pop(to, n - rc);
> > 



More information about the linux-arm-kernel mailing list