]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
x86/asm: Mark all top level asm statements as .text
authorAndi Kleen <ak@linux.intel.com>
Sat, 30 Mar 2019 00:47:35 +0000 (17:47 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 19 Apr 2019 15:46:55 +0000 (17:46 +0200)
With gcc toplevel assembler statements that do not mark themselves as .text
may end up in other sections. This causes LTO boot crashes because various
assembler statements ended up in the middle of the initcall section. It's
also a latent problem without LTO, although it's currently not known to
cause any real problems.

According to the gcc team it's expected behavior.

Always mark all the top level assembler statements as text so that they
switch to the right section.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20190330004743.29541-1-andi@firstfloor.org
arch/x86/kernel/cpu/amd.c
arch/x86/kernel/kprobes/core.c
arch/x86/lib/error-inject.c

index 01004bfb1a1bcdd4a9f5b41c987939fe43f6ec62..1bcb489e07e73460eb38d7a387d7d1e0119bc38c 100644 (file)
@@ -83,7 +83,8 @@ static inline int wrmsrl_amd_safe(unsigned msr, unsigned long long val)
  */
 
 extern __visible void vide(void);
-__asm__(".globl vide\n"
+__asm__(".text\n"
+       ".globl vide\n"
        ".type vide, @function\n"
        ".align 4\n"
        "vide: ret\n");
index a034cb808e7eb482e6fd8eae3fac9afca63b429c..31ab91c9c4e947ce1ec4ea06084166e18e788e11 100644 (file)
@@ -715,6 +715,7 @@ NOKPROBE_SYMBOL(kprobe_int3_handler);
  * calls trampoline_handler() runs, which calls the kretprobe's handler.
  */
 asm(
+       ".text\n"
        ".global kretprobe_trampoline\n"
        ".type kretprobe_trampoline, @function\n"
        "kretprobe_trampoline:\n"
index 3cdf06128d13c11b60ca2aa7cadf32af03703020..be5b5fb1598bd81cbfa9fd3b05944a7804e22ee9 100644 (file)
@@ -6,6 +6,7 @@
 asmlinkage void just_return_func(void);
 
 asm(
+       ".text\n"
        ".type just_return_func, @function\n"
        ".globl just_return_func\n"
        "just_return_func:\n"