Re: [RESEND RFC PATCH] x86/bugs: Add "unknown" reporting for MMIO Stale Data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 29, 2022 at 10:30:38PM +0200, Borislav Petkov wrote:
> On Fri, Jul 29, 2022 at 10:36:09AM -0700, Pawan Gupta wrote:
> > Does this look okay:
> > 
> > -       if (cpu_matches(cpu_vuln_blacklist, MMIO) &&
> > -           !arch_cap_mmio_immune(ia32_cap))
> > -               setup_force_cpu_bug(X86_BUG_MMIO_STALE_DATA);
> > +       if (!boot_cpu_has_bug(X86_BUG_MMIO_UNKNOWN)) {
> > +               if (cpu_matches(cpu_vuln_blacklist, MMIO) &&
> > +                   !arch_cap_mmio_immune(ia32_cap)) {
> > +                       setup_force_cpu_bug(X86_BUG_MMIO_STALE_DATA);
> > +               }
> > +       }
> 
> Yeah, I had initially X86_BUG_MMIO_UNKNOWN set unconditionally on all.
> 
> Then I thought I should set it only on older but as dhansen said, Intel
> is going in and out of servicing period so we better set it on all
> initially and then clear it when the CPU is not in the vuln blacklist.

Setting all to "unknown" initially can lead to some CPUs incorrectly
reporting "Unknown".

Let me see if there is a way to distinguish between 4. and 5. below:

   CPU category				  X86_BUG_MMIO_STALE_DATA	X86_BUG_MMIO_UNKNOWN
-----------------------------------------------------------------------------------------------
1. Known affected (in cpu list)			1				0
2. CPUs with HW immunity (MMIO_NO=1)		0				0
3. Other vendors				0				0
4. Older Intel CPUs				0				1
5. Not affected current CPUs (but MMIO_NO=0)	0				?

> > >  	if (!cpu_has(c, X86_FEATURE_BTC_NO)) {
> > >  		if (cpu_matches(cpu_vuln_blacklist, RETBLEED) || (ia32_cap & ARCH_CAP_RSBA))
> > > diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
> > > index 663f6e6dd288..5b2508adc38a 100644
> > > --- a/arch/x86/kernel/cpu/intel.c
> > > +++ b/arch/x86/kernel/cpu/intel.c
> > > @@ -372,6 +372,10 @@ static void early_init_intel(struct cpuinfo_x86 *c)
> > >  static void bsp_init_intel(struct cpuinfo_x86 *c)
> > >  {
> > >  	resctrl_cpu_detect(c);
> > > +
> > > +	/* Set on older crap */
> > > +	if (c->x86_model < INTEL_FAM6_IVYBRIDGE)
> 
> i.e., remove this check.

This check actually solves the above problem, but consider it gone.

> > > +		setup_force_cpu_bug(X86_BUG_MMIO_UNKNOWN);
> > 
> > Thanks for suggesting this approach.
> 
> You're welcome. I'm assuming you're gonna finish it or should I?

I will finish it, working on it.



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux