[PATCHv4 12/17] arm64: uaccess: split user/kernel routines

Mark Rutland mark.rutland at arm.com
Tue Dec 1 06:03:23 EST 2020


On Thu, Nov 26, 2020 at 06:42:24PM +0000, James Morse wrote:
> Hi Mark,

Hi James,

Thanks for the comments. I've applied most of those below, but I have
one follow-up question.

> On 13/11/2020 12:49, Mark Rutland wrote:
> > +#define __get_mem_asm(ldr, reg, x, addr, err)				\
> 
> ('ldr' as variable name where you need to output something other than ldr does my head in)
>
> >  	asm volatile(							\
> > -	"1:"ALTERNATIVE(instr "     " reg "1, [%2]\n",			\
> > -			alt_instr " " reg "1, [%2]\n", feature)		\
> > +	"1:	" ldr "	" reg "1, [%2]\n"				\

I've changed this to 'load', and used 'store' in __put_mem_asm().

[...]

> > +#define __get_kernel_nofault(dst, src, type, err_label)			\
> > +do {									\
> > +	int __gkn_err = 0;						\
> > +									\
> > +	__raw_get_mem("ldr", *((type *)(dst)),				\
> > +		      (__force type __user *)(src), __gkn_err);		\
> 
> Is the __user needed as you moved __chk_user_ptr() out of __raw_get_mem() in the previous
> patch?

You're right; the __user portion can go as neither __raw_get_mem() or
__get_mem_asm() needs that. Likewise for __put_kernel_nofault(),
__raw_put_mem(), and __put_mem_asm().

I've removed those.

> (your branch on kernel.org does something different here, not sure if its ahead or behind v4)

AFAICT this portion of the patch is up-to-date with what's on
kernel.org. I might have pushed that out-of-order with posting the
series -- does this look the same now, or am I missing something?

> > +	if (unlikely(__gkn_err))					\
> > +		goto err_label;						\
> > +} while(0)

I'll fix the whitespace for the while(0), too...

Thanks,
Mark.



More information about the linux-arm-kernel mailing list