Re: serious performance regression due to NX patch

From: David Mosberger
Date: Fri Jul 16 2004 - 19:36:51 EST


>>>>> On Sun, 11 Jul 2004 05:39:23 -0400 (EDT), Ingo Molnar <mingo@xxxxxxxxxx> said:

Ingo> On Sun, 11 Jul 2004, Ingo Molnar wrote:

>> ok, agreed. I'll check that it still does the right thing on x86.

Ingo> it doesnt seem to do the right thing for !PT_GNU_STACK applications on
Ingo> x86:

How about the patch below (on top of Linus' current bk tree)? Only
platforms which had VM_DATA_DEFAULT_FLAGS changed (as a result of the
NX patch) will need to define LEGACY_VM_DATA_DEFAULT_FLAGS to the old
value. AFAIK, that's x86 only, so the impact is very minimal and
should retain the existing behavior on all other platforms.

--david

===== fs/binfmt_elf.c 1.80 vs edited =====
--- 1.80/fs/binfmt_elf.c 2004-07-16 16:46:22 -07:00
+++ edited/fs/binfmt_elf.c 2004-07-16 17:25:26 -07:00
@@ -662,9 +662,9 @@
SET_PERSONALITY(elf_ex, ibcs2_interpreter);
}

- /* Now that personality is set, we can use VM_DATA_DEFAULT_FLAGS. */
+ /* Now that personality is set, we can use LEGACY_VM_DATA_DEFAULT_FLAGS. */
if (no_gnu_stack)
- def_flags |= VM_DATA_DEFAULT_FLAGS & (VM_EXEC | VM_MAYEXEC);
+ def_flags |= LEGACY_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 */
===== include/asm-i386/page.h 1.26 vs edited =====
--- 1.26/include/asm-i386/page.h 2004-07-01 17:00:00 -07:00
+++ edited/include/asm-i386/page.h 2004-07-16 17:24:26 -07:00
@@ -142,6 +142,7 @@

#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
+#define LEGACY_VM_DATA_DEFAULT_FLAGS (VM_DATA_DEFAULT_FLAGS | VM_EXEC)

#endif /* __KERNEL__ */

===== include/linux/mm.h 1.138 vs edited =====
--- 1.138/include/linux/mm.h 2004-07-06 22:19:25 -07:00
+++ edited/include/linux/mm.h 2004-07-16 17:23:41 -07:00
@@ -136,6 +136,10 @@
#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */
#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */

+#ifndef LEGACY_VM_DATA_DEFAULT_FLAGS
+#define LEGACY_VM_DATA_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
+#endif
+
#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
#endif
-
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/