linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/its: Warn when microcode is old
@ 2025-06-12  0:08 Pawan Gupta
  2025-06-12  6:34 ` Sohil Mehta
  2025-06-12  6:58 ` Nikolay Borisov
  0 siblings, 2 replies; 6+ messages in thread
From: Pawan Gupta @ 2025-06-12  0:08 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Borislav Petkov, Josh Poimboeuf

A microcode update is required for IBPB to be effective against ITS. On
Intel, X86_BUG_OLD_MICROCODE is set already when old microcode is detected.
In such a case system is tainted and a warning is issued.

Also warn that userspace could be vulnerable to ITS.

Suggested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
---
 arch/x86/kernel/cpu/bugs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 7f94e6a5497d9a2d312a76095e48d6b364565777..7aa3ae00e6b4daa5e42217b66c50cd46d6bcc115 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -1427,6 +1427,10 @@ static void __init its_select_mitigation(void)
 		return;
 	}
 
+	/* For IBPB to be effective against ITS */
+	if (boot_cpu_has_bug(X86_BUG_OLD_MICROCODE))
+		pr_warn("Old microcode, userspace may be vulnerable to ITS\n");
+
 	if (its_mitigation == ITS_MITIGATION_RETPOLINE_STUFF &&
 	    !IS_ENABLED(CONFIG_MITIGATION_CALL_DEPTH_TRACKING)) {
 		pr_err("RSB stuff mitigation not supported, using default\n");

---
base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
change-id: 20250611-its-warn-b292b10896e3

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

* Re: [PATCH] x86/its: Warn when microcode is old
  2025-06-12  0:08 [PATCH] x86/its: Warn when microcode is old Pawan Gupta
@ 2025-06-12  6:34 ` Sohil Mehta
  2025-06-12 13:19   ` Pawan Gupta
  2025-06-12  6:58 ` Nikolay Borisov
  1 sibling, 1 reply; 6+ messages in thread
From: Sohil Mehta @ 2025-06-12  6:34 UTC (permalink / raw)
  To: Pawan Gupta, x86
  Cc: linux-kernel, Borislav Petkov, Josh Poimboeuf, Dave Hansen

On 6/11/2025 5:08 PM, Pawan Gupta wrote:
> A microcode update is required for IBPB to be effective against ITS. On
> Intel, X86_BUG_OLD_MICROCODE is set already when old microcode is detected.
> In such a case system is tainted and a warning is issued.
> 
> Also warn that userspace could be vulnerable to ITS.
> 
> Suggested-by: Borislav Petkov <bp@alien8.de>
> Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
> ---
>  arch/x86/kernel/cpu/bugs.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index 7f94e6a5497d9a2d312a76095e48d6b364565777..7aa3ae00e6b4daa5e42217b66c50cd46d6bcc115 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -1427,6 +1427,10 @@ static void __init its_select_mitigation(void)
>  		return;
>  	}
>  
> +	/* For IBPB to be effective against ITS */
> +	if (boot_cpu_has_bug(X86_BUG_OLD_MICROCODE))
> +		pr_warn("Old microcode, userspace may be vulnerable to ITS\n");
> +

Maybe I am missing something, but isn't "old" supposed to be an evolving
thing? I am not sure how old microcode can reliably (always) translate
to not effective against ITS.

Can you please provide more context? I feel the warning could be
misleading for userspace.



>  	if (its_mitigation == ITS_MITIGATION_RETPOLINE_STUFF &&
>  	    !IS_ENABLED(CONFIG_MITIGATION_CALL_DEPTH_TRACKING)) {
>  		pr_err("RSB stuff mitigation not supported, using default\n");
> 
> ---
> base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
> change-id: 20250611-its-warn-b292b10896e3
> 


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

* Re: [PATCH] x86/its: Warn when microcode is old
  2025-06-12  0:08 [PATCH] x86/its: Warn when microcode is old Pawan Gupta
  2025-06-12  6:34 ` Sohil Mehta
@ 2025-06-12  6:58 ` Nikolay Borisov
  2025-06-12 13:22   ` Pawan Gupta
  1 sibling, 1 reply; 6+ messages in thread
From: Nikolay Borisov @ 2025-06-12  6:58 UTC (permalink / raw)
  To: Pawan Gupta, x86; +Cc: linux-kernel, Borislav Petkov, Josh Poimboeuf



On 6/12/25 03:08, Pawan Gupta wrote:
> A microcode update is required for IBPB to be effective against ITS. On
> Intel, X86_BUG_OLD_MICROCODE is set already when old microcode is detected.
> In such a case system is tainted and a warning is issued.
> 
> Also warn that userspace could be vulnerable to ITS.
> 
> Suggested-by: Borislav Petkov <bp@alien8.de>
> Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
> ---
>   arch/x86/kernel/cpu/bugs.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index 7f94e6a5497d9a2d312a76095e48d6b364565777..7aa3ae00e6b4daa5e42217b66c50cd46d6bcc115 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -1427,6 +1427,10 @@ static void __init its_select_mitigation(void)
>   		return;
>   	}
>   
> +	/* For IBPB to be effective against ITS */
> +	if (boot_cpu_has_bug(X86_BUG_OLD_MICROCODE))
> +		pr_warn("Old microcode, userspace may be vulnerable to ITS\n");
> +

