Re: [PATCH v4] [x86] detect and report lack of NX protections

From: H. Peter Anvin
Date: Tue Nov 10 2009 - 13:57:38 EST


On 11/10/2009 09:46 AM, Kees Cook wrote:
>
> The kernel as-is does not set nx_enabled for 64-bit, so this message is
> skipped completely:
>
> if (nx_enabled)
> printk(KERN_INFO "NX (Execute Disable) protection: active\n");
>
> The only time this printk is shown is on 32-bit with PAE (with NX).
> There is no "else" currently.
>

The structure you have is:

if (nx_enabled)
else if (cpu_has_pae)

The test for cpu_has_pae is unconditional (you only #ifdef the message)
-- in fact, this should cause a compile-time error on 64 bits:

#undef cpu_has_pae
#define cpu_has_pae ___BUG___

-hpa
--
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/