From 35c0f76f3de95422531c137455f525063f85db42 Mon Sep 17 00:00:00 2001 From: Tim Chen Date: Mon, 18 Dec 2017 10:37:31 -0800 Subject: [PATCH] x86/microcode: Recheck IBRS and IBPB feature on microcode reload On new microcode write, check whether IBRS and IBPB features are present by rescanning scattered CPU features. 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 --- arch/x86/kernel/cpu/microcode/core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index 36a83617eb21..44fe1cfee5fe 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -231,6 +231,11 @@ static ssize_t microcode_write(struct file *file, const char __user *buf, if (ret > 0) perf_check_microcode(); + /* check spec_ctrl capabilities */ + mutex_lock(&spec_ctrl_mutex); + init_scattered_cpuid_features(&boot_cpu_data); + mutex_unlock(&spec_ctrl_mutex); + mutex_unlock(µcode_mutex); put_online_cpus(); -- 2.50.1