That check is too coarse and probably has a high chance of false 
positive, i.e

Latest firmware for your CPU is version Z as defined in 
intel-ucode-defs.h, current running version is X which is older than Z , 
but it already contains IBPB fixups for ITS. Then it will trigger a 
false positive.

>   	if (its_mitigation == ITS_MITIGATION_RETPOLINE_STUFF &&
>   	    !IS_ENABLED(CONFIG_MITIGATION_CALL_DEPTH_TRACKING)) {
>   		pr_err("RSB stuff mitigation not supported, using default\n");
> 
> ---
> base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
> change-id: 20250611-its-warn-b292b10896e3
> 


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

* Re: [PATCH] x86/its: Warn when microcode is old
  2025-06-12  6:34 ` Sohil Mehta
@ 2025-06-12 13:19   ` Pawan Gupta
  2025-06-12 13:31     ` Dave Hansen
  0 siblings, 1 reply; 6+ messages in thread
From: Pawan Gupta @ 2025-06-12 13:19 UTC (permalink / raw)
  To: Sohil Mehta
  Cc: x86, linux-kernel, Borislav Petkov, Josh Poimboeuf, Dave Hansen

On Wed, Jun 11, 2025 at 11:34:04PM -0700, Sohil Mehta wrote:
> On 6/11/2025 5:08 PM, Pawan Gupta wrote:
> > A microcode update is required for IBPB to be effective against ITS. On
> > Intel, X86_BUG_OLD_MICROCODE is set already when old microcode is detected.
> > In such a case system is tainted and a warning is issued.
> > 
> > Also warn that userspace could be vulnerable to ITS.
> > 
> > Suggested-by: Borislav Petkov <bp@alien8.de>
> > Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
> > ---
> >  arch/x86/kernel/cpu/bugs.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> > index 7f94e6a5497d9a2d312a76095e48d6b364565777..7aa3ae00e6b4daa5e42217b66c50cd46d6bcc115 100644
> > --- a/arch/x86/kernel/cpu/bugs.c
> > +++ b/arch/x86/kernel/cpu/bugs.c
> > @@ -1427,6 +1427,10 @@ static void __init its_select_mitigation(void)
> >  		return;
> >  	}
> >  
> > +	/* For IBPB to be effective against ITS */
> > +	if (boot_cpu_has_bug(X86_BUG_OLD_MICROCODE))
> > +		pr_warn("Old microcode, userspace may be vulnerable to ITS\n");
> > +
> 
> Maybe I am missing something, but isn't "old" supposed to be an evolving
> thing? I am not sure how old microcode can reliably (always) translate
> to not effective against ITS.

Yes, "old" does not always means vulnerable. Looks like "... *may* be
vulnerable" is too subtle here.

> Can you please provide more context? I feel the warning could be
> misleading for userspace.

Since the ITS software mitigation does not depend on the microcode, there
is no enumeration. Hence, hitch-hiking on the existing X86_BUG_OLD_MICROCODE.

On a second thought, cpu_set_bug_bits() already issues a warning, and even
taints the kernel when old microcode is detected. So warning here seems
redundant, and also misleading as you said. I am okay dropping this patch.

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

* Re: [PATCH] x86/its: Warn when microcode is old
  2025-06-12  6:58 ` Nikolay Borisov
@ 2025-06-12 13:22   ` Pawan Gupta
  0 siblings, 0 replies; 6+ messages in thread
From: Pawan Gupta @ 2025-06-12 13:22 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: x86, linux-kernel, Borislav Petkov, Josh Poimboeuf

On Thu, Jun 12, 2025 at 09:58:35AM +0300, Nikolay Borisov wrote:
> 
> 
> On 6/12/25 03:08, Pawan Gupta wrote:
> > A microcode update is required for IBPB to be effective against ITS. On
> > Intel, X86_BUG_OLD_MICROCODE is set already when old microcode is detected.
> > In such a case system is tainted and a warning is issued.
> > 
> > Also warn that userspace could be vulnerable to ITS.
> > 
> > Suggested-by: Borislav Petkov <bp@alien8.de>
> > Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
> > ---
> >   arch/x86/kernel/cpu/bugs.c | 4 ++++
> >   1 file changed, 4 insertions(+)
> > 
> > diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> > index 7f94e6a5497d9a2d312a76095e48d6b364565777..7aa3ae00e6b4daa5e42217b66c50cd46d6bcc115 100644
> > --- a/arch/x86/kernel/cpu/bugs.c
> > +++ b/arch/x86/kernel/cpu/bugs.c
> > @@ -1427,6 +1427,10 @@ static void __init its_select_mitigation(void)
> >   		return;
> >   	}
> > +	/* For IBPB to be effective against ITS */
> > +	if (boot_cpu_has_bug(X86_BUG_OLD_MICROCODE))
> > +		pr_warn("Old microcode, userspace may be vulnerable to ITS\n");
> > +
> 
> That check is too coarse and probably has a high chance of false positive,
> i.e
> 
> Latest firmware for your CPU is version Z as defined in intel-ucode-defs.h,
> current running version is X which is older than Z , but it already contains
> IBPB fixups for ITS. Then it will trigger a false positive.

Agree, as I mentioned in the other email, I am okay dropping this patch.
This creates more confusion than it helps.

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

* Re: [PATCH] x86/its: Warn when microcode is old
  2025-06-12 13:19   ` Pawan Gupta
@ 2025-06-12 13:31     ` Dave Hansen
  0 siblings, 0 replies; 6+ messages in thread
From: Dave Hansen @ 2025-06-12 13:31 UTC (permalink / raw)
  To: Pawan Gupta, Sohil Mehta
  Cc: x86, linux-kernel, Borislav Petkov, Josh Poimboeuf, Dave Hansen

On 6/12/25 06:19, Pawan Gupta wrote:
> On a second thought, cpu_set_bug_bits() already issues a warning, and even
> taints the kernel when old microcode is detected. So warning here seems
> redundant, and also misleading as you said. I am okay dropping this patch.

Yep, that was the whole point of X86_BUG_OLD_MICROCODE. It's one, big,
bad, scary warning so that we don't have to do it for all the individual
little bad things that happen when you have old microcode.

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

end of thread, other threads:[~2025-06-12 13:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-12  0:08 [PATCH] x86/its: Warn when microcode is old Pawan Gupta
2025-06-12  6:34 ` Sohil Mehta
2025-06-12 13:19   ` Pawan Gupta
2025-06-12 13:31     ` Dave Hansen
2025-06-12  6:58 ` Nikolay Borisov
2025-06-12 13:22   ` Pawan Gupta

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).