Merge branch 'akpm'
[linux-2.6/next.git] / arch / x86 / mm / setup_nx.c
blob410531d3c292d20cde9b40a487711930eab51eb2
1 #include <linux/spinlock.h>
2 #include <linux/errno.h>
3 #include <linux/init.h>
5 #include <asm/pgtable.h>
6 #include <asm/proto.h>
8 static int disable_nx __cpuinitdata;
11 * noexec = on|off
13 * Control non-executable mappings for processes.
15 * on Enable
16 * off Disable
18 static int __init noexec_setup(char *str)
20 if (!str)
21 return -EINVAL;
22 if (!strncmp(str, "on", 2)) {
23 disable_nx = 0;
24 } else if (!strncmp(str, "off", 3)) {
25 disable_nx = 1;
27 x86_configure_nx();
28 return 0;
30 early_param("noexec", noexec_setup);
32 void __cpuinit x86_configure_nx(void)
34 if (cpu_has_nx && !disable_nx)
35 __supported_pte_mask |= _PAGE_NX;
36 else
37 __supported_pte_mask &= ~_PAGE_NX;
40 void __init x86_report_nx(void)
42 if (!cpu_has_nx) {
43 printk(KERN_NOTICE "Notice: NX (Execute Disable) protection "
44 "missing in CPU!\n");
45 } else {
46 #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
47 if (disable_nx) {
48 printk(KERN_INFO "NX (Execute Disable) protection: "
49 "disabled by kernel command line option\n");
50 } else {
51 printk(KERN_INFO "NX (Execute Disable) protection: "
52 "active\n");
54 #else
55 /* 32bit non-PAE kernel, NX cannot be used */
56 printk(KERN_NOTICE "Notice: NX (Execute Disable) protection "
57 "cannot be enabled: non-PAE kernel!\n");
58 #endif