Commit 93c5dba2 authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Kleber Sacilotto de Souza

retpoline: Introduce start/end markers of indirect thunk

CVE-2017-5715 (Spectre v2 retpoline)

commit 736e80a4 upstream.

Introduce start/end markers of __x86_indirect_thunk_* functions.
To make it easy, consolidate .text.__x86.indirect_thunk.* sections
to one .text.__x86.indirect_thunk section and put it in the
end of kernel text section and adds __indirect_thunk_start/end
so that other subsystem (e.g. kprobes) can identify it.
Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarDavid Woodhouse <dwmw@amazon.co.uk>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linux-foundation.org>
Link: https://lkml.kernel.org/r/151629206178.10241.6828804696410044771.stgit@devboxSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 036aa2c8445652058fc937cb7f651e1cdb35cb19)
Signed-off-by: default avatarAndy Whitcroft <apw@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 5759d91e
...@@ -171,6 +171,9 @@ enum spectre_v2_mitigation { ...@@ -171,6 +171,9 @@ enum spectre_v2_mitigation {
SPECTRE_V2_IBRS, SPECTRE_V2_IBRS,
}; };
extern char __indirect_thunk_start[];
extern char __indirect_thunk_end[];
/* /*
* On VMEXIT we must ensure that no RSB predictions learned in the guest * On VMEXIT we must ensure that no RSB predictions learned in the guest
* can be followed in the host, by overwriting the RSB completely. Both * can be followed in the host, by overwriting the RSB completely. Both
......
...@@ -104,6 +104,13 @@ SECTIONS ...@@ -104,6 +104,13 @@ SECTIONS
IRQENTRY_TEXT IRQENTRY_TEXT
*(.fixup) *(.fixup)
*(.gnu.warning) *(.gnu.warning)
#ifdef CONFIG_RETPOLINE
__indirect_thunk_start = .;
*(.text.__x86.indirect_thunk)
__indirect_thunk_end = .;
#endif
/* End of text section */ /* End of text section */
_etext = .; _etext = .;
} :text = 0x9090 } :text = 0x9090
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <asm/nospec-branch.h> #include <asm/nospec-branch.h>
.macro THUNK reg .macro THUNK reg
.section .text.__x86.indirect_thunk.\reg .section .text.__x86.indirect_thunk
ENTRY(__x86_indirect_thunk_\reg) ENTRY(__x86_indirect_thunk_\reg)
CFI_STARTPROC CFI_STARTPROC
......
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