lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 17 Feb 2017 11:47:50 +0100
From:   Jiri Slaby <jslaby@...e.cz>
To:     mingo@...hat.com
Cc:     tglx@...utronix.de, hpa@...or.com, x86@...nel.org,
        jpoimboe@...hat.com, linux-kernel@...r.kernel.org,
        Jiri Slaby <jslaby@...e.cz>
Subject: [PATCH 03/10] x86: boot, annotate functions properly

1) GLOBAL is meant for global symbols, but not functions. Use ENTRY
   which is dedicated for global functions.
2) Finish every function with ENDPROC.

Note that efi_pe_entry is not a start of a function, it is the middle of
startup_64 -- annotate as such.

Signed-off-by: Jiri Slaby <jslaby@...e.cz>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: <x86@...nel.org>

---

The alternative to the startup_64 change would be to move efi_pe_entry
out of startup_64 which actually makes more sense, but I am afraid I
cannot test the result properly. See what it is now:
	.org 0x200
	ENTRY(startup_64)
	#ifdef CONFIG_EFI_STUB
		jmp     preferred_addr
	GLOBAL(efi_pe_entry)
		... ; a lot of assembly (efi_pe_entry)
		leaq    preferred_addr(%rax), %rax
		jmp     *%rax
	preferred_addr:
	#endif
		... ; a lot of assembly (startup_64)
	ENDPROC(startup_64)

What about:
	.org 0x200
	ENTRY(startup_64)
		... ; a lot of assembly (startup_64)
	ENDPROC(startup_64)

	#ifdef CONFIG_EFI_STUB
	ENTRY(efi_pe_entry)
		... ; a lot of assembly (efi_pe_entry)
		leaq    startup_64(%rax), %rax
		jmp     *%rax
	ENDPROC(efi_pe_entry)
	#endif
This solution is at the end of the series as RFC.
---
 arch/x86/boot/compressed/head_64.S |  3 ++-
 arch/x86/boot/copy.S               | 12 ++++++------
 arch/x86/boot/pmjump.S             |  4 ++--
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index 4d85e600db78..59eccbc46ad7 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -250,7 +250,7 @@ ENTRY(startup_64)
 	 */
 	jmp	preferred_addr
 
-ENTRY(efi_pe_entry)
+GLOBAL(efi_pe_entry)
 	movq	%rcx, efi64_config(%rip)	/* Handle */
 	movq	%rdx, efi64_config+8(%rip) /* EFI System table pointer */
 
@@ -369,6 +369,7 @@ preferred_addr:
  */
 	leaq	relocated(%rbx), %rax
 	jmp	*%rax
+ENDPROC(startup_64)
 
 #ifdef CONFIG_EFI_STUB
 	.org 0x390
diff --git a/arch/x86/boot/copy.S b/arch/x86/boot/copy.S
index 1eb7d298b47d..44133dd0218e 100644
--- a/arch/x86/boot/copy.S
+++ b/arch/x86/boot/copy.S
@@ -17,7 +17,7 @@
 	.code16
 	.text
 
-GLOBAL(memcpy)
+ENTRY(memcpy)
 	pushw	%si
 	pushw	%di
 	movw	%ax, %di
@@ -33,7 +33,7 @@ GLOBAL(memcpy)
 	retl
 ENDPROC(memcpy)
 
-GLOBAL(memset)
+ENTRY(memset)
 	pushw	%di
 	movw	%ax, %di
 	movzbl	%dl, %eax
@@ -48,7 +48,7 @@ GLOBAL(memset)
 	retl
 ENDPROC(memset)
 
-GLOBAL(copy_from_fs)
+ENTRY(copy_from_fs)
 	pushw	%ds
 	pushw	%fs
 	popw	%ds
@@ -57,7 +57,7 @@ GLOBAL(copy_from_fs)
 	retl
 ENDPROC(copy_from_fs)
 
-GLOBAL(copy_to_fs)
+ENTRY(copy_to_fs)
 	pushw	%es
 	pushw	%fs
 	popw	%es
@@ -67,7 +67,7 @@ GLOBAL(copy_to_fs)
 ENDPROC(copy_to_fs)
 
 #if 0 /* Not currently used, but can be enabled as needed */
-GLOBAL(copy_from_gs)
+ENTRY(copy_from_gs)
 	pushw	%ds
 	pushw	%gs
 	popw	%ds
@@ -76,7 +76,7 @@ GLOBAL(copy_from_gs)
 	retl
 ENDPROC(copy_from_gs)
 
-GLOBAL(copy_to_gs)
+ENTRY(copy_to_gs)
 	pushw	%es
 	pushw	%gs
 	popw	%es
diff --git a/arch/x86/boot/pmjump.S b/arch/x86/boot/pmjump.S
index 3e0edc6d2a20..6528f78a79b5 100644
--- a/arch/x86/boot/pmjump.S
+++ b/arch/x86/boot/pmjump.S
@@ -23,7 +23,7 @@
 /*
  * void protected_mode_jump(u32 entrypoint, u32 bootparams);
  */
-GLOBAL(protected_mode_jump)
+ENTRY(protected_mode_jump)
 	movl	%edx, %esi		# Pointer to boot_params table
 
 	xorl	%ebx, %ebx
@@ -48,7 +48,7 @@ ENDPROC(protected_mode_jump)
 
 	.code32
 	.section ".text32","ax"
-GLOBAL(in_pm32)
+ENTRY(in_pm32)
 	# Set up data segments for flat 32-bit mode
 	movl	%ecx, %ds
 	movl	%ecx, %es
-- 
2.11.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