public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: David Mosberger <davidm@napali.hpl.hp.com>
To: mingo@redhat.com, suresh.b.siddha@intel.com,
	jun.nakajima@intel.com, akpm@osdl.org, torvalds@osdl.org
Cc: linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: serious performance regression due to NX patch
Date: Sat, 10 Jul 2004 05:28:15 +0000	[thread overview]
Message-ID: <200407100528.i6A5SF8h020094@napali.hpl.hp.com> (raw)

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 */

             reply	other threads:[~2004-07-10  5:28 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-10  5:28 David Mosberger [this message]
2004-07-11  8:38 ` serious performance regression due to NX patch 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 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200407100528.i6A5SF8h020094@napali.hpl.hp.com \
    --to=davidm@napali.hpl.hp.com \
    --cc=akpm@osdl.org \
    --cc=jun.nakajima@intel.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=suresh.b.siddha@intel.com \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox