public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* serious performance regression due to NX patch
@ 2004-07-10  5:28 David Mosberger
  2004-07-11  8:38 ` Ingo Molnar
  0 siblings, 1 reply; 32+ messages in thread
From: David Mosberger @ 2004-07-10  5:28 UTC (permalink / raw)
  To: mingo, suresh.b.siddha, jun.nakajima, akpm, torvalds
  Cc: linux-ia64, linux-kernel

The "No eXecute patch for x86" causes a serious exec() performance
degradation on ia64 since it ends up incorrectly turning on the
execute protection on all segments (since most ia64 binaries don't
have a gnu_stack program-header).

The patch below fixes the problem by turning on VM_EXEC and VM_MAYEXEC
only if VM_DATA_DEFAULT_FLAGS mentions them.  Note that on ia64, the
value of VM_DATA_DEFAULT_FLAGS depends on the personality (to support
x86 binaries) and hence I had to move the setting of "def_flags" down
a bit to a point after SET_PERSONALITY() has been done.

Please apply.

	--david

===== fs/binfmt_elf.c 1.78 vs edited =====
--- 1.78/fs/binfmt_elf.c	2004-06-29 07:43:10 -07:00
+++ edited/fs/binfmt_elf.c	2004-07-09 21:53:05 -07:00
@@ -493,8 +493,8 @@
 	char passed_fileno[6];
 	struct files_struct *files;
 	int executable_stack = EXSTACK_DEFAULT;
-	unsigned long def_flags = 0;
-	
+	unsigned long no_gnu_stack, def_flags = 0;
+
 	/* Get the exec-header */
 	elf_ex = *((struct elfhdr *) bprm->buf);
 
@@ -627,8 +627,7 @@
 				executable_stack = EXSTACK_DISABLE_X;
 			break;
 		}
-	if (i == elf_ex.e_phnum)
-		def_flags |= VM_EXEC | VM_MAYEXEC;
+	no_gnu_stack = (i == elf_ex.e_phnum);
 
 	/* Some simple consistency checks for the interpreter */
 	if (elf_interpreter) {
@@ -662,6 +661,10 @@
 		/* Executables without an interpreter also need a personality  */
 		SET_PERSONALITY(elf_ex, ibcs2_interpreter);
 	}
+
+	/* Now that personality is set, we can use VM_DATA_DEFAULT_FLAGS.  */
+	if (no_gnu_stack)
+		def_flags |= VM_DATA_DEFAULT_FLAGS & (VM_EXEC | VM_MAYEXEC);
 
 	/* OK, we are done with that, now set up the arg stuff,
 	   and then start this sucker up */

^ permalink raw reply	[flat|nested] 32+ messages in thread
[parent not found: <2giKE-67F-1@gated-at.bofh.it>]

end of thread, other threads:[~2004-07-17  4:37 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-10  5:28 serious performance regression due to NX patch David Mosberger
2004-07-11  8:38 ` Ingo Molnar
2004-07-11  9:39   ` Ingo Molnar
2004-07-11  9:52     ` Ingo Molnar
2004-07-11 10:02       ` Andrew Morton
2004-07-11 12:19         ` Matthew Wilcox
2004-07-11 10:22       ` Christoph Hellwig
2004-07-11 12:38       ` Jakub Jelinek
2004-07-12 18:08         ` Ingo Molnar
2004-07-12 18:24           ` Christoph Hellwig
2004-07-12 18:29             ` Ingo Molnar
2004-07-12 19:10               ` David Mosberger
2004-07-12 19:54                 ` Ingo Molnar
2004-07-12 20:08                   ` David Mosberger
2004-07-12 20:17           ` Linus Torvalds
2004-07-12 20:21             ` David Mosberger
2004-07-12 20:24             ` David Mosberger
2004-07-13  4:23               ` Ingo Molnar
2004-07-13  5:23                 ` David Mosberger
2004-07-13 16:05                 ` Mark Haverkamp
2004-07-13 16:49                   ` Daniel McNeil
2004-07-14 18:36                     ` [PATCH] mmap PROT_NONE fix (was Re: serious performance regression due to NX patch) Daniel McNeil
2004-07-17  0:06                   ` serious performance regression due to NX patch David Mosberger
2004-07-17  1:39                     ` Linus Torvalds
2004-07-17  4:37                       ` David Mosberger
2004-07-13  3:58             ` Ingo Molnar
2004-07-17  0:35     ` David Mosberger
     [not found] <2giKE-67F-1@gated-at.bofh.it>
     [not found] ` <2gIc8-6pd-29@gated-at.bofh.it>
     [not found]   ` <2gJ8a-72b-11@gated-at.bofh.it>
     [not found]     ` <2gJhY-776-21@gated-at.bofh.it>
2004-07-11 10:09       ` Andi Kleen
2004-07-11 11:56         ` Ingo Molnar
2004-07-11 12:43           ` Andi Kleen
     [not found]       ` <2gJrv-7kp-5@gated-at.bofh.it>
     [not found]         ` <2gLD2-qn-3@gated-at.bofh.it>
2004-07-11 13:38           ` Andi Kleen
2004-07-11 14:04             ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox