]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
UBUNTU: SAUCE: early/late -- annotate indirect calls in early/late initialisation...
authorAndy Whitcroft <apw@canonical.com>
Tue, 20 Mar 2018 12:50:00 +0000 (12:50 +0000)
committerSeth Forshee <seth.forshee@canonical.com>
Wed, 28 Mar 2018 15:06:53 +0000 (10:06 -0500)
BugLink: http://bugs.launchpad.net/bugs/1758856
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
arch/x86/kernel/acpi/wakeup_32.S
arch/x86/kernel/acpi/wakeup_64.S
arch/x86/kernel/head_32.S
arch/x86/kernel/reboot.c
arch/x86/kernel/relocate_kernel_32.S
arch/x86/kernel/relocate_kernel_64.S
arch/x86/power/hibernate_asm_64.S
arch/x86/realmode/rm/trampoline_32.S
arch/x86/xen/xen-pvh.S

index 0c26b1b44e51aeffb72a6daa151049880f52892f..c95e9b0fb7e11452d8c58036603a8638a339f580 100644 (file)
@@ -2,6 +2,7 @@
 #include <linux/linkage.h>
 #include <asm/segment.h>
 #include <asm/page_types.h>
+#include <asm/nospec-branch.h>
 
 # Copyright 2003, 2008 Pavel Machek <pavel@suse.cz>, distribute under GPLv2
 
@@ -37,6 +38,7 @@ wakeup_pmode_return:
 
        # jump to place where we left off
        movl    saved_eip, %eax
+       ANNOTATE_RETPOLINE_SAFE
        jmp     *%eax
 
 bogus_magic:
index 50b8ed0317a34bb1a5d0fb9296462775f62a11bc..b415fb4f2d28ff9584bb01e959c4540a709838e3 100644 (file)
@@ -6,6 +6,7 @@
 #include <asm/msr.h>
 #include <asm/asm-offsets.h>
 #include <asm/frame.h>
+#include <asm/nospec-branch.h>
 
 # Copyright 2003 Pavel Machek <pavel@suse.cz>, distribute under GPLv2
 
@@ -33,6 +34,7 @@ ENTRY(wakeup_long64)
        movq    saved_rbp, %rbp
 
        movq    saved_rip, %rax
+       ANNOTATE_RETPOLINE_SAFE
        jmp     *%rax
 ENDPROC(wakeup_long64)
 
index b59e4fb40fd9986c0cc6b629b4c7a3a18a6d23b4..0098c5c867730207a5a115ecbfb6a79d676808a5 100644 (file)
@@ -26,6 +26,7 @@
 #include <asm/bootparam.h>
 #include <asm/export.h>
 #include <asm/pgtable_32.h>
+#include <asm/nospec-branch.h>
 
 /* Physical address */
 #define pa(X) ((X) - __PAGE_OFFSET)
@@ -153,6 +154,7 @@ ENTRY(startup_32)
 
        movl pa(subarch_entries)(,%eax,4), %eax
        subl $__PAGE_OFFSET, %eax
+       ANNOTATE_RETPOLINE_SAFE
        jmp *%eax
 
 .Lbad_subarch:
@@ -302,6 +304,7 @@ ENTRY(startup_32_smp)
        movl setup_once_ref,%eax
        andl %eax,%eax
        jz 1f                           # Did we do this already?
+       ANNOTATE_RETPOLINE_SAFE
        call *%eax
 1:
 
index 97d29dbd03003701a318c6891e55645e757febdd..be0a2a19cb5d38df878a25ac2737368c543b1b14 100644 (file)
@@ -32,6 +32,7 @@
 #include <asm/realmode.h>
 #include <asm/x86_init.h>
 #include <asm/efi.h>
+#include <asm/nospec-branch.h>
 
 /*
  * Power off function, if any
@@ -114,11 +115,11 @@ void __noreturn machine_real_restart(unsigned int type)
 
        /* Jump to the identity-mapped low memory code */
 #ifdef CONFIG_X86_32
