> in the interest of finally making some progress here I'd like to commit this > below (will test it one more time just in case but it should work :-P). It is > simple and straight-forward and doesn't need an IBPB when the bit gets > cleared. That's indeed simple and straight-forward for the time being. Maybe a small improvement we could add on top is to have a separate and dedicated cmdline option? Indeed, with `X86_FEATURE_SRSO_USER_KERNEL_NO` we are not effectively using an IBPB on VM-Exit anymore. Something like the diff down below? Best, Patrick --- diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 1d7afc40f2272..7609d80eda123 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -2531,6 +2531,7 @@ enum srso_mitigation_cmd { SRSO_CMD_SAFE_RET, SRSO_CMD_IBPB, SRSO_CMD_IBPB_ON_VMEXIT, + SRSO_CMD_BP_SPEC_REDUCE, }; static const char * const srso_strings[] = { @@ -2562,6 +2563,8 @@ static int __init srso_parse_cmdline(char *str) srso_cmd = SRSO_CMD_IBPB; else if (!strcmp(str, "ibpb-vmexit")) srso_cmd = SRSO_CMD_IBPB_ON_VMEXIT; + else if (!strcmp(str, "spec-reduce")) + srso_cmd = SRSO_CMD_BP_SPEC_REDUCE; else pr_err("Ignoring unknown SRSO option (%s).", str); @@ -2617,7 +2620,7 @@ static void __init srso_select_mitigation(void) case SRSO_CMD_SAFE_RET: if (boot_cpu_has(X86_FEATURE_SRSO_USER_KERNEL_NO)) - goto ibpb_on_vmexit; + goto spec_reduce; if (IS_ENABLED(CONFIG_MITIGATION_SRSO)) { /* @@ -2670,14 +2673,7 @@ static void __init srso_select_mitigation(void) } break; -ibpb_on_vmexit: case SRSO_CMD_IBPB_ON_VMEXIT: - if (boot_cpu_has(X86_FEATURE_SRSO_BP_SPEC_REDUCE)) { - pr_notice("Reducing speculation to address VM/HV SRSO attack vector.\n"); - srso_mitigation = SRSO_MITIGATION_BP_SPEC_REDUCE; - break; - } - if (IS_ENABLED(CONFIG_MITIGATION_IBPB_ENTRY)) { if (has_microcode) { setup_force_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT); @@ -2694,6 +2690,14 @@ static void __init srso_select_mitigation(void) pr_err("WARNING: kernel not compiled with MITIGATION_IBPB_ENTRY.\n"); } break; + +spec_reduce: + case SRSO_CMD_BP_SPEC_REDUCE: + if (boot_cpu_has(X86_FEATURE_SRSO_BP_SPEC_REDUCE)) { + pr_notice("Reducing speculation to address VM/HV SRSO attack vector.\n"); + srso_mitigation = SRSO_MITIGATION_BP_SPEC_REDUCE; + break; + } default: break; }