Skip to contentSkip to conversation

x86: unify noexec handling

PATCH In review Pekka Enberg 1 participant 2 messages Apr 21, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: unify noexec handling

From: Pekka Enberg <[email protected]>

This patch unifies noexec handling on 32-bit and 64-bit.

[ Impact: cleanup ]
[ [email protected]: build fix ]
---
 arch/x86/include/asm/pgtable_types.h |    1 -
 arch/x86/mm/init.c                   |   67 ++++++++++++++++++++++++++++++++--
 arch/x86/mm/init_32.c                |   52 --------------------------
 arch/x86/mm/init_64.c                |   33 -----------------
 4 files changed, 63 insertions(+), 90 deletions(-)
arch/x86/include/asm/pgtable_types.h +0 -1
index b8238dc..4d258ad 100644
@@ -273,7 +273,6 @@ typedef struct page *pgtable_t;
 
 extern pteval_t __supported_pte_mask;
 extern int nx_enabled;
-extern void set_nx(void);
 
 #define pgprot_writecombine	pgprot_writecombine
 extern pgprot_t pgprot_writecombine(pgprot_t prot);
arch/x86/mm/init.c +63 -4

88 lines not on this page · raw message

arch/x86/mm/init_32.c +0 -52

61 lines not on this page · raw message

arch/x86/mm/init_64.c +0 -33
index 1753e80..a4e7846 100644
@@ -85,39 +85,6 @@ early_param("gbpages", parse_direct_gbpages_on);
 pteval_t __supported_pte_mask __read_mostly = ~_PAGE_IOMAP;
 EXPORT_SYMBOL_GPL(__supported_pte_mask);
 
-static int disable_nx __cpuinitdata;
-
-/*
- * noexec=on|off
- * Control non-executable mappings for 64-bit processes.
- *
- * on	Enable (default)
- * off	Disable
- */
-static int __init nonx_setup(char *str)
-{
-	if (!str)
-		return -EINVAL;
-	if (!strncmp(str, "on", 2)) {
-		__supported_pte_mask |= _PAGE_NX;
-		disable_nx = 0;
-	} else if (!strncmp(str, "off", 3)) {
-		disable_nx = 1;
-		__supported_pte_mask &= ~_PAGE_NX;
-	}
-	return 0;
-}
-early_param("noexec", nonx_setup);
-
-void __cpuinit check_efer(void)
-{
-	unsigned long efer;
-
-	rdmsrl(MSR_EFER, efer);
-	if (!(efer & EFER_NX) || disable_nx)
-		__supported_pte_mask &= ~_PAGE_NX;
-}
-
 int force_personality32;
 
 /*
Signature · 1 line
1.5.6.3
#1 lore raw
Commit-ID:  89388913f2c88a2cd15d24abab571b17a2596127
Gitweb:     http://git.kernel.org/tip/89388913f2c88a2cd15d24abab571b17a2596127
Author:     Pekka Enberg <[email protected]>
AuthorDate: Tue, 21 Apr 2009 11:39:27 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 21 Apr 2009 10:48:08 +0200

x86: unify noexec handling

This patch unifies noexec handling on 32-bit and 64-bit.

[ Impact: cleanup ]

LKML-Reference: <1240303167.771.69.camel@penberg-laptop>

---
 arch/x86/include/asm/pgtable_types.h |    1 -
 arch/x86/mm/init.c                   |   67 ++++++++++++++++++++++++++++++++--
 arch/x86/mm/init_32.c                |   52 --------------------------
 arch/x86/mm/init_64.c                |   33 -----------------
 4 files changed, 63 insertions(+), 90 deletions(-)
arch/x86/include/asm/pgtable_types.h +0 -1
index b8238dc..4d258ad 100644
@@ -273,7 +273,6 @@ typedef struct page *pgtable_t;
 
 extern pteval_t __supported_pte_mask;
 extern int nx_enabled;
-extern void set_nx(void);
 
 #define pgprot_writecombine	pgprot_writecombine
 extern pgprot_t pgprot_writecombine(pgprot_t prot);
arch/x86/mm/init.c +63 -4

88 lines not on this page · raw message

arch/x86/mm/init_32.c +0 -52

61 lines not on this page · raw message

arch/x86/mm/init_64.c +0 -33
index 1753e80..a4e7846 100644
@@ -85,39 +85,6 @@ early_param("gbpages", parse_direct_gbpages_on);
 pteval_t __supported_pte_mask __read_mostly = ~_PAGE_IOMAP;
 EXPORT_SYMBOL_GPL(__supported_pte_mask);
 
-static int disable_nx __cpuinitdata;
-
-/*
- * noexec=on|off
- * Control non-executable mappings for 64-bit processes.
- *
- * on	Enable (default)
- * off	Disable
- */
-static int __init nonx_setup(char *str)
-{
-	if (!str)
-		return -EINVAL;
-	if (!strncmp(str, "on", 2)) {
-		__supported_pte_mask |= _PAGE_NX;
-		disable_nx = 0;
-	} else if (!strncmp(str, "off", 3)) {
-		disable_nx = 1;
-		__supported_pte_mask &= ~_PAGE_NX;
-	}
-	return 0;
-}
-early_param("noexec", nonx_setup);
-
-void __cpuinit check_efer(void)
-{
-	unsigned long efer;
-
-	rdmsrl(MSR_EFER, efer);
-	if (!(efer & EFER_NX) || disable_nx)
-		__supported_pte_mask &= ~_PAGE_NX;
-}
-
 int force_personality32;
 
 /*