Separate __put_user_*() from __put_user_nocheck_*() to make the layout
similar to getuser.S. This will also make it easier to do a subsequent
change. No functional changes.
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
arch/x86/lib/putuser.S | 67 ++++++++++++++++++++++--------------------
1 file changed, 35 insertions(+), 32 deletions(-)
diff --git a/arch/x86/lib/putuser.S b/arch/x86/lib/putuser.S
index 09b7e37934ab..cb137e0286be 100644
--- a/arch/x86/lib/putuser.S
+++ b/arch/x86/lib/putuser.S
@@ -54,59 +54,32 @@ SYM_FUNC_START(__put_user_1)
SYM_FUNC_END(__put_user_1)
EXPORT_SYMBOL(__put_user_1)
-SYM_FUNC_START(__put_user_nocheck_1)
- ASM_STAC
-2: movb %al,(%_ASM_CX)
- xor %ecx,%ecx
- ASM_CLAC
- RET
-SYM_FUNC_END(__put_user_nocheck_1)
-EXPORT_SYMBOL(__put_user_nocheck_1)
-
SYM_FUNC_START(__put_user_2)
check_range size=2
ASM_STAC
-3: movw %ax,(%_ASM_CX)
+2: movw %ax,(%_ASM_CX)
xor %ecx,%ecx
ASM_CLAC
RET
SYM_FUNC_END(__put_user_2)
EXPORT_SYMBOL(__put_user_2)
-SYM_FUNC_START(__put_user_nocheck_2)
- ASM_STAC
-4: movw %ax,(%_ASM_CX)
- xor %ecx,%ecx
- ASM_CLAC
- RET
-SYM_FUNC_END(__put_user_nocheck_2)
-EXPORT_SYMBOL(__put_user_nocheck_2)
-
SYM_FUNC_START(__put_user_4)
check_range size=4
ASM_STAC
-5: movl %eax,(%_ASM_CX)
+3: movl %eax,(%_ASM_CX)
xor %ecx,%ecx
ASM_CLAC
RET
SYM_FUNC_END(__put_user_4)
EXPORT_SYMBOL(__put_user_4)
-SYM_FUNC_START(__put_user_nocheck_4)
- ASM_STAC
-6: movl %eax,(%_ASM_CX)
- xor %ecx,%ecx
- ASM_CLAC
- RET
-SYM_FUNC_END(__put_user_nocheck_4)
-EXPORT_SYMBOL(__put_user_nocheck_4)
-
SYM_FUNC_START(__put_user_8)
check_range size=8
ASM_STAC
-7: mov %_ASM_AX,(%_ASM_CX)
+4: mov %_ASM_AX,(%_ASM_CX)
#ifdef CONFIG_X86_32
-8: movl %edx,4(%_ASM_CX)
+5: movl %edx,4(%_ASM_CX)
#endif
xor %ecx,%ecx
ASM_CLAC
@@ -114,6 +87,34 @@ SYM_FUNC_START(__put_user_8)
SYM_FUNC_END(__put_user_8)
EXPORT_SYMBOL(__put_user_8)
+/* .. and the same for __put_user, just without the range checks */
+SYM_FUNC_START(__put_user_nocheck_1)
+ ASM_STAC
+6: movb %al,(%_ASM_CX)
+ xor %ecx,%ecx
+ ASM_CLAC
+ RET
+SYM_FUNC_END(__put_user_nocheck_1)
+EXPORT_SYMBOL(__put_user_nocheck_1)
+
+SYM_FUNC_START(__put_user_nocheck_2)
+ ASM_STAC
+7: movw %ax,(%_ASM_CX)
+ xor %ecx,%ecx
+ ASM_CLAC
+ RET
+SYM_FUNC_END(__put_user_nocheck_2)
+EXPORT_SYMBOL(__put_user_nocheck_2)
+
+SYM_FUNC_START(__put_user_nocheck_4)
+ ASM_STAC
+8: movl %eax,(%_ASM_CX)
+ xor %ecx,%ecx
+ ASM_CLAC
+ RET
+SYM_FUNC_END(__put_user_nocheck_4)
+EXPORT_SYMBOL(__put_user_nocheck_4)
+
SYM_FUNC_START(__put_user_nocheck_8)
ASM_STAC
9: mov %_ASM_AX,(%_ASM_CX)
@@ -137,11 +138,13 @@ SYM_CODE_END(__put_user_handle_exception)
_ASM_EXTABLE_UA(2b, __put_user_handle_exception)
_ASM_EXTABLE_UA(3b, __put_user_handle_exception)
_ASM_EXTABLE_UA(4b, __put_user_handle_exception)
+#ifdef CONFIG_X86_32
_ASM_EXTABLE_UA(5b, __put_user_handle_exception)
+#endif
_ASM_EXTABLE_UA(6b, __put_user_handle_exception)
_ASM_EXTABLE_UA(7b, __put_user_handle_exception)
+ _ASM_EXTABLE_UA(8b, __put_user_handle_exception)
_ASM_EXTABLE_UA(9b, __put_user_handle_exception)
#ifdef CONFIG_X86_32
- _ASM_EXTABLE_UA(8b, __put_user_handle_exception)
_ASM_EXTABLE_UA(10b, __put_user_handle_exception)
#endif
--
2.47.0
On Thu, Oct 17, 2024 at 02:55:22PM -0700, Josh Poimboeuf wrote: > SYM_FUNC_START(__put_user_2) > check_range size=2 > ASM_STAC > -3: movw %ax,(%_ASM_CX) > +2: movw %ax,(%_ASM_CX) > xor %ecx,%ecx > ASM_CLAC > RET > SYM_FUNC_END(__put_user_2) > EXPORT_SYMBOL(__put_user_2) This patch provides an opportunity to give these labels more meaningful names, so that future rearrangements do not require as much boilerplate. For example, we can rename this label 2: to .Luser_2 or something similar. -- Kiryl Shutsemau / Kirill A. Shutemov
On Fri, Oct 18, 2024 at 11:51:06AM +0300, Kirill A . Shutemov wrote: > On Thu, Oct 17, 2024 at 02:55:22PM -0700, Josh Poimboeuf wrote: > > SYM_FUNC_START(__put_user_2) > > check_range size=2 > > ASM_STAC > > -3: movw %ax,(%_ASM_CX) > > +2: movw %ax,(%_ASM_CX) > > xor %ecx,%ecx > > ASM_CLAC > > RET > > SYM_FUNC_END(__put_user_2) > > EXPORT_SYMBOL(__put_user_2) > > This patch provides an opportunity to give these labels more meaningful > names, so that future rearrangements do not require as much boilerplate. Yeah, I can add a patch like Linus' patch to getuser.S which encapsulates it all in a macro: .macro UACCESS op src dst 1: \op \src,\dst _ASM_EXTABLE_UA(1b, __get_user_handle_exception) .endm .text SYM_FUNC_START(__get_user_1) check_range size=1 ASM_STAC UACCESS movzbl (%_ASM_AX),%edx xor %eax,%eax ASM_CLAC RET SYM_FUNC_END(__get_user_1) EXPORT_SYMBOL(__get_user_1) -- Josh
© 2016 - 2024 Red Hat, Inc.