Re: [tip:x86/smep] x86, cpu: Enable/disable Supervisor ModeExecution Protection

From: Ingo Molnar
Date: Sat May 21 2011 - 06:43:27 EST



* Yinghai Lu <yinghai@xxxxxxxxxx> wrote:

> > +static __init void setup_smep(struct cpuinfo_x86 *c)
> > +{
> > + if (cpu_has(c, X86_FEATURE_SMEP)) {
> > + if (unlikely(disable_smep)) {
> > + setup_clear_cpu_cap(X86_FEATURE_SMEP);
> > + clear_in_cr4(X86_CR4_SMEP);
> > + } else
> > + set_in_cr4(X86_CR4_SMEP);
> > + }
> > +}
>
> should be __cpuinit for this function.
>
> otherwise got:
>
> WARNING: arch/x86/built-in.o(.cpuinit.text+0x1b10): Section mismatch in reference from the function identify_cpu() to the function .init.text:setup_smep()
> The function __cpuinit identify_cpu() references
> a function __init setup_smep().
> If setup_smep is only used by identify_cpu then
> annotate setup_smep with a matching annotation.

Yeah, indeed, and it might in fact crash with certain .config's. Mind sending a
tested patch?

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/