]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
arm64: lib: Use MOPS for usercopy routines
authorKristina Martšenko <kristina.martsenko@arm.com>
Fri, 28 Feb 2025 17:00:06 +0000 (17:00 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 7 Mar 2025 18:30:16 +0000 (18:30 +0000)
commitfe59e0358d9b032a09d903350d5fef73601166f2
tree3841fe01cb8201dfec1b8d43826aa5a05231e4a1
parent04a9f771d81c109b3927d224a797dc21e2774a5e
arm64: lib: Use MOPS for usercopy routines

Similarly to what was done with the memcpy() routines, make
copy_to_user(), copy_from_user() and clear_user() also use the Armv8.8
FEAT_MOPS instructions.

Both MOPS implementation options (A and B) are supported, including
asymmetric systems. The exception fixup code fixes up the registers
according to the option used.

In case of a fault the routines return precisely how much was not copied
(as required by the comment in include/linux/uaccess.h), as unprivileged
versions of CPY/SET are guaranteed not to have written past the
addresses reported in the GPRs.

The MOPS instructions could possibly be inlined into callers (and
patched to branch to the generic implementation if not detected;
similarly to what x86 does), but as a first step this patch just uses
them in the out-of-line routines.

Signed-off-by: Kristina Martšenko <kristina.martsenko@arm.com>
Acked-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/20250228170006.390100-4-kristina.martsenko@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/asm-uaccess.h
arch/arm64/lib/clear_user.S
arch/arm64/lib/copy_from_user.S
arch/arm64/lib/copy_template.S
arch/arm64/lib/copy_to_user.S