Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1387651
| From | Andy Lutomirski <luto@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH urgent] Revert "x86/mm/32: Set NX in __supported_pte_mask before enabling paging" |
| Date | 2016-04-26 18:00 +0200 |
| Message-ID | <rsdz5-1JO-37@gated-at.bofh.it> (permalink) |
| References | <rs5Bw-3tR-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This reverts commit 320d25b6a05f8b73c23fc21025d2906ecdd2d4fc.
This change was problematic for a couple of reasons:
1. It missed a some entry points (Xen things and 64-bit native).
2. The entry it changed can be executed more than once. This isn't
really a problem, but it conflated per-cpu state setup and global
state setup.
3. It broke 64-bit non-NX. 64-bit non-NX worked the other way around from
32-bit -- __supported_pte_mask had NX set initially and was *cleared*
in x86_configure_nx. With the patch applied, it never got cleared.
Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
arch/x86/kernel/head_32.S | 6 ------
arch/x86/mm/setup_nx.c | 5 +++--
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 54cdbd2003fe..af1112980dd4 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -389,12 +389,6 @@ default_entry:
/* Make changes effective */
wrmsr
- /*
- * And make sure that all the mappings we set up have NX set from
- * the beginning.
- */
- orl $(1 << (_PAGE_BIT_NX - 32)), pa(__supported_pte_mask + 4)
-
enable_paging:
/*
diff --git a/arch/x86/mm/setup_nx.c b/arch/x86/mm/setup_nx.c
index 8bea84724a7d..f65a33f505b6 100644
--- a/arch/x86/mm/setup_nx.c
+++ b/arch/x86/mm/setup_nx.c
@@ -32,8 +32,9 @@ early_param("noexec", noexec_setup);
void x86_configure_nx(void)
{
- /* If disable_nx is set, clear NX on all new mappings going forward. */
- if (disable_nx)
+ if (boot_cpu_has(X86_FEATURE_NX) && !disable_nx)
+ __supported_pte_mask |= _PAGE_NX;
+ else
__supported_pte_mask &= ~_PAGE_NX;
}
--
2.5.5
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH urgent] Revert "x86/mm/32: Set NX in __supported_pte_mask before enabling paging" Andy Lutomirski <luto@kernel.org> - 2016-04-26 18:00 +0200 [tip:x86/urgent] Revert "x86/mm/32: Set NX in __supported_pte_mask before enabling paging" tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-04-26 20:00 +0200
csiph-web