From dd2a401367fbbe472c5a4750601b09974afccd9a Mon Sep 17 00:00:00 2001 From: Boris Ostrovsky Date: Tue, 9 Jan 2018 19:08:45 -0500 Subject: [PATCH] x86/IBRS: Make sure we restore MSR_IA32_SPEC_CTRL to a valid value It is possible to (re-)enable IBRS between invocations of ENABLE_IBRS_SAVE_AND_CLOBBER and RESTORE_IBRS_CLOBBER. If that happens, the latter will be trying to write MSR_IA32_SPEC_CTRL with an uninitialized value, possibly triggering a #GPF. To avoid this let's make sure that we always save a valid value into the save register. If IBRS is disabled that safe value will be SPEC_CTRL_FEATURE_ENABLE_IBRS. Orabug: 27378102 Signed-off-by: Boris Ostrovsky Reviewed-by: Konrad Rzeszutek Wilk Signed-off-by: Konrad Rzeszutek Wilk --- v2: Instead of setting to zero we set it to SPEC_CTRL_FEATURE_ENABLE_IBRS Signed-off-by: Brian Maly Signed-off-by: Kirtikar Kashyap --- arch/x86/include/asm/spec_ctrl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/include/asm/spec_ctrl.h b/arch/x86/include/asm/spec_ctrl.h index 6cce513f3fb27..e62ea4685a1c2 100644 --- a/arch/x86/include/asm/spec_ctrl.h +++ b/arch/x86/include/asm/spec_ctrl.h @@ -160,6 +160,7 @@ wrmsr jmp 22f 12: + movl $SPEC_CTRL_FEATURE_ENABLE_IBRS, \save_reg lfence 22: .endm -- 2.50.1