diff options
author | Peter Zijlstra <peterz@infradead.org> | 2021-11-10 11:01:22 +0100 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2021-12-11 09:09:50 +0100 |
commit | d5d797dcbd781cb7c526ad32f31c7fd96babfdb2 (patch) | |
tree | dd64239b122e8ab932f750b121d88bdacbff9120 /arch/x86/lib/usercopy_64.c | |
parent | x86/usercopy_32: Simplify __copy_user_intel_nocache() (diff) | |
download | linux-d5d797dcbd781cb7c526ad32f31c7fd96babfdb2.tar.xz linux-d5d797dcbd781cb7c526ad32f31c7fd96babfdb2.zip |
x86/usercopy: Remove .fixup usage
Typically usercopy does whole word copies followed by a number of byte
copies to finish the tail. This means that on exception it needs to
compute the remaining length as: words*sizeof(long) + bytes.
Create a new extable handler to do just this.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/20211110101326.081701085@infradead.org
Diffstat (limited to 'arch/x86/lib/usercopy_64.c')
-rw-r--r-- | arch/x86/lib/usercopy_64.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c index 508c81e97ab1..0402a749f3a0 100644 --- a/arch/x86/lib/usercopy_64.c +++ b/arch/x86/lib/usercopy_64.c @@ -35,12 +35,10 @@ unsigned long __clear_user(void __user *addr, unsigned long size) " incq %[dst]\n" " decl %%ecx ; jnz 1b\n" "2:\n" - ".section .fixup,\"ax\"\n" - "3: lea 0(%[size1],%[size8],8),%[size8]\n" - " jmp 2b\n" - ".previous\n" - _ASM_EXTABLE_UA(0b, 3b) + + _ASM_EXTABLE_TYPE_REG(0b, 2b, EX_TYPE_UCOPY_LEN8, %[size1]) _ASM_EXTABLE_UA(1b, 2b) + : [size8] "=&c"(size), [dst] "=&D" (__d0) : [size1] "r"(size & 7), "[size8]" (size / 8), "[dst]"(addr)); clac(); |