From: Tim Chen Date: Fri, 15 Dec 2017 12:25:03 +0000 (-0800) Subject: x86: Add macro that does not save rax, rcx, rdx on stack to disable IBRS X-Git-Tag: v4.1.12-124.31.3~1415 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=86eb701a9cc2a4b6e602d77b2b3f12a5e1e267f3;p=users%2Fjedix%2Flinux-maple.git x86: Add macro that does not save rax, rcx, rdx on stack to disable IBRS Orabug: 27344012 CVE: CVE-2017-5715 Signed-off-by: Tim Chen Signed-off-by: Konrad Rzeszutek Wilk Reviewed-by: John Haxby Signed-off-by: Kirtikar Kashyap --- diff --git a/arch/x86/include/asm/spec_ctrl.h b/arch/x86/include/asm/spec_ctrl.h index de4ce9ee4de8..3080f33fbd08 100644 --- a/arch/x86/include/asm/spec_ctrl.h +++ b/arch/x86/include/asm/spec_ctrl.h @@ -46,6 +46,11 @@ popq %rdx; \ popq %rcx; \ popq %rax +#define __ASM_DISABLE_IBRS_CLOBBER \ + movl $MSR_IA32_SPEC_CTRL, %ecx; \ + movl $0, %edx; \ + movl $0, %eax; \ + wrmsr; .macro ENABLE_IBRS ALTERNATIVE "", __stringify(__ASM_ENABLE_IBRS), X86_FEATURE_SPEC_CTRL @@ -66,5 +71,9 @@ ALTERNATIVE "", __stringify(__ASM_DISABLE_IBRS), X86_FEATURE_SPEC_CTRL ALTERNATIVE "", __stringify(__ASM_SET_IBPB), X86_FEATURE_SPEC_CTRL .endm +.macro DISABLE_IBRS_CLOBBER +ALTERNATIVE "", __stringify(__ASM_DISABLE_IBRS_CLOBBER), X86_FEATURE_SPEC_CTRL +.endm + #endif /* __ASSEMBLY__ */ #endif /* _ASM_X86_SPEC_CTRL_H */