lkml.org 
[lkml]   [2004]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectserious performance regression due to NX patch
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 */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:04    [from the cache]
©2003-2011 Jasper Spaans