[PATCH][1/2] NX: Fix noexec kernel parameter

From: Zwane Mwaikambo
Date: Sun Dec 05 2004 - 01:00:33 EST


noexec_setup runs too late to take any effect, so parse it earlier.

Signed-off-by: Zwane Mwaikambo <zwane@xxxxxxxxxxxxxxxx>

Index: linux-2.6.10-rc2/arch/i386/kernel/setup.c
===================================================================
RCS file: /home/cvsroot/linux-2.6.10-rc2/arch/i386/kernel/setup.c,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 setup.c
--- linux-2.6.10-rc2/arch/i386/kernel/setup.c 25 Nov 2004 19:45:32 -0000 1.1.1.1
+++ linux-2.6.10-rc2/arch/i386/kernel/setup.c 4 Dec 2004 18:43:17 -0000
@@ -737,6 +737,12 @@ static void __init parse_cmdline_early (
}
}

+ else if (!memcmp(from, "noexec=", 7)) {
+ extern void noexec_setup(char *str);
+
+ noexec_setup(from + 7);
+ }
+
#ifdef CONFIG_X86_SMP
/*
* If the BIOS enumerates physical processors before logical,
Index: linux-2.6.10-rc2/arch/i386/mm/init.c
===================================================================
RCS file: /home/cvsroot/linux-2.6.10-rc2/arch/i386/mm/init.c,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 init.c
--- linux-2.6.10-rc2/arch/i386/mm/init.c 25 Nov 2004 19:45:32 -0000 1.1.1.1
+++ linux-2.6.10-rc2/arch/i386/mm/init.c 4 Dec 2004 18:42:40 -0000
@@ -424,7 +424,7 @@ u64 __supported_pte_mask = ~_PAGE_NX;
* on Enable
* off Disable
*/
-static int __init noexec_setup(char *str)
+void __init noexec_setup(char *str)
{
if (!strncmp(str, "on",2) && cpu_has_nx) {
__supported_pte_mask |= _PAGE_NX;
@@ -433,11 +433,8 @@ static int __init noexec_setup(char *str
disable_nx = 1;
__supported_pte_mask &= ~_PAGE_NX;
}
- return 1;
}

-__setup("noexec=", noexec_setup);
-
int nx_enabled = 0;
#ifdef CONFIG_X86_PAE

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/