linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 1/3] x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n
       [not found] ` <20240409175108.1512861-2-seanjc@google.com>
@ 2024-04-15 11:13   ` Geert Uytterhoeven
       [not found]   ` <20240413115324.53303a68@canb.auug.org.au>
  1 sibling, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2024-04-15 11:13 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: Jonathan Corbet, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, Peter Zijlstra, Josh Poimboeuf, linux-doc,
	linux-kernel, Pawan Gupta, Daniel Sneddon, Catalin Marinas,
	Will Deacon, Linux ARM, Linux-Renesas

Hi Sean,

On Tue, Apr 9, 2024 at 7:51 PM Sean Christopherson <seanjc@google.com> wrote:
> Initialize cpu_mitigations to CPU_MITIGATIONS_OFF if the kernel is built
> with CONFIG_SPECULATION_MITIGATIONS=n, as the help text quite clearly
> states that disabling SPECULATION_MITIGATIONS is supposed to turn off all
> mitigations by default.
>
>   │ If you say N, all mitigations will be disabled. You really
>   │ should know what you are doing to say so.
>
> As is, the kernel still defaults to CPU_MITIGATIONS_AUTO, which results in
> some mitigations being enabled in spite of SPECULATION_MITIGATIONS=n.
>
> Fixes: f43b9876e857 ("x86/retbleed: Add fine grained Kconfig knobs")
> Cc: stable@vger.kernel.org
> Signed-off-by: Sean Christopherson <seanjc@google.com>

Thanks for your patch, which is now commit f337a6a21e2fd67e
("x86/cpu: Actually turn off mitigations by default
for SPECULATION_MITIGATIONS=n") in v6.9-rc4.

This causes the following suspicious messages on R-Car H3:

        CPU features: kernel page table isolation forced OFF by mitigations=off
        spectre-v4 mitigation disabled by command-line option
        spectre-v2 mitigation disabled by command line option
        spectre-v2 mitigation disabled by command line option

and R-Car V4H:

        CPU features: kernel page table isolation forced OFF by mitigations=off
        spectre-v4 mitigation disabled by command-line option
        spectre-bhb mitigation disabled by command line option
        spectre-bhb mitigation disabled by command line option

Interestingly, no mitigations are disabled on the command-line.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n
       [not found]       ` <87bk6dd2l4.fsf@mail.lhotse>
@ 2024-04-15 11:16         ` Geert Uytterhoeven
  2024-04-15 14:31           ` Sean Christopherson
  0 siblings, 1 reply; 7+ messages in thread
From: Geert Uytterhoeven @ 2024-04-15 11:16 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Stephen Rothwell, Sean Christopherson, Jonathan Corbet,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	Peter Zijlstra, Josh Poimboeuf, linux-doc, linux-kernel,
	Pawan Gupta, Daniel Sneddon, linuxppc-dev, linux-arch,
	Catalin Marinas, Will Deacon, Heiko Carstens, Linux-Renesas

Hi Michael,

