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.
smime.p7s
Description: S/MIME cryptographic signature