[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240209203346.gwbfyx3huiaozg4s@desk>
Date: Fri, 9 Feb 2024 12:33:46 -0800
From: Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>, Borislav Petkov <bp@...en8.de>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
Daniel Sneddon <daniel.sneddon@...ux.intel.com>,
antonio.gomez.iglesias@...ux.intel.com,
alyssa.milburn@...ux.intel.com, andrew.cooper3@...rix.com,
linux-kernel@...r.kernel.org,
Alyssa Milburn <alyssa.milburn@...el.com>
Subject: Re: [PATCH] x86/bugs: Default retbleed to =stuff when retpoline is
auto enabled
Hi Josh / Borislav,
On Fri, Feb 09, 2024 at 10:56:25AM -0800, Josh Poimboeuf wrote:
> On Thu, Feb 08, 2024 at 05:12:15PM -0800, Pawan Gupta wrote:
> > @@ -1025,10 +1041,17 @@ static void __init retbleed_select_mitigation(void)
> > retbleed_mitigation = RETBLEED_MITIGATION_UNRET;
> > else if (IS_ENABLED(CONFIG_CPU_IBPB_ENTRY) && boot_cpu_has(X86_FEATURE_IBPB))
> > retbleed_mitigation = RETBLEED_MITIGATION_IBPB;
> > + } else if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
> > + spectre_v2_parse_cmdline() == SPECTRE_V2_CMD_AUTO &&
>
> spectre_v2_parse_cmdline() has side effects (printks) and shouldn't be
> called twice.
>
> And what's the point of checking spectre_v2= anyway? Shouldn't retbleed
> be mitigated by default, independently of whatever the user may have
> specified for Spectre v2?
@Borislav, what do you think about this approach?
> > + spectre_v2_enabled == SPECTRE_V2_RETPOLINE) {
> > + if (IS_ENABLED(CONFIG_CALL_DEPTH_TRACKING))
> > + retbleed_mitigation = RETBLEED_MITIGATION_STUFF;
> > + else
> > + pr_err("WARNING: Retpoline enabled, but kernel not compiled with CALL_DEPTH_TRACKING.\n");
>
> If retbleed is vulnerable then the sysfs file should show that.
It does shows vulnerable, retbleed_mitigation is not set to
RETBLEED_MITIGATION_STUFF for CONFIG_CALL_DEPTH_TRACKING=n.
> Also, I think this pr_err() is redundant with RETBLEED_INTEL_MSG and can
> be removed.
IMO, they both serve a different purpose, RETBLEED_INTEL_MSG is a
generic warning, and the message with !CONFIG_CALL_DEPTH_TRACKING hints
a corrective action.
If you look at "case RETBLEED_CMD_STUFF" it also prints a separate warning for
!CONFIG_CALL_DEPTH_TRACKING:
case RETBLEED_CMD_STUFF:
if (IS_ENABLED(CONFIG_CALL_DEPTH_TRACKING) &&
spectre_v2_enabled == SPECTRE_V2_RETPOLINE) {
retbleed_mitigation = RETBLEED_MITIGATION_STUFF;
} else {
if (IS_ENABLED(CONFIG_CALL_DEPTH_TRACKING))
pr_err("WARNING: retbleed=stuff depends on spectre_v2=retpoline\n");
else
pr_err("WARNING: kernel not compiled with CALL_DEPTH_TRACKING.\n");
Powered by blists - more mailing lists