Re: [PATCH v2 1/4] x86/bugs: Add SRSO_USER_KERNEL_NO support

Josh Poimboeuf
2024-12-10T06:53:33Z

On Mon, Dec 02, 2024 at 01:04:13PM +0100, Borislav Petkov wrote:
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -2615,6 +2615,11 @@ static void __init srso_select_mitigation(void)
> break;
>
> case SRSO_CMD_SAFE_RET:
> + if (boot_cpu_has(X86_FEATURE_SRSO_USER_KERNEL_NO)) {
> + pr_notice("CPU user/kernel transitions protected, falling back to IBPB-on-VMEXIT\n");
> + goto ibpb_on_vmexit;

The presence of SRSO_USER_KERNEL_NO should indeed change the default,
but if the user requests "safe_ret" specifically, shouldn't we give it
to them? That would be more consistent with how we handle requested
mitigations.

Also it doesn't really make sense to add a printk here as the mitigation
will be printed at the end of the function.

--
Josh