Skip to contentSkip to conversation

x86/lib: Do not use local symbols with SYM_CODE_START_LOCAL()

PATCH Superseded Nadav Amit 1 participant 2 messages Nov 22, 2022 – Jan 5, 2023 x86

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Nadav Amit

author
#0 lore raw

PATCH 1/1 x86/lib: Do not use local symbols with SYM_CODE_START_LOCAL()

From: Nadav Amit <[email protected]>

When SYM_CODE_START_LOCAL() is used, the symbols are local but should be saved to the object. In contrast, using ".L" label prefix causes the symbols not to be saved in the object.

Since it is preferable to be able to map instruction pointers back to symbols, the local symbol should be saved in the object. Therefore, when SYM_CODE_START_LOCAL() is used, the ".L" label prefix should not be used.

Two symbols, however, have both SYM_CODE_START_LOCAL() and ".L" prefix:
.Lbad_put_user_clac and .Lcopy_user_handle_tail. Remove the ".L" prefix from them.

No functional change, other then emitting these symbols into the object, is intended.

---
 arch/x86/lib/copy_user_64.S | 16 ++++++++--------
 arch/x86/lib/putuser.S      | 24 ++++++++++++------------
 2 files changed, 20 insertions(+), 20 deletions(-)
arch/x86/lib/copy_user_64.S +8 -8
index 9dec1b38a98f..92b4c17c95cd 100644
@@ -83,7 +83,7 @@ SYM_FUNC_START(copy_user_generic_unrolled)
 
 30:	shll $6,%ecx
 	addl %ecx,%edx
-	jmp .Lcopy_user_handle_tail
+	jmp copy_user_handle_tail
 
 	_ASM_EXTABLE_CPY(1b, 30b)
 	_ASM_EXTABLE_CPY(2b, 30b)
@@ -139,7 +139,7 @@ SYM_FUNC_START(copy_user_generic_string)
 
 11:	leal (%rdx,%rcx,8),%ecx
 12:	movl %ecx,%edx		/* ecx is zerorest also */
-	jmp .Lcopy_user_handle_tail
+	jmp copy_user_handle_tail
 
 	_ASM_EXTABLE_CPY(1b, 11b)
 	_ASM_EXTABLE_CPY(3b, 12b)
@@ -169,7 +169,7 @@ SYM_FUNC_START(copy_user_enhanced_fast_string)
 	RET
 
 12:	movl %ecx,%edx		/* ecx is zerorest also */
-	jmp .Lcopy_user_handle_tail
+	jmp copy_user_handle_tail
 
 	_ASM_EXTABLE_CPY(1b, 12b)
 SYM_FUNC_END(copy_user_enhanced_fast_string)
@@ -190,7 +190,7 @@ EXPORT_SYMBOL(copy_user_enhanced_fast_string)
  * Output:
  * eax uncopied bytes or 0 if successful.
  */
-SYM_CODE_START_LOCAL(.Lcopy_user_handle_tail)
+SYM_CODE_START_LOCAL(copy_user_handle_tail)
 	cmp $X86_TRAP_MC,%eax
 	je 3f
 
@@ -209,9 +209,9 @@ SYM_CODE_START_LOCAL(.Lcopy_user_handle_tail)
 
 .Lcopy_user_handle_align:
 	addl %ecx,%edx			/* ecx is zerorest also */
-	jmp .Lcopy_user_handle_tail
+	jmp copy_user_handle_tail
 
-SYM_CODE_END(.Lcopy_user_handle_tail)
+SYM_CODE_END(copy_user_handle_tail)
 
 /*
  * Finish memcpy of less than 64 bytes.  #AC should already be set.
@@ -252,7 +252,7 @@ SYM_CODE_START_LOCAL(copy_user_short_string)
 40:	leal (%rdx,%rcx,8),%edx
 	jmp 60f
 50:	movl %ecx,%edx		/* ecx is zerorest also */
