Re: [PATCH v4 09/11] x86/vmscape: Deploy BHB clearing mitigation
From: Nikolay Borisov
Date: Fri Nov 21 2025 - 09:18:18 EST
On 11/20/25 08:19, Pawan Gupta wrote:
IBPB mitigation for VMSCAPE is an overkill on CPUs that are only affected
by the BHI variant of VMSCAPE. On such CPUs, eIBRS already provides
indirect branch isolation between guest and host userspace. However, branch
history from guest may also influence the indirect branches in host
userspace.
To mitigate the BHI aspect, use clear_bhb_loop().
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@xxxxxxxxxxxxxxx>
<snip>
@@ -3278,6 +3290,9 @@ static void __init vmscape_apply_mitigation(void)
{
if (vmscape_mitigation == VMSCAPE_MITIGATION_IBPB_EXIT_TO_USER)
static_call_update(vmscape_predictor_flush, write_ibpb);
+ else if (vmscape_mitigation == VMSCAPE_MITIGATION_BHB_CLEAR_EXIT_TO_USER &&
+ IS_ENABLED(CONFIG_X86_64))
why the x86_64 dependency ?
+ static_call_update(vmscape_predictor_flush, clear_bhb_loop);
}
#undef pr_fmt
@@ -3369,6 +3384,7 @@ void cpu_bugs_smt_update(void)
break;
case VMSCAPE_MITIGATION_IBPB_ON_VMEXIT:
case VMSCAPE_MITIGATION_IBPB_EXIT_TO_USER:
+ case VMSCAPE_MITIGATION_BHB_CLEAR_EXIT_TO_USER:
/*
* Hypervisors can be attacked across-threads, warn for SMT when
* STIBP is not already enabled system-wide.