Home Home > GIT Browse > SLE11-SP4
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2018-06-05 16:18:49 +0200
committerJiri Kosina <jkosina@suse.cz>2018-06-05 16:18:49 +0200
commitac809020a7cafa7bbca1f33254c87206d714c46f (patch)
treee3a56f55abdc1b7d55e0130d29921c2bd4beda29
parent93b0e34053ea44f25445271c1ee6af84e341e1bd (diff)
parent9a9bc8411c20512fb0b8afdd62107e54a67454cf (diff)
Merge remote-tracking branch 'origin/users/bpetkov/SLE11-SP4/for-next' into SLE11-SP4
Pull fix for alternative-based retpoline implementation from Borislav Petkov suse-commit: 543867a3d9faeaafbb2bcaa33001cbf00477212a
-rw-r--r--arch/x86/include/asm/system.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h
index 5ce9c6af72ca..50a9e40fd164 100644
--- a/arch/x86/include/asm/system.h
+++ b/arch/x86/include/asm/system.h
@@ -50,7 +50,10 @@ extern void show_regs_common(void);
* speculative execution to prevent attack.
*/
#ifdef CONFIG_RETPOLINE
-#define __switch_fill_rsb __stringify(__FILL_RETURN_BUFFER(%%ebx, RSB_CLEAR_LOOPS, %%esp))
+#define __switch_fill_rsb \
+ ALTERNATIVE("jmp 1f\n\t" ASM_NOP3, ASM_NOP5, X86_FEATURE_RSB_CTXSW) \
+ __stringify(__FILL_RETURN_BUFFER(%%ebx,RSB_CLEAR_LOOPS,%%esp)) "\n\t" \
+ "1:\n"
#else
#define __switch_fill_rsb
#endif
@@ -147,9 +150,15 @@ do { \
* with userspace addresses. On CPUs where those concerns
* exist, overwrite the RSB with entries which capture
* speculative execution to prevent attack.
+ *
+ * bp: use the old jmp labels and fix the padding so that
+ * the original insn is always >= replacement.
*/
#ifdef CONFIG_RETPOLINE
-#define __switch_fill_rsb __stringify(__FILL_RETURN_BUFFER(%%rbx, RSB_CLEAR_LOOPS, %%rsp))
+#define __switch_fill_rsb \
+ ALTERNATIVE("jmp 1f\n\t" ASM_NOP3, ASM_NOP5, X86_FEATURE_RSB_CTXSW) \
+ __stringify(__FILL_RETURN_BUFFER(%%rbx,RSB_CLEAR_LOOPS,%%rsp)) "\n\t" \
+ "1:\n"
#else
#define __switch_fill_rsb
#endif