提交 976d4144 编写于 作者: J Josh Poimboeuf 提交者: Zheng Zengkai

x86/bugs: Do IBPB fallback check only once

stable inclusion
from stable-v5.10.133
commit fbab1c94eb1a3139d7ac0620dc6d7d6a33f3b255
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5PTAS
CVE: CVE-2022-29900,CVE-2022-23816,CVE-2022-29901

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=fbab1c94eb1a3139d7ac0620dc6d7d6a33f3b255

--------------------------------

commit 0fe4aeea upstream.

When booting with retbleed=auto, if the kernel wasn't built with
CONFIG_CC_HAS_RETURN_THUNK, the mitigation falls back to IBPB.  Make
sure a warning is printed in that case.  The IBPB fallback check is done
twice, but it really only needs to be done once.
Signed-off-by: NJosh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: NBorislav Petkov <bp@suse.de>
Signed-off-by: NThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: NBen Hutchings <ben@decadent.org.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NLin Yujun <linyujun809@huawei.com>
Reviewed-by: NZhang Jianhua <chris.zjh@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 53f02c5b
......@@ -847,18 +847,13 @@ static void __init retbleed_select_mitigation(void)
case RETBLEED_CMD_AUTO:
default:
if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
if (IS_ENABLED(CONFIG_RETPOLINE) &&
IS_ENABLED(CONFIG_CC_HAS_RETURN_THUNK))
retbleed_mitigation = RETBLEED_MITIGATION_UNRET;
else
retbleed_mitigation = RETBLEED_MITIGATION_IBPB;
}
boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
retbleed_mitigation = RETBLEED_MITIGATION_UNRET;
/*
* The Intel mitigation (IBRS) was already selected in
* spectre_v2_select_mitigation().
* The Intel mitigation (IBRS or eIBRS) was already selected in
* spectre_v2_select_mitigation(). 'retbleed_mitigation' will
* be set accordingly below.
*/
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册