Re: [PATCH v3 01/13] x86/retpoline: Add initial retpoline support
From: Woodhouse, David
Date: Fri Jan 05 2018 - 09:32:42 EST
On Fri, 2018-01-05 at 13:54 +0100, Thomas Gleixner wrote:
> On Thu, 4 Jan 2018, David Woodhouse wrote:
> > diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
> > index 07cdd1715705..900fa7016d3f 100644
> > --- a/arch/x86/include/asm/cpufeatures.h
> > +++ b/arch/x86/include/asm/cpufeatures.h
> > @@ -342,5 +342,6 @@
> >Â #define X86_BUG_MONITORÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂX86_BUG(12) /* IPI required to wake up remote CPU */
> >Â #define X86_BUG_AMD_E400ÂÂÂÂÂÂÂÂÂÂÂÂÂX86_BUG(13) /* CPU is among the affected by Erratum 400 */
> >Â #define X86_BUG_CPU_INSECUREÂÂÂÂÂÂÂÂÂX86_BUG(14) /* CPU is insecure and needs kernel page table isolation */
> > +#define X86_BUG_NO_RETPOLINEÂÂÂÂÂÂÂÂÂX86_BUG(15) /* Placeholder: disable retpoline branch thunks */
>
> I think this is the wrong approach. We have X86_BUG_CPU_INSECURE, which now
> should be renamed to X86_BUG_CPU_MELTDOWN_V3 or something like that. It
> tells the kernel, that the CPU is affected by variant 3.
As it says, it's a placeholder. The actual conditions depend on whether
we decide to use IBRS or not, which also depends on whether we find
IBRS_ATT or whether we're on Skylake+.
The IBRS patch series should be updating it.
> So what we really want is
>
> ÂÂÂX86_BUG_MELTDOWN_V1/2/3
>
> which get set when the CPU is affected by a particular variant and then
> have feature flags
>
> ÂÂÂX86_FEATURE_RETPOLINE
> ÂÂÂX86_FEATURE_IBRS
> ÂÂÂX86_FEATURE_NOSPEC
At some point during this whole painful mess, I had come to the
conclusion that having relocations in altinstr didn't work, and that's
why I had X86_xx_NO_RETPOLINE instead of X86_xx_RETPOLINE. I now think
that something else was wrong when I was testing that, and relocs in
altinstr do work. So sure, X86_FEATURE_RETPOLINE ought to work. I can
change that round, and it's simpler for the IBRS patch set to take it
into account and set it when appropriate.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature