[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<LV3PR12MB92652AE4AC9BECE03874409B9438A@LV3PR12MB9265.namprd12.prod.outlook.com>
Date: Wed, 27 Aug 2025 21:59:03 +0000
From: "Kaplan, David" <David.Kaplan@....com>
To: Josh Poimboeuf <jpoimboe@...nel.org>
CC: Thomas Gleixner <tglx@...utronix.de>, Borislav Petkov <bp@...en8.de>,
Peter Zijlstra <peterz@...radead.org>, Pawan Gupta
<pawan.kumar.gupta@...ux.intel.com>, Ingo Molnar <mingo@...hat.com>, Dave
Hansen <dave.hansen@...ux.intel.com>, "x86@...nel.org" <x86@...nel.org>, "H .
Peter Anvin" <hpa@...or.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2 1/5] x86/bugs: Use early_param for spectre_v2_user
[AMD Official Use Only - AMD Internal Distribution Only]
> -----Original Message-----
> From: Josh Poimboeuf <jpoimboe@...nel.org>
> Sent: Wednesday, August 27, 2025 4:52 PM
> To: Kaplan, David <David.Kaplan@....com>
> Cc: Thomas Gleixner <tglx@...utronix.de>; Borislav Petkov <bp@...en8.de>; Peter
> Zijlstra <peterz@...radead.org>; Pawan Gupta
> <pawan.kumar.gupta@...ux.intel.com>; Ingo Molnar <mingo@...hat.com>; Dave
> Hansen <dave.hansen@...ux.intel.com>; x86@...nel.org; H . Peter Anvin
> <hpa@...or.com>; linux-kernel@...r.kernel.org
> Subject: Re: [PATCH v2 1/5] x86/bugs: Use early_param for spectre_v2_user
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Tue, Aug 19, 2025 at 02:21:56PM -0500, David Kaplan wrote:
> > +++ b/arch/x86/kernel/cpu/bugs.c
> > @@ -1826,7 +1826,7 @@ enum spectre_v2_mitigation_cmd {
> >
> > static enum spectre_v2_mitigation_cmd spectre_v2_cmd __ro_after_init =
> SPECTRE_V2_CMD_AUTO;
> >
> > -enum spectre_v2_user_cmd {
> > +enum spectre_v2_user_mitigation_cmd {
> > SPECTRE_V2_USER_CMD_NONE,
> > SPECTRE_V2_USER_CMD_AUTO,
> > SPECTRE_V2_USER_CMD_FORCE,
> > @@ -1836,6 +1836,9 @@ enum spectre_v2_user_cmd {
> > SPECTRE_V2_USER_CMD_SECCOMP_IBPB,
> > };
> >
> > +static enum spectre_v2_user_mitigation_cmd spectre_v2_user_cmd
> __ro_after_init =
> > + SPECTRE_V2_USER_CMD_AUTO;
>
> Should this default not be dependent on CONFIG_MITIGATION_SPECTRE_V2?
Ah, good catch. Yes, it should be looking at that.
>
> > -static enum spectre_v2_user_cmd __init spectre_v2_parse_user_cmdline(void)
> > +static int __init spectre_v2_parse_user_cmdline(char *str)
>
> Should probably swap "parse" and "user" to match the namespace of the
> surrounding code, i.e. spectre_v2_user_parse_cmdline(). This is for
> parsing the "spectre_v2_user" option after all.
Ok
>
> > {
> > - char arg[20];
> > - int ret, i;
> > + if (!str)
> > + return -EINVAL;
> >
> > if (!IS_ENABLED(CONFIG_MITIGATION_SPECTRE_V2))
> > return SPECTRE_V2_USER_CMD_NONE;
>
> This return value no longer makes sense here, as this no longer returns
> 'enum spectre_v2_user_cmd'.
Yeah, this should be removed. And the check should be in the initialization as noted above.
>
> But also, most of the other mitigations allow you to override the
> compile time default with the cmdline. Might as well allow that here
> too for consistency.
>
Agreed, and with the check removed that should happen correctly.
Thanks
--David Kaplan
Powered by blists - more mailing lists