-       asm volatile("jmpl *%0" : :
+       asm volatile(ANNOTATE_RETPOLINE_SAFE "jmpl *%0" : :
                     "rm" (real_mode_header->machine_real_restart_asm),
                     "a" (type));
 #else
-       asm volatile("ljmpl *%0" : :
+       asm volatile(ANNOTATE_RETPOLINE_SAFE "ljmpl *%0" : :
                     "m" (real_mode_header->machine_real_restart_asm),
                     "D" (type));
 #endif
index 77630d57e7bf30ac7f281e15c440cd7b7bae37a9..18668e787680837d0746e353ab2f01393eb26150 100644 (file)
@@ -10,6 +10,7 @@
 #include <asm/page_types.h>
 #include <asm/kexec.h>
 #include <asm/processor-flags.h>
+#include <asm/nospec-branch.h>
 
 /*
  * Must be relocatable PIC code callable as a C function
@@ -167,6 +168,7 @@ identity_mapped:
        movl    CP_PA_SWAP_PAGE(%edi), %esp
        addl    $PAGE_SIZE, %esp
 2:
+       ANNOTATE_RETPOLINE_SAFE
        call    *%edx
 
        /* get the re-entry point of the peer system */
index 11eda21eb697df6d8439206cad890d0e24c7de71..8c28e669b9b29c72ebe37c28a17baf1a1a4dcaf0 100644 (file)
@@ -11,6 +11,7 @@
 #include <asm/kexec.h>
 #include <asm/processor-flags.h>
 #include <asm/pgtable_types.h>
+#include <asm/nospec-branch.h>
 
 /*
  * Must be relocatable PIC code callable as a C function
@@ -194,6 +195,7 @@ identity_mapped:
 1:
        popq    %rdx
        leaq    PAGE_SIZE(%r10), %rsp
+       ANNOTATE_RETPOLINE_SAFE
        call    *%rdx
 
        /* get the re-entry point of the peer system */
index ce8da3a0412cbb1a715b56e4c2f41cc431fe9965..8cd2cdc92f47aeea2f786ebf1f711f3e86fac4cb 100644 (file)
@@ -22,6 +22,7 @@
 #include <asm/asm-offsets.h>
 #include <asm/processor-flags.h>
 #include <asm/frame.h>
+#include <asm/nospec-branch.h>
 
 ENTRY(swsusp_arch_suspend)
        movq    $saved_context, %rax
@@ -67,6 +68,7 @@ ENTRY(restore_image)
 
        /* jump to relocated restore code */
        movq    relocated_restore_code(%rip), %rcx
+       ANNOTATE_RETPOLINE_SAFE
        jmpq    *%rcx
 
        /* code below has been relocated to a safe page */
@@ -97,6 +99,7 @@ ENTRY(core_restore_code)
 
 .Ldone:
        /* jump to the restore_registers address from the image header */
+       ANNOTATE_RETPOLINE_SAFE
        jmpq    *%r8
 
         /* code below belongs to the image kernel */
index 2dd866c9e21ea4f8fb7e04180ff408978d87d4f4..b266ab3d5242cf2689dd6ec9b52afb4e4ccde59b 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/linkage.h>
 #include <asm/segment.h>
 #include <asm/page_types.h>
+#include <asm/nospec-branch.h>
 #include "realmode.h"
 
        .text
@@ -61,6 +62,7 @@ ENTRY(trampoline_start)
        .section ".text32","ax"
        .code32
 ENTRY(startup_32)                      # note: also used from wakeup_asm.S
+       ANNOTATE_RETPOLINE_SAFE
        jmp     *%eax
 
        .bss
index e1a5fbeae08d8a3bf3cb619c023bab096ad4ba2d..ce642e12521da2c933f53322ab9cf4f782a15c53 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/boot.h>
 #include <asm/processor-flags.h>
 #include <asm/msr.h>
+#include <asm/nospec-branch.h>
 #include <xen/interface/elfnote.h>
 
        __HEAD
@@ -103,6 +104,7 @@ ENTRY(pvh_start_xen)
        /* startup_64 expects boot_params in %rsi. */
        mov $_pa(pvh_bootparams), %rsi
        mov $_pa(startup_64), %rax
+       ANNOTATE_RETPOLINE_SAFE
        jmp *%rax
 
 #else /* CONFIG_X86_64 */