- fully-honor-vdso_enabled.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     fully honor vdso_enabled [i386, sh; x86_64?]
has been removed from the -mm tree.  Its filename was
     fully-honor-vdso_enabled.patch

This patch was dropped because I am hopelessly confused - please resend

------------------------------------------------------
Subject: fully honor vdso_enabled [i386, sh; x86_64?]
From: John Reiser <jreiser@xxxxxxxxxxxx>

Architectures such as i386, sh, x86_64 have a flag
/proc/sys/vm/vdso_enabled to choose whether the kernel should setup a
process to use vdso after execve().  Informing the user code via
AT_SYSINFO* is controlled by macro ARCH_DLINFO in fs/binfmt_elf.c and
include/asm-$ARCH/elf.h, but the vdso page is established always via
arch_setup_additonal_pages() called from load_elf_binary().  If
vdso_enabled is off, then current code wastes kernel time during execve()
and fragments the address space unnecessarily.

This patch changes arch_setup_additonal_pages() to honor vdso_enabled.  For
i386 it also allows the option of a fixed addresss to avoid fragmenting the
address space.  Compiles and runs on i386.  x86_64 [IA32 support] and sh
maintainers also please comment.

For some related history, including interaction with exec-shield, see:
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=229304
and also 207020 and 162797.

Signed-off-by: John Reiser <jreiser@xxxxxxxxxxxx>
Cc: Andi Kleen <ak@xxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Arjan van de Ven <arjan@xxxxxxxxxxxxx>
Acked-by: Paul Mundt <lethal@xxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 arch/i386/kernel/sysenter.c        |   19 ++++++++++++++++++-
 arch/sh/kernel/vsyscall/vsyscall.c |    3 +++
 include/asm-i386/a.out.h           |    2 +-
 3 files changed, 22 insertions(+), 2 deletions(-)

diff -puN arch/i386/kernel/sysenter.c~fully-honor-vdso_enabled arch/i386/kernel/sysenter.c
--- a/arch/i386/kernel/sysenter.c~fully-honor-vdso_enabled
+++ a/arch/i386/kernel/sysenter.c
@@ -22,6 +22,8 @@
 #include <asm/msr.h>
 #include <asm/pgtable.h>
 #include <asm/unistd.h>
+#include <asm/a.out.h>
+#include <asm/mman.h>
 
 /*
  * Should the kernel map a VDSO page into processes and pass its
@@ -105,10 +107,25 @@ int arch_setup_additional_pages(struct l
 {
 	struct mm_struct *mm = current->mm;
 	unsigned long addr;
+	unsigned long flags;
 	int ret;
 
+	switch (vdso_enabled) {
+	case 0:  /* none */
+		return 0;
+	default:
+	case 1:  /* vdso in random available page */
+		addr = 0ul;
+		flags = 0ul;
+		break;
+	case 2:  /* out of user's way */
+		addr = STACK_TOP;
+		flags = MAP_FIXED;
+		break;
+	}
+
 	down_write(&mm->mmap_sem);
-	addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0);
+	addr = get_unmapped_area(NULL, addr, PAGE_SIZE, 0, flags);
 	if (IS_ERR_VALUE(addr)) {
 		ret = addr;
 		goto up_fail;
diff -puN arch/sh/kernel/vsyscall/vsyscall.c~fully-honor-vdso_enabled arch/sh/kernel/vsyscall/vsyscall.c
--- a/arch/sh/kernel/vsyscall/vsyscall.c~fully-honor-vdso_enabled
+++ a/arch/sh/kernel/vsyscall/vsyscall.c
@@ -64,6 +64,9 @@ int arch_setup_additional_pages(struct l
 	unsigned long addr;
 	int ret;
 
+	if (!vdso_enabled)
+		return 0;
+
 	down_write(&mm->mmap_sem);
 	addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0);
 	if (IS_ERR_VALUE(addr)) {
diff -puN include/asm-i386/a.out.h~fully-honor-vdso_enabled include/asm-i386/a.out.h
--- a/include/asm-i386/a.out.h~fully-honor-vdso_enabled
+++ a/include/asm-i386/a.out.h
@@ -19,7 +19,7 @@ struct exec
 
 #ifdef __KERNEL__
 
-#define STACK_TOP	TASK_SIZE
+#define STACK_TOP	(TASK_SIZE - PAGE_SIZE)  /* 1 page optional for vdso */
 
 #endif
 
_

Patches currently in -mm which might be from jreiser@xxxxxxxxxxxx are

fully-honor-vdso_enabled.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux