x86, cpu: Clear XD_DISABLED flag on Intel to regain NX
authorKees Cook <kees.cook@canonical.com>
Wed, 10 Nov 2010 18:35:52 +0000 (10:35 -0800)
committerH. Peter Anvin <hpa@linux.intel.com>
Wed, 10 Nov 2010 23:42:54 +0000 (15:42 -0800)
commitae84739c27b6b3725993202fe02ff35ab86468e1
treeda5c217456d38e56218d059154186287a9d1e54a
parentc5cbac69422a9bffe7c7fd9a115130e272b547f5
x86, cpu: Clear XD_DISABLED flag on Intel to regain NX

Intel CPUs have an additional MSR bit to indicate if the BIOS was
configured to disable the NX cpu feature. This bit was traditionally
used for operating systems that did not understand how to handle the
NX bit. Since Linux understands this, this BIOS flag should be ignored
by default.

In a review[1] of reported hardware being used by Ubuntu bug reporters,
almost 10% of systems had an incorrectly configured BIOS, leaving their
systems unable to use the NX features of their CPU.

This change will clear the MSR_IA32_MISC_ENABLE_XD_DISABLE bit so that NX
cannot be inappropriately controlled by the BIOS on Intel CPUs. If, under
very strange hardware configurations, NX actually needs to be disabled,
"noexec=off" can be used to restore the prior behavior.

[1] http://www.outflux.net/blog/archives/2010/02/18/data-mining-for-nx-bit/

Signed-off-by: Kees Cook <kees.cook@canonical.com>
LKML-Reference: <1289414154-7829-3-git-send-email-kees.cook@canonical.com>
Acked-by: Pekka Enberg <penberg@kernel.org>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
arch/x86/kernel/verify_cpu.S