diff mbox series

[v3,1/4] x86/spec: print the built-in SPECULATIVE_HARDEN_* options

Message ID 20240226110748.80254-2-roger.pau@citrix.com (mailing list archive)
State New
Headers show
Series x86/spec: improve command line parsing | expand

Commit Message

Roger Pau Monné Feb. 26, 2024, 11:07 a.m. UTC
Just like it's done for INDIRECT_THUNK and SHADOW_PAGING.

Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Changes since v2:
 - New in this version.
---
 xen/arch/x86/spec_ctrl.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Comments

Jan Beulich Feb. 26, 2024, 12:39 p.m. UTC | #1
On 26.02.2024 12:07, Roger Pau Monne wrote:
> Just like it's done for INDIRECT_THUNK and SHADOW_PAGING.
> 
> Reported-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

In principle
Reviewed-by: Jan Beulich <jbeulich@suse.com>
but ...

> --- a/xen/arch/x86/spec_ctrl.c
> +++ b/xen/arch/x86/spec_ctrl.c
> @@ -466,13 +466,25 @@ static void __init print_details(enum ind_thunk thunk)
>             (e21a & cpufeat_mask(X86_FEATURE_SBPB))           ? " SBPB"           : "");
>  
>      /* Compiled-in support which pertains to mitigations. */
> -    if ( IS_ENABLED(CONFIG_INDIRECT_THUNK) || IS_ENABLED(CONFIG_SHADOW_PAGING) )
> +    if ( IS_ENABLED(CONFIG_INDIRECT_THUNK) || IS_ENABLED(CONFIG_SHADOW_PAGING) ||
> +         IS_ENABLED(CONFIG_SPECULATIVE_HARDEN_ARRAY) ||
> +         IS_ENABLED(CONFIG_SPECULATIVE_HARDEN_BRANCH) ||
> +         IS_ENABLED(CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS) )
>          printk("  Compiled-in support:"
>  #ifdef CONFIG_INDIRECT_THUNK
>                 " INDIRECT_THUNK"
>  #endif
>  #ifdef CONFIG_SHADOW_PAGING
>                 " SHADOW_PAGING"
> +#endif
> +#ifdef CONFIG_SPECULATIVE_HARDEN_ARRAY
> +               " SPECULATIVE_HARDEN_ARRAY"
> +#endif
> +#ifdef CONFIG_SPECULATIVE_HARDEN_BRANCH
> +               " SPECULATIVE_HARDEN_BRANCH"
> +#endif
> +#ifdef CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS
> +               " SPECULATIVE_HARDEN_GUEST_ACCESS"
>  #endif

... I'd like to suggest to drop the SPECULATIVE_ from the string literals.
They're relevant in the Kconfig identifiers, but they're imo redundant in
the context of these log messages. (Happy to adjust while committing, if
need be.)

Jan
Roger Pau Monné Feb. 27, 2024, 11:13 a.m. UTC | #2
On Mon, Feb 26, 2024 at 01:39:49PM +0100, Jan Beulich wrote:
> On 26.02.2024 12:07, Roger Pau Monne wrote:
> > Just like it's done for INDIRECT_THUNK and SHADOW_PAGING.
> > 
> > Reported-by: Jan Beulich <jbeulich@suse.com>
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> 
> In principle
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> but ...
> 
> > --- a/xen/arch/x86/spec_ctrl.c
> > +++ b/xen/arch/x86/spec_ctrl.c
> > @@ -466,13 +466,25 @@ static void __init print_details(enum ind_thunk thunk)
> >             (e21a & cpufeat_mask(X86_FEATURE_SBPB))           ? " SBPB"           : "");
> >  
> >      /* Compiled-in support which pertains to mitigations. */
> > -    if ( IS_ENABLED(CONFIG_INDIRECT_THUNK) || IS_ENABLED(CONFIG_SHADOW_PAGING) )
> > +    if ( IS_ENABLED(CONFIG_INDIRECT_THUNK) || IS_ENABLED(CONFIG_SHADOW_PAGING) ||
> > +         IS_ENABLED(CONFIG_SPECULATIVE_HARDEN_ARRAY) ||
> > +         IS_ENABLED(CONFIG_SPECULATIVE_HARDEN_BRANCH) ||
> > +         IS_ENABLED(CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS) )
> >          printk("  Compiled-in support:"
> >  #ifdef CONFIG_INDIRECT_THUNK
> >                 " INDIRECT_THUNK"
> >  #endif
> >  #ifdef CONFIG_SHADOW_PAGING
> >                 " SHADOW_PAGING"
> > +#endif
> > +#ifdef CONFIG_SPECULATIVE_HARDEN_ARRAY
> > +               " SPECULATIVE_HARDEN_ARRAY"
> > +#endif
> > +#ifdef CONFIG_SPECULATIVE_HARDEN_BRANCH
> > +               " SPECULATIVE_HARDEN_BRANCH"
> > +#endif
> > +#ifdef CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS
> > +               " SPECULATIVE_HARDEN_GUEST_ACCESS"
> >  #endif
> 
> ... I'd like to suggest to drop the SPECULATIVE_ from the string literals.
> They're relevant in the Kconfig identifiers, but they're imo redundant in
> the context of these log messages. (Happy to adjust while committing, if
> need be.)

Oh, yes, indeed, we already print HARDEN_BRANCH instead of
SPECULATIVE_HARDEN_BRANCH.  Please adjust at commit if you don't mind.

Thanks, Roger.
diff mbox series

Patch

diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 421fe3f640df..9f5ed8772533 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -466,13 +466,25 @@  static void __init print_details(enum ind_thunk thunk)
            (e21a & cpufeat_mask(X86_FEATURE_SBPB))           ? " SBPB"           : "");
 
     /* Compiled-in support which pertains to mitigations. */
-    if ( IS_ENABLED(CONFIG_INDIRECT_THUNK) || IS_ENABLED(CONFIG_SHADOW_PAGING) )
+    if ( IS_ENABLED(CONFIG_INDIRECT_THUNK) || IS_ENABLED(CONFIG_SHADOW_PAGING) ||
+         IS_ENABLED(CONFIG_SPECULATIVE_HARDEN_ARRAY) ||
+         IS_ENABLED(CONFIG_SPECULATIVE_HARDEN_BRANCH) ||
+         IS_ENABLED(CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS) )
         printk("  Compiled-in support:"
 #ifdef CONFIG_INDIRECT_THUNK
                " INDIRECT_THUNK"
 #endif
 #ifdef CONFIG_SHADOW_PAGING
                " SHADOW_PAGING"
+#endif
+#ifdef CONFIG_SPECULATIVE_HARDEN_ARRAY
+               " SPECULATIVE_HARDEN_ARRAY"
+#endif
+#ifdef CONFIG_SPECULATIVE_HARDEN_BRANCH
+               " SPECULATIVE_HARDEN_BRANCH"
+#endif
+#ifdef CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS
+               " SPECULATIVE_HARDEN_GUEST_ACCESS"
 #endif
                "\n");