summaryrefslogtreecommitdiff
path: root/arch/x86/mm/setup_nx.c
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@kernel.org>2016-01-20 00:38:58 +0300
committerIngo Molnar <mingo@kernel.org>2016-01-20 13:39:14 +0300
commit320d25b6a05f8b73c23fc21025d2906ecdd2d4fc (patch)
tree811660369c7225b275700592f8617eb020a53d44 /arch/x86/mm/setup_nx.c
parent43c75f933be26422f166d6d869a19997312f4732 (diff)
downloadlinux-320d25b6a05f8b73c23fc21025d2906ecdd2d4fc.tar.xz
x86/mm/32: Set NX in __supported_pte_mask before enabling paging
There's a short window in which very early mappings can end up with NX clear because they are created before we've noticed that we have NX. It turns out that we detect NX very early, so there's no need to defer __supported_pte_mask setup. Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Pavel Machek <pavel@ucw.cz> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephen Smalley <sds@tycho.nsa.gov> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/2b544627345f7110160545a3f47031eb45c3ad4f.1453239349.git.luto@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/mm/setup_nx.c')
-rw-r--r--arch/x86/mm/setup_nx.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/x86/mm/setup_nx.c b/arch/x86/mm/setup_nx.c
index 92e2eacb3321..78f5d5907f98 100644
--- a/arch/x86/mm/setup_nx.c
+++ b/arch/x86/mm/setup_nx.c
@@ -31,9 +31,8 @@ early_param("noexec", noexec_setup);
void x86_configure_nx(void)
{
- if (boot_cpu_has(X86_FEATURE_NX) && !disable_nx)
- __supported_pte_mask |= _PAGE_NX;
- else
+ /* If disable_nx is set, clear NX on all new mappings going forward. */
+ if (disable_nx)
__supported_pte_mask &= ~_PAGE_NX;
}