On Sat, Apr 13, 2024 at 11:38 AM Michael Ellerman <mpe@ellerman.id.au> wrote:
> Michael Ellerman <mpe@ellerman.id.au> writes:
> > Stephen Rothwell <sfr@canb.auug.org.au> writes:
> ...
> >> On Tue,  9 Apr 2024 10:51:05 -0700 Sean Christopherson <seanjc@google.com> wrote:
> ...
> >>> diff --git a/kernel/cpu.c b/kernel/cpu.c
> >>> index 8f6affd051f7..07ad53b7f119 100644
> >>> --- a/kernel/cpu.c
> >>> +++ b/kernel/cpu.c
> >>> @@ -3207,7 +3207,8 @@ enum cpu_mitigations {
> >>>  };
> >>>
> >>>  static enum cpu_mitigations cpu_mitigations __ro_after_init =
> >>> -   CPU_MITIGATIONS_AUTO;
> >>> +   IS_ENABLED(CONFIG_SPECULATION_MITIGATIONS) ? CPU_MITIGATIONS_AUTO :
> >>> +                                                CPU_MITIGATIONS_OFF;
> >>>
> >>>  static int __init mitigations_parse_cmdline(char *arg)
> >>>  {
>
> I think a minimal workaround/fix would be:
>
> diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
> index 2b8fd6bb7da0..290be2f9e909 100644
> --- a/drivers/base/Kconfig
> +++ b/drivers/base/Kconfig
> @@ -191,6 +191,10 @@ config GENERIC_CPU_AUTOPROBE
>  config GENERIC_CPU_VULNERABILITIES
>         bool
>
> +config SPECULATION_MITIGATIONS
> +       def_bool y
> +       depends on !X86
> +
>  config SOC_BUS
>         bool
>         select GLOB

Thanks, that works for me (on arm64), so
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n
  2024-04-15 11:16         ` Geert Uytterhoeven
@ 2024-04-15 14:31           ` Sean Christopherson
  2024-04-16 11:06             ` Michael Ellerman
  2024-04-19 14:03             ` Will Deacon
  0 siblings, 2 replies; 7+ messages in thread
From: Sean Christopherson @ 2024-04-15 14:31 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Michael Ellerman, Stephen Rothwell, Jonathan Corbet,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	Peter Zijlstra, Josh Poimboeuf, linux-doc, linux-kernel,
	Pawan Gupta, Daniel Sneddon, linuxppc-dev, linux-arch,
	Catalin Marinas, Will Deacon, Heiko Carstens, Linux-Renesas

On Mon, Apr 15, 2024, Geert Uytterhoeven wrote:
> Hi Michael,
> 
> On Sat, Apr 13, 2024 at 11:38 AM Michael Ellerman <mpe@ellerman.id.au> wrote:
> > Michael Ellerman <mpe@ellerman.id.au> writes:
> > > Stephen Rothwell <sfr@canb.auug.org.au> writes:
> > ...
> > >> On Tue,  9 Apr 2024 10:51:05 -0700 Sean Christopherson <seanjc@google.com> wrote:
> > ...
> > >>> diff --git a/kernel/cpu.c b/kernel/cpu.c
> > >>> index 8f6affd051f7..07ad53b7f119 100644
> > >>> --- a/kernel/cpu.c
> > >>> +++ b/kernel/cpu.c
> > >>> @@ -3207,7 +3207,8 @@ enum cpu_mitigations {
> > >>>  };
> > >>>
> > >>>  static enum cpu_mitigations cpu_mitigations __ro_after_init =
> > >>> -   CPU_MITIGATIONS_AUTO;
> > >>> +   IS_ENABLED(CONFIG_SPECULATION_MITIGATIONS) ? CPU_MITIGATIONS_AUTO :
> > >>> +                                                CPU_MITIGATIONS_OFF;
> > >>>
> > >>>  static int __init mitigations_parse_cmdline(char *arg)
> > >>>  {
> >
> > I think a minimal workaround/fix would be:
> >
> > diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
> > index 2b8fd6bb7da0..290be2f9e909 100644
> > --- a/drivers/base/Kconfig
> > +++ b/drivers/base/Kconfig
> > @@ -191,6 +191,10 @@ config GENERIC_CPU_AUTOPROBE
> >  config GENERIC_CPU_VULNERABILITIES
> >         bool
> >
> > +config SPECULATION_MITIGATIONS
> > +       def_bool y
> > +       depends on !X86
> > +
> >  config SOC_BUS
> >         bool
> >         select GLOB
> 
> Thanks, that works for me (on arm64), so
> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Oof.  I completely missed that "cpu_mitigations" wasn't x86-only.  I can't think
of better solution than an on-by-default generic Kconfig, though can't that it
more simply be:

diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index 2b8fd6bb7da0..5930cb56ee29 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -191,6 +191,9 @@ config GENERIC_CPU_AUTOPROBE
 config GENERIC_CPU_VULNERABILITIES
        bool
 
+config SPECULATION_MITIGATIONS
+       def_bool !X86
+
 config SOC_BUS
        bool
        select GLOB

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n
  2024-04-15 14:31           ` Sean Christopherson
@ 2024-04-16 11:06             ` Michael Ellerman
  2024-04-19 14:03             ` Will Deacon
  1 sibling, 0 replies; 7+ messages in thread
From: Michael Ellerman @ 2024-04-16 11:06 UTC (permalink / raw)
  To: Sean Christopherson, Geert Uytterhoeven
  Cc: Stephen Rothwell, Jonathan Corbet, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, Peter Zijlstra,
	Josh Poimboeuf, linux-doc, linux-kernel, Pawan Gupta,
	Daniel Sneddon, linuxppc-dev, linux-arch, Catalin Marinas,
	Will Deacon, Heiko Carstens, Linux-Renesas

Sean Christopherson <seanjc@google.com> writes:
> On Mon, Apr 15, 2024, Geert Uytterhoeven wrote:
>> On Sat, Apr 13, 2024 at 11:38 AM Michael Ellerman <mpe@ellerman.id.au> wrote:
>> > Michael Ellerman <mpe@ellerman.id.au> writes:
>> > > Stephen Rothwell <sfr@canb.auug.org.au> writes:
>> > ...
>> > >> On Tue,  9 Apr 2024 10:51:05 -0700 Sean Christopherson <seanjc@google.com> wrote:
>> > ...
>> > >>> diff --git a/kernel/cpu.c b/kernel/cpu.c
>> > >>> index 8f6affd051f7..07ad53b7f119 100644
>> > >>> --- a/kernel/cpu.c
>> > >>> +++ b/kernel/cpu.c
>> > >>> @@ -3207,7 +3207,8 @@ enum cpu_mitigations {
>> > >>>  };
>> > >>>
>> > >>>  static enum cpu_mitigations cpu_mitigations __ro_after_init =
>> > >>> -   CPU_MITIGATIONS_AUTO;
>> > >>> +   IS_ENABLED(CONFIG_SPECULATION_MITIGATIONS) ? CPU_MITIGATIONS_AUTO :
>> > >>> +                                                CPU_MITIGATIONS_OFF;
>> > >>>
>> > >>>  static int __init mitigations_parse_cmdline(char *arg)
>> > >>>  {
>> >
>> > I think a minimal workaround/fix would be:
>> >
>> > diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
>> > index 2b8fd6bb7da0..290be2f9e909 100644
>> > --- a/drivers/base/Kconfig
>> > +++ b/drivers/base/Kconfig
>> > @@ -191,6 +191,10 @@ config GENERIC_CPU_AUTOPROBE
>> >  config GENERIC_CPU_VULNERABILITIES
>> >         bool
>> >
>> > +config SPECULATION_MITIGATIONS
>> > +       def_bool y
>> > +       depends on !X86
>> > +
>> >  config SOC_BUS
>> >         bool
>> >         select GLOB
>> 
>> Thanks, that works for me (on arm64), so
>> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> Oof.  I completely missed that "cpu_mitigations" wasn't x86-only.  I can't think
> of better solution than an on-by-default generic Kconfig, though can't that it
> more simply be:
>
> diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
> index 2b8fd6bb7da0..5930cb56ee29 100644
> --- a/drivers/base/Kconfig
> +++ b/drivers/base/Kconfig
> @@ -191,6 +191,9 @@ config GENERIC_CPU_AUTOPROBE
>  config GENERIC_CPU_VULNERABILITIES
>         bool
>  
> +config SPECULATION_MITIGATIONS
> +       def_bool !X86
> +

Yeah that works too.

cheers

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n
  2024-04-15 14:31           ` Sean Christopherson
  2024-04-16 11:06             ` Michael Ellerman
@ 2024-04-19 14:03             ` Will Deacon
  2024-04-19 14:06               ` Sean Christopherson
  1 sibling, 1 reply; 7+ messages in thread
From: Will Deacon @ 2024-04-19 14:03 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: Geert Uytterhoeven, Michael Ellerman, Stephen Rothwell,
	Jonathan Corbet, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, Peter Zijlstra, Josh Poimboeuf, linux-doc,
	linux-kernel, Pawan Gupta, Daniel Sneddon, linuxppc-dev,
	linux-arch, Catalin Marinas, Heiko Carstens, Linux-Renesas

On Mon, Apr 15, 2024 at 07:31:23AM -0700, Sean Christopherson wrote:
> On Mon, Apr 15, 2024, Geert Uytterhoeven wrote:
> > On Sat, Apr 13, 2024 at 11:38 AM Michael Ellerman <mpe@ellerman.id.au> wrote:
> > > Michael Ellerman <mpe@ellerman.id.au> writes:
> > > > Stephen Rothwell <sfr@canb.auug.org.au> writes:
> > > ...
> > > >> On Tue,  9 Apr 2024 10:51:05 -0700 Sean Christopherson <seanjc@google.com> wrote:
> > > ...
> > > >>> diff --git a/kernel/cpu.c b/kernel/cpu.c
> > > >>> index 8f6affd051f7..07ad53b7f119 100644
> > > >>> --- a/kernel/cpu.c
> > > >>> +++ b/kernel/cpu.c
> > > >>> @@ -3207,7 +3207,8 @@ enum cpu_mitigations {
> > > >>>  };
> > > >>>
> > > >>>  static enum cpu_mitigations cpu_mitigations __ro_after_init =
> > > >>> -   CPU_MITIGATIONS_AUTO;
> > > >>> +   IS_ENABLED(CONFIG_SPECULATION_MITIGATIONS) ? CPU_MITIGATIONS_AUTO :
> > > >>> +                                                CPU_MITIGATIONS_OFF;
> > > >>>
> > > >>>  static int __init mitigations_parse_cmdline(char *arg)
> > > >>>  {
> > >
> > > I think a minimal workaround/fix would be:
> > >
> > > diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
> > > index 2b8fd6bb7da0..290be2f9e909 100644
> > > --- a/drivers/base/Kconfig
> > > +++ b/drivers/base/Kconfig
> > > @@ -191,6 +191,10 @@ config GENERIC_CPU_AUTOPROBE
> > >  config GENERIC_CPU_VULNERABILITIES
> > >         bool
> > >
> > > +config SPECULATION_MITIGATIONS
> > > +       def_bool y
> > > +       depends on !X86
> > > +
> > >  config SOC_BUS
> > >         bool
> > >         select GLOB
> > 
> > Thanks, that works for me (on arm64), so
> > Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> Oof.  I completely missed that "cpu_mitigations" wasn't x86-only.  I can't think
> of better solution than an on-by-default generic Kconfig, though can't that it
> more simply be:
> 
> diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
> index 2b8fd6bb7da0..5930cb56ee29 100644
> --- a/drivers/base/Kconfig
> +++ b/drivers/base/Kconfig
> @@ -191,6 +191,9 @@ config GENERIC_CPU_AUTOPROBE
>  config GENERIC_CPU_VULNERABILITIES
>         bool
>  
> +config SPECULATION_MITIGATIONS
> +       def_bool !X86
> +
>  config SOC_BUS
>         bool
>         select GLOB

I can't see this in -next yet. Do you plan to post it as a proper patch
to collect acks etc?

Cheers,

Will

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n
  2024-04-19 14:03             ` Will Deacon
@ 2024-04-19 14:06               ` Sean Christopherson
  2024-04-19 14:38                 ` Will Deacon
  0 siblings, 1 reply; 7+ messages in thread
From: Sean Christopherson @ 2024-04-19 14:06 UTC (permalink / raw)
  To: Will Deacon
  Cc: Geert Uytterhoeven, Michael Ellerman, Stephen Rothwell,
	Jonathan Corbet, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, Peter Zijlstra, Josh Poimboeuf, linux-doc,
	linux-kernel, Pawan Gupta, Daniel Sneddon, linuxppc-dev,
	linux-arch, Catalin Marinas, Heiko Carstens, Linux-Renesas

On Fri, Apr 19, 2024, Will Deacon wrote:
> On Mon, Apr 15, 2024 at 07:31:23AM -0700, Sean Christopherson wrote:
> > On Mon, Apr 15, 2024, Geert Uytterhoeven wrote:
> > Oof.  I completely missed that "cpu_mitigations" wasn't x86-only.  I can't think
> > of better solution than an on-by-default generic Kconfig, though can't that it
> > more simply be:
> > 
> > diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
> > index 2b8fd6bb7da0..5930cb56ee29 100644
> > --- a/drivers/base/Kconfig
> > +++ b/drivers/base/Kconfig
> > @@ -191,6 +191,9 @@ config GENERIC_CPU_AUTOPROBE
> >  config GENERIC_CPU_VULNERABILITIES
> >         bool
> >  
> > +config SPECULATION_MITIGATIONS
> > +       def_bool !X86
> > +
> >  config SOC_BUS
> >         bool
> >         select GLOB
> 
> I can't see this in -next yet. Do you plan to post it as a proper patch
> to collect acks etc?

Sorry, I neglected to Cc everyone.

https://lore.kernel.org/all/20240417001507.2264512-2-seanjc@google.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n
  2024-04-19 14:06               ` Sean Christopherson
@ 2024-04-19 14:38                 ` Will Deacon
  0 siblings, 0 replies; 7+ messages in thread
From: Will Deacon @ 2024-04-19 14:38 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: Geert Uytterhoeven, Michael Ellerman, Stephen Rothwell,
	Jonathan Corbet, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, Peter Zijlstra, Josh Poimboeuf, linux-doc,
	linux-kernel, Pawan Gupta, Daniel Sneddon, linuxppc-dev,
	linux-arch, Catalin Marinas, Heiko Carstens, Linux-Renesas

On Fri, Apr 19, 2024 at 07:06:00AM -0700, Sean Christopherson wrote:
> On Fri, Apr 19, 2024, Will Deacon wrote:
> > On Mon, Apr 15, 2024 at 07:31:23AM -0700, Sean Christopherson wrote:
> > > On Mon, Apr 15, 2024, Geert Uytterhoeven wrote:
> > > Oof.  I completely missed that "cpu_mitigations" wasn't x86-only.  I can't think
> > > of better solution than an on-by-default generic Kconfig, though can't that it
> > > more simply be:
> > > 
> > > diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
> > > index 2b8fd6bb7da0..5930cb56ee29 100644
> > > --- a/drivers/base/Kconfig
> > > +++ b/drivers/base/Kconfig
> > > @@ -191,6 +191,9 @@ config GENERIC_CPU_AUTOPROBE
> > >  config GENERIC_CPU_VULNERABILITIES
> > >         bool
> > >  
> > > +config SPECULATION_MITIGATIONS
> > > +       def_bool !X86
> > > +
> > >  config SOC_BUS
> > >         bool
> > >         select GLOB
> > 
> > I can't see this in -next yet. Do you plan to post it as a proper patch
> > to collect acks etc?
> 
> Sorry, I neglected to Cc everyone.
> 
> https://lore.kernel.org/all/20240417001507.2264512-2-seanjc@google.com

Ah, thanks. I'll go Ack that...

Will

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-19 14:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20240409175108.1512861-1-seanjc@google.com>
     [not found] ` <20240409175108.1512861-2-seanjc@google.com>
2024-04-15 11:13   ` [PATCH 1/3] x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n Geert Uytterhoeven
     [not found]   ` <20240413115324.53303a68@canb.auug.org.au>
     [not found]     ` <87edb9d33r.fsf@mail.lhotse>
     [not found]       ` <87bk6dd2l4.fsf@mail.lhotse>
2024-04-15 11:16         ` Geert Uytterhoeven
2024-04-15 14:31           ` Sean Christopherson
2024-04-16 11:06             ` Michael Ellerman
2024-04-19 14:03             ` Will Deacon
2024-04-19 14:06               ` Sean Christopherson
2024-04-19 14:38                 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).