Re: [PATCH] x86/bugs: Keep BHI mitigation when only user->kernel is mitigated

From: Borislav Petkov

Date: Fri Oct 30 2026 - 00:04:50 EST


On Thu, Oct 29, 2026 at 07:45:03AM -0700, Breno Leitao wrote:
> The BHI mitigation selection is inconsistent with the documentation
> (attack_vector_controls.rst), which lists BHI under both the
> user->kernel and guest->host attack vectors. bhi_select_mitigation()
> only enables it when CPU_MITIGATE_GUEST_HOST is set; otherwise it
> selects BHI_MITIGATION_OFF, even if CPU_MITIGATE_USER_KERNEL is set.
>
> As a result, a kernel compiled with KVM disabled gets BHI automatically
> disabled, since CPU_MITIGATE_GUEST_HOST defaults to off without KVM.
> This is a bug, given that CPU_MITIGATE_USER_KERNEL still needs it: on
> affected Intel CPUs these kernels lose BHI_DIS_S or the BHB clearing
> loop by default. Booting with mitigations=auto,no_guest_host has the
> same effect.
>
> Select BHI_MITIGATION_ON whenever user->kernel is mitigated, and keep
> BHI_MITIGATION_VMEXIT_ONLY for the guest->host-only case.
>
> Fixes: ddcd4d3cb37c ("x86/bugs: Add attack vector controls for BHI")
> Cc: David Kaplan <david.kaplan@xxxxxxx>
> Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
> ---
> arch/x86/kernel/cpu/bugs.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)

Queued, thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette