Re: [PATCH v2 5/5] x86/pti: Do not enable PTI on fixed Intel processors

David Woodhouse
2018-01-24T01:27:12Z

[-- Attachment #1: Type: text/plain, Size: 1208 bytes --]

On Tue, 2018-01-23 at 10:40 -0800, Dave Hansen wrote:
>
> I'd really rather we break this out into a nice, linear set of
> true/false conditions.
>
> bool early_cpu_vulnerable_meltdown(struct cpuinfo_x86 *c)
> {
>         u64 ia32_cap = 0;
>
>         /* AMD processors are not subject to Meltdown exploit: */
>         if (c->x86_vendor == X86_VENDOR_AMD)
>                 return false;
>
>         /* Assume all remaining CPUs not enumerating are vulnerable: */
>         if (!cpu_has(c, X86_FEATURE_ARCH_CAPABILITIES))
>                 return true;
>
>         /*
>          * Does the CPU explicitly enumerate that it is not vulnerable
>          * to Rogue Data Cache Load (aka Meltdown)?
>          */
>         rdmsrl(MSR_IA32_ARCH_CAPABILITIES, ia32_cap);
>         if (ia32_cap & ARCH_CAP_RDCL_NO)
>                 return false;
>
>         /* Assume everything else is vulnerable */
>         return true;
> }

Makes sense. It also starts to address Alan's "starting to get messy"
comment, and gives a simple way to add other conditions.

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5213 bytes --]