-60:	jmp .Lcopy_user_handle_tail
+60:	jmp copy_user_handle_tail
 
 	_ASM_EXTABLE_CPY(18b, 40b)
 	_ASM_EXTABLE_CPY(19b, 40b)
@@ -382,7 +382,7 @@ SYM_FUNC_START(__copy_user_nocache)
 	movl %ecx,%edx
 .L_fixup_handle_tail:
 	sfence
-	jmp .Lcopy_user_handle_tail
+	jmp copy_user_handle_tail
 
 	_ASM_EXTABLE_CPY(1b, .L_fixup_4x8b_copy)
 	_ASM_EXTABLE_CPY(2b, .L_fixup_4x8b_copy)
arch/x86/lib/putuser.S +12 -12
index 32125224fcca..3c33071cec97 100644
@@ -137,22 +137,22 @@ SYM_FUNC_START(__put_user_nocheck_8)
 SYM_FUNC_END(__put_user_nocheck_8)
 EXPORT_SYMBOL(__put_user_nocheck_8)
 
-SYM_CODE_START_LOCAL(.Lbad_put_user_clac)
+SYM_CODE_START_LOCAL(bad_put_user_clac)
 	ASM_CLAC
 .Lbad_put_user:
 	movl $-EFAULT,%ecx
 	RET
-SYM_CODE_END(.Lbad_put_user_clac)
+SYM_CODE_END(bad_put_user_clac)
 
-	_ASM_EXTABLE_UA(1b, .Lbad_put_user_clac)
-	_ASM_EXTABLE_UA(2b, .Lbad_put_user_clac)
-	_ASM_EXTABLE_UA(3b, .Lbad_put_user_clac)
-	_ASM_EXTABLE_UA(4b, .Lbad_put_user_clac)
-	_ASM_EXTABLE_UA(5b, .Lbad_put_user_clac)
-	_ASM_EXTABLE_UA(6b, .Lbad_put_user_clac)
-	_ASM_EXTABLE_UA(7b, .Lbad_put_user_clac)
-	_ASM_EXTABLE_UA(9b, .Lbad_put_user_clac)
+	_ASM_EXTABLE_UA(1b, bad_put_user_clac)
+	_ASM_EXTABLE_UA(2b, bad_put_user_clac)
+	_ASM_EXTABLE_UA(3b, bad_put_user_clac)
+	_ASM_EXTABLE_UA(4b, bad_put_user_clac)
+	_ASM_EXTABLE_UA(5b, bad_put_user_clac)
+	_ASM_EXTABLE_UA(6b, bad_put_user_clac)
+	_ASM_EXTABLE_UA(7b, bad_put_user_clac)
+	_ASM_EXTABLE_UA(9b, bad_put_user_clac)
 #ifdef CONFIG_X86_32
-	_ASM_EXTABLE_UA(8b, .Lbad_put_user_clac)
-	_ASM_EXTABLE_UA(10b, .Lbad_put_user_clac)
+	_ASM_EXTABLE_UA(8b, bad_put_user_clac)
+	_ASM_EXTABLE_UA(10b, bad_put_user_clac)
 #endif
Signature · 1 line
2.25.1
author
#1 lore raw
Quoted 15 lines · Nadav Amit

From: Nadav Amit <[email protected]>

When SYM_CODE_START_LOCAL() is used, the symbols are local but should be saved to the object. In contrast, using ".L" label prefix causes the symbols not to be saved in the object.

Since it is preferable to be able to map instruction pointers back to symbols, the local symbol should be saved in the object. Therefore, when SYM_CODE_START_LOCAL() is used, the ".L" label prefix should not be used.

Quoted 8 lines

Two symbols, however, have both SYM_CODE_START_LOCAL() and ".L" prefix:
.Lbad_put_user_clac and .Lcopy_user_handle_tail. Remove the ".L" prefix from them.

No functional change, other then emitting these symbols into the object, is intended.

Ping.