Commit fa744426 authored by Andy Whitcroft's avatar Andy Whitcroft Committed by Juerg Haefliger

UBUNTU: SAUCE: early/late -- annotate indirect calls in early/late initialisation code

BugLink: http://bugs.launchpad.net/bugs/1758856Signed-off-by: default avatarAndy Whitcroft <apw@canonical.com>
Acked-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
parent 6f2c371d
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <linux/linkage.h> #include <linux/linkage.h>
#include <asm/segment.h> #include <asm/segment.h>
#include <asm/page_types.h> #include <asm/page_types.h>
#include <asm/nospec-branch.h>
# Copyright 2003, 2008 Pavel Machek <pavel@suse.cz>, distribute under GPLv2 # Copyright 2003, 2008 Pavel Machek <pavel@suse.cz>, distribute under GPLv2
...@@ -37,6 +38,7 @@ wakeup_pmode_return: ...@@ -37,6 +38,7 @@ wakeup_pmode_return:
# jump to place where we left off # jump to place where we left off
movl saved_eip, %eax movl saved_eip, %eax
ANNOTATE_RETPOLINE_SAFE
jmp *%eax jmp *%eax
bogus_magic: bogus_magic:
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <asm/page_types.h> #include <asm/page_types.h>
#include <asm/msr.h> #include <asm/msr.h>
#include <asm/asm-offsets.h> #include <asm/asm-offsets.h>
#include <asm/nospec-branch.h>
# Copyright 2003 Pavel Machek <pavel@suse.cz>, distribute under GPLv2 # Copyright 2003 Pavel Machek <pavel@suse.cz>, distribute under GPLv2
...@@ -32,6 +33,7 @@ ENTRY(wakeup_long64) ...@@ -32,6 +33,7 @@ ENTRY(wakeup_long64)
movq saved_rbp, %rbp movq saved_rbp, %rbp
movq saved_rip, %rax movq saved_rip, %rax
ANNOTATE_RETPOLINE_SAFE
jmp *%rax jmp *%rax
ENDPROC(wakeup_long64) ENDPROC(wakeup_long64)
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <asm/percpu.h> #include <asm/percpu.h>
#include <asm/nops.h> #include <asm/nops.h>
#include <asm/bootparam.h> #include <asm/bootparam.h>
#include <asm/nospec-branch.h>
/* Physical address */ /* Physical address */
#define pa(X) ((X) - __PAGE_OFFSET) #define pa(X) ((X) - __PAGE_OFFSET)
...@@ -257,6 +258,7 @@ page_pde_offset = (__PAGE_OFFSET >> 20); ...@@ -257,6 +258,7 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
movl pa(subarch_entries)(,%eax,4), %eax movl pa(subarch_entries)(,%eax,4), %eax
subl $__PAGE_OFFSET, %eax subl $__PAGE_OFFSET, %eax
ANNOTATE_RETPOLINE_SAFE
jmp *%eax jmp *%eax
bad_subarch: bad_subarch:
...@@ -410,6 +412,7 @@ enable_paging: ...@@ -410,6 +412,7 @@ enable_paging:
movl setup_once_ref,%eax movl setup_once_ref,%eax
andl %eax,%eax andl %eax,%eax
jz 1f # Did we do this already? jz 1f # Did we do this already?
ANNOTATE_RETPOLINE_SAFE
call *%eax call *%eax
1: 1:
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <asm/realmode.h> #include <asm/realmode.h>
#include <asm/x86_init.h> #include <asm/x86_init.h>
#include <asm/efi.h> #include <asm/efi.h>
#include <asm/nospec-branch.h>
/* /*
* Power off function, if any * Power off function, if any
...@@ -114,11 +115,11 @@ void __noreturn machine_real_restart(unsigned int type) ...@@ -114,11 +115,11 @@ void __noreturn machine_real_restart(unsigned int type)
/* Jump to the identity-mapped low memory code */ /* Jump to the identity-mapped low memory code */
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
asm volatile("jmpl *%0" : : asm volatile(ANNOTATE_RETPOLINE_SAFE "jmpl *%0" : :
"rm" (real_mode_header->machine_real_restart_asm), "rm" (real_mode_header->machine_real_restart_asm),
"a" (type)); "a" (type));
#else #else
asm volatile("ljmpl *%0" : : asm volatile(ANNOTATE_RETPOLINE_SAFE "ljmpl *%0" : :
"m" (real_mode_header->machine_real_restart_asm), "m" (real_mode_header->machine_real_restart_asm),
"D" (type)); "D" (type));
#endif #endif
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <asm/page_types.h> #include <asm/page_types.h>
#include <asm/kexec.h> #include <asm/kexec.h>
#include <asm/processor-flags.h> #include <asm/processor-flags.h>
#include <asm/nospec-branch.h>
/* /*
* Must be relocatable PIC code callable as a C function * Must be relocatable PIC code callable as a C function
...@@ -167,6 +168,7 @@ identity_mapped: ...@@ -167,6 +168,7 @@ identity_mapped:
movl CP_PA_SWAP_PAGE(%edi), %esp movl CP_PA_SWAP_PAGE(%edi), %esp
addl $PAGE_SIZE, %esp addl $PAGE_SIZE, %esp
2: 2:
ANNOTATE_RETPOLINE_SAFE
call *%edx call *%edx
/* get the re-entry point of the peer system */ /* get the re-entry point of the peer system */
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <asm/kexec.h> #include <asm/kexec.h>
#include <asm/processor-flags.h> #include <asm/processor-flags.h>
#include <asm/pgtable_types.h> #include <asm/pgtable_types.h>
#include <asm/nospec-branch.h>
/* /*
* Must be relocatable PIC code callable as a C function * Must be relocatable PIC code callable as a C function
...@@ -172,6 +173,7 @@ identity_mapped: ...@@ -172,6 +173,7 @@ identity_mapped:
1: 1:
popq %rdx popq %rdx
leaq PAGE_SIZE(%r10), %rsp leaq PAGE_SIZE(%r10), %rsp
ANNOTATE_RETPOLINE_SAFE
call *%rdx call *%rdx
/* get the re-entry point of the peer system */ /* get the re-entry point of the peer system */
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <asm/page_types.h> #include <asm/page_types.h>
#include <asm/asm-offsets.h> #include <asm/asm-offsets.h>
#include <asm/processor-flags.h> #include <asm/processor-flags.h>
#include <asm/nospec-branch.h>
ENTRY(swsusp_arch_suspend) ENTRY(swsusp_arch_suspend)
movq $saved_context, %rax movq $saved_context, %rax
...@@ -63,6 +64,7 @@ ENTRY(restore_image) ...@@ -63,6 +64,7 @@ ENTRY(restore_image)
/* jump to relocated restore code */ /* jump to relocated restore code */
movq relocated_restore_code(%rip), %rcx movq relocated_restore_code(%rip), %rcx
ANNOTATE_RETPOLINE_SAFE
jmpq *%rcx jmpq *%rcx
/* code below has been relocated to a safe page */ /* code below has been relocated to a safe page */
...@@ -95,6 +97,7 @@ ENTRY(core_restore_code) ...@@ -95,6 +97,7 @@ ENTRY(core_restore_code)
.Ldone: .Ldone:
/* jump to the restore_registers address from the image header */ /* jump to the restore_registers address from the image header */
ANNOTATE_RETPOLINE_SAFE
jmpq *%r8 jmpq *%r8
/* code below belongs to the image kernel */ /* code below belongs to the image kernel */
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/linkage.h> #include <linux/linkage.h>
#include <asm/segment.h> #include <asm/segment.h>
#include <asm/page_types.h> #include <asm/page_types.h>
#include <asm/nospec-branch.h>
#include "realmode.h" #include "realmode.h"
.text .text
...@@ -60,6 +61,7 @@ ENTRY(trampoline_start) ...@@ -60,6 +61,7 @@ ENTRY(trampoline_start)
.section ".text32","ax" .section ".text32","ax"
.code32 .code32
ENTRY(startup_32) # note: also used from wakeup_asm.S ENTRY(startup_32) # note: also used from wakeup_asm.S
ANNOTATE_RETPOLINE_SAFE
jmp *%eax jmp *%eax
.bss .bss
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment