Re: [PATCH 3/8] asm-generic: fix unaligned access hamdling in raw_copy_{from,to}_user

From: Al Viro
Date: Sat Sep 05 2020 - 10:42:23 EST


On Fri, Sep 04, 2020 at 11:35:18PM +0100, Al Viro wrote:

> Now, if you look at raw_copy_from_user() you'll see an interesting
> picture: some architectures special-case the handling of small constant sizes.
> Namely,
> arc (any size; inlining in there is obscene, constant size or not),
> c6x (1,4,8),
> m68k/MMU (1,2,3,4,5,6,7,8,9,10,12)
> ppc (1,2,4,8),
> h8300 (1,2,4),
> riscv (with your series)(1,2,4, 8 if 64bit).

FWIW, on the raw_copy_to_user() side the same set of constant sizes is
recongized by the same architectures and we have
* __put_user/put_user in asm-generic/uaccess.h make use of that
* arc, c6x, ppc and riscv using it to store sigset_t on sigframe
* 3 odd callers:
* arc stash_usr_regs(), inlined and unrolled large copy_to_user()
* ppc kvm_htab_read(), 64bit store.
* i915_gem_execbuffer_ioctl():
if (__copy_to_user(&user_exec_list[i].offset,
&exec2_list[i].offset,
sizeof(user_exec_list[i].offset)))
in a loop. 'offset' here is __u64.

That's it. IOW, asm-generic put_user() is the only real cause to have those
magic sizes recognized on raw_copy_to_user() side.