Re: [Patch v5 11/16] x86/speculation: Add Spectre v2 app to app protection modes

From: Jiri Kosina
Date: Mon Nov 19 2018 - 15:55:39 EST


On Mon, 19 Nov 2018, Thomas Gleixner wrote:

> > @@ -452,12 +542,6 @@ static void __init spectre_v2_select_mitigation(void)
> > setup_force_cpu_cap(X86_FEATURE_RSB_CTXSW);
> > pr_info("Spectre v2 / SpectreRSB mitigation: Filling RSB on context switch\n");
> >
> > - /* Initialize Indirect Branch Prediction Barrier if supported */
> > - if (boot_cpu_has(X86_FEATURE_IBPB)) {
> > - setup_force_cpu_cap(X86_FEATURE_USE_IBPB);
> > - pr_info("Spectre v2 mitigation: Enabling Indirect Branch Prediction Barrier\n");
> > - }
> > -
> > /*
> > * Retpoline means the kernel is safe because it has no indirect
> > * branches. Enhanced IBRS protects firmware too, so, enable restricted
> > @@ -474,6 +558,43 @@ static void __init spectre_v2_select_mitigation(void)
> > pr_info("Enabling Restricted Speculation for firmware calls\n");
> > }
> >
> > + app2app_mode = SPECTRE_V2_APP2APP_NONE;
> > + if (!boot_cpu_has(X86_FEATURE_IBPB) ||
> > + !boot_cpu_has(X86_FEATURE_STIBP))
> > + goto set_app2app_mode;
>
> So before that change IBPB was usable without STIBP, now not longer. What's
> the rationale?
>
> This patch changes a gazillion things at once and is completely
> unreviewable.

The patchset actually ties together IBPB and STIBP pretty closely, which
is IMO a good thing; there is no good reason why anone would want just one
of those (or each in a different mode), at least before this magical
coscheduling exists.

But I guess this fact should be documented somewhere.

--
Jiri Kosina
SUSE Labs