[PATCH] x86_64: noexec=off never worked correctly for the kernel direct mappings

Linux Kernel Mailing List <[email protected]> Thu, 07 Apr 2005 12:06:40 +0000
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
ChangeSet 1.1497, 2005/04/07 09:06:40-03:00, [email protected]

	[PATCH] x86_64: noexec=off never worked correctly for the kernel direct mappings
	
	noexec=off never worked correctly for the kernel direct mappings
	because the options were progressed too late. Fix this by checking for it early.
	
	(discovered by Zwane Mwaikumbo in 2.6 IIRC)
	
	Signed-off-by: Andi Kleen <[email protected]>
	
	Index: linux/arch/x86_64/kernel/setup64.c
	===================================================================



 e820.c    |    5 ++++-
 setup64.c |    2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)


diff -Nru a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c
--- a/arch/x86_64/kernel/e820.c	2005-04-07 11:03:55 -07:00
+++ b/arch/x86_64/kernel/e820.c	2005-04-07 11:03:55 -07:00
@@ -594,7 +594,10 @@
 			ioapic_force = 1;
 			skip_ioapic_setup = 0;
 		}
-		
+		else if (!memcmp(from, "noexec=", 7)) { 
+			extern int nonx_setup(char *);
+			nonx_setup(from + 7);
+		}					
 	next:
 		c = *(from++);
 		if (!c)
diff -Nru a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
--- a/arch/x86_64/kernel/setup64.c	2005-04-07 11:03:55 -07:00
+++ b/arch/x86_64/kernel/setup64.c	2005-04-07 11:03:55 -07:00
@@ -53,7 +53,7 @@
 
 */ 
 
-static int __init nonx_setup(char *str)
+int __init nonx_setup(char *str)
 {
 	if (!strncmp(str, "on",3)) { 
 		__supported_pte_mask |= _PAGE_NX;