Re: [PATCH 5/7] x86/bugs: Only harden syscalls when needed

From: Ingo Molnar
Date: Fri Apr 12 2024 - 06:08:13 EST



* Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:

> > [...]
> > > @@ -1720,6 +1744,7 @@ static void __init spectre_v2_select_mitigation(void)
> > >
> > > case SPECTRE_V2_CMD_RETPOLINE_LFENCE:
> > > pr_err(SPECTRE_V2_LFENCE_MSG);
> > > + setup_clear_cpu_cap(X86_FEATURE_INDIRECT_SAFE);
> >
> > I don't know if it intentional, this seems to be the duplicate of
> > X86_FEATURE_INDIRECT_SAFE clear later in SPECTRE_V2_LFENCE mode. Also it
> > seems a bit odd to do this here in SPECTRE_V2_CMD handling.
>
> Yeah, I accidentally left that in from an earlier implementation. It's
> harmless but I'll clean that up too with a new patch unless Ingo wants to
> remove that line.

Lemme remove it entirely from x86/urgent, so that you can submit an updated
patch with all feedback included.

In addition to the above line, Pawan's suggestion of doing it in C via
cpu_feature_enabled() looks quite a bit simpler and easier to read & argue
about, right?

Thanks,

Ingo