]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
retpoline: Introduce start/end markers of indirect thunk
authorMasami Hiramatsu <mhiramat@kernel.org>
Thu, 18 Jan 2018 16:14:21 +0000 (01:14 +0900)
committerJack Vogel <jack.vogel@oracle.com>
Thu, 8 Feb 2018 18:13:39 +0000 (10:13 -0800)
commit 736e80a4213e9bbce40a7c050337047128b472ac 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: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: David 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@devbox
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 799dc737680a8074a0c7c2d3426b85f4c439377f)
Orabug: 27477743
CVE: CVE-2017-5715
Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: Pavel Tatashin <pasha.tatashin@oracle.com>
arch/x86/include/asm/nospec-branch.h
arch/x86/kernel/vmlinux.lds.S
arch/x86/lib/retpoline.S

index b52436b0d14cbfb49ad18a6bf614627995c9705b..2d974aec875ab2e019e2d5a6f26a876fe95bb692 100644 (file)
@@ -172,6 +172,9 @@ enum spectre_v2_mitigation {
        SPECTRE_V2_IBRS_LFENCE,
 };
 
+extern char __indirect_thunk_start[];
+extern char __indirect_thunk_end[];
+
 /*
  * 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
index aeb549f04bca9d0dbf623ade2b390733ae9ac204..096e340e293855bcdc319c29174d13d33bb1fb26 100644 (file)
@@ -105,6 +105,13 @@ SECTIONS
                IRQENTRY_TEXT
                *(.fixup)
                *(.gnu.warning)
+
+#ifdef CONFIG_RETPOLINE
+               __indirect_thunk_start = .;
+               *(.text.__x86.indirect_thunk)
+               __indirect_thunk_end = .;
+#endif
+
                /* End of text section */
                _etext = .;
        } :text = 0x9090
index 019a03599bb06711f60bfc9a0b53d4228287d5a0..8a8093e9cf0140bd6371648733bca82c57306eff 100644 (file)
@@ -9,7 +9,7 @@
 #include <asm/nospec-branch.h>
 
 .macro THUNK reg
-       .section .text.__x86.indirect_thunk.\reg
+       .section .text.__x86.indirect_thunk
 
 ENTRY(__x86_indirect_thunk_\reg)
        CFI_STARTPROC