Skip to content

Commit 0fe4aee

Browse files
jpoimboesuryasaimadhu
authored andcommitted
x86/bugs: Do IBPB fallback check only once
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: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Borislav Petkov <bp@suse.de>
1 parent 3ebc170 commit 0fe4aee

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

arch/x86/kernel/cpu/bugs.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -891,18 +891,13 @@ static void __init retbleed_select_mitigation(void)
891891
case RETBLEED_CMD_AUTO:
892892
default:
893893
if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
894-
boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
895-
896-
if (IS_ENABLED(CONFIG_RETPOLINE) &&
897-
IS_ENABLED(CONFIG_CC_HAS_RETURN_THUNK))
898-
retbleed_mitigation = RETBLEED_MITIGATION_UNRET;
899-
else
900-
retbleed_mitigation = RETBLEED_MITIGATION_IBPB;
901-
}
894+
boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
895+
retbleed_mitigation = RETBLEED_MITIGATION_UNRET;
902896

903897
/*
904-
* The Intel mitigation (IBRS) was already selected in
905-
* spectre_v2_select_mitigation().
898+
* The Intel mitigation (IBRS or eIBRS) was already selected in
899+
* spectre_v2_select_mitigation(). 'retbleed_mitigation' will
900+
* be set accordingly below.
906901
*/
907902

908903
break;

0 commit comments

Comments
 (0)