- vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma.patch removed from -mm tree

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

 



The patch titled

     vdso: randomize the i386 vDSO by moving it into a vma

has been removed from the -mm tree.  Its filename is

     vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
Subject: vdso: randomize the i386 vDSO by moving it into a vma
From: Ingo Molnar <mingo@xxxxxxx>

Move the i386 VDSO down into a vma and thus randomize it.

Besides the security implications, this feature also helps debuggers, which
can COW a vma-backed VDSO just like a normal DSO and can thus do
single-stepping and other debugging features.

It's good for hypervisors (Xen, VMWare) too, which typically live in the same
high-mapped address space as the VDSO, hence whenever the VDSO is used, they
get lots of guest pagefaults and have to fix such guest accesses up - which
slows things down instead of speeding things up (the primary purpose of the
VDSO).

There's a new CONFIG_COMPAT_VDSO (default=y) option, which provides support
for older glibcs that still rely on a prelinked high-mapped VDSO.  Newer
distributions (using glibc 2.3.3 or later) can turn this option off.  Turning
it off is also recommended for security reasons: attackers cannot use the
predictable high-mapped VDSO page as syscall trampoline anymore.

There is a new vdso=[0|1] boot option as well, and a runtime
/proc/sys/vm/vdso_enabled sysctl switch, that allows the VDSO to be turned
on/off.

(This version of the VDSO-randomization patch also has working ELF
coredumping, the previous patch crashed in the coredumping code.)

This code is a combined work of the exec-shield VDSO randomization
code and Gerd Hoffmann's hypervisor-centric VDSO patch. Rusty Russell
started this patch and i completed it.

[akpm@xxxxxxxx: cleanups]
[akpm@xxxxxxxx: compile fix]
[akpm@xxxxxxxx: compile fix 2]
[akpm@xxxxxxxx: compile fix 3]
[akpm@xxxxxxxx: revernt MAXMEM change]
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
Signed-off-by: Arjan van de Ven <arjan@xxxxxxxxxxxxx>
Cc: Gerd Hoffmann <kraxel@xxxxxxx>
Cc: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Cc: Zachary Amsden <zach@xxxxxxxxxx>
Cc: Andi Kleen <ak@xxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 Documentation/kernel-parameters.txt  |    4 
 arch/i386/Kconfig                    |   11 ++
 arch/i386/kernel/asm-offsets.c       |    4 
 arch/i386/kernel/entry.S             |    7 +
 arch/i386/kernel/signal.c            |    4 
 arch/i386/kernel/sysenter.c          |  128 ++++++++++++++++++++++++-
 arch/i386/kernel/vsyscall-sysenter.S |    4 
 arch/i386/kernel/vsyscall.lds.S      |    4 
 fs/proc/task_mmu.c                   |   30 +++--
 include/asm-i386/elf.h               |   53 +++++++---
 include/asm-i386/fixmap.h            |   10 -
 include/asm-i386/mmu.h               |    1 
 include/asm-i386/page.h              |    3 
 include/asm-i386/thread_info.h       |    1 
 include/asm-i386/unwind.h            |    4 
 include/linux/mm.h                   |    2 
 include/linux/sysctl.h               |    1 
 kernel/sysctl.c                      |   12 ++
 18 files changed, 235 insertions(+), 48 deletions(-)

diff -puN arch/i386/Kconfig~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma arch/i386/Kconfig
--- a/arch/i386/Kconfig~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma
+++ a/arch/i386/Kconfig
@@ -780,6 +780,17 @@ config HOTPLUG_CPU
 	  enable suspend on SMP systems. CPUs can be controlled through
 	  /sys/devices/system/cpu.
 
+config COMPAT_VDSO
+	bool "Compat VDSO support"
+	default y
+	help
+	  Map the VDSO to the predictable old-style address too.
+	---help---
+	  Say N here if you are running a sufficiently recent glibc
+	  version (2.3.3 or later), to remove the high-mapped
+	  VDSO mapping and to exclusively use the randomized VDSO.
+
+	  If unsure, say Y.
 
 endmenu
 
diff -puN arch/i386/kernel/asm-offsets.c~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma arch/i386/kernel/asm-offsets.c
--- a/arch/i386/kernel/asm-offsets.c~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma
+++ a/arch/i386/kernel/asm-offsets.c
@@ -14,6 +14,7 @@
 #include <asm/fixmap.h>
 #include <asm/processor.h>
 #include <asm/thread_info.h>
+#include <asm/elf.h>
 
 #define DEFINE(sym, val) \
         asm volatile("\n->" #sym " %0 " #val : : "i" (val))
@@ -54,6 +55,7 @@ void foo(void)
 	OFFSET(TI_preempt_count, thread_info, preempt_count);
 	OFFSET(TI_addr_limit, thread_info, addr_limit);
 	OFFSET(TI_restart_block, thread_info, restart_block);
+	OFFSET(TI_sysenter_return, thread_info, sysenter_return);
 	BLANK();
 
 	OFFSET(EXEC_DOMAIN_handler, exec_domain, handler);
@@ -69,7 +71,7 @@ void foo(void)
 		 sizeof(struct tss_struct));
 
 	DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
-	DEFINE(VSYSCALL_BASE, __fix_to_virt(FIX_VSYSCALL));
+	DEFINE(VDSO_PRELINK, VDSO_PRELINK);
 
 	OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx);
 }
diff -puN arch/i386/kernel/entry.S~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma arch/i386/kernel/entry.S
--- a/arch/i386/kernel/entry.S~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma
+++ a/arch/i386/kernel/entry.S
@@ -270,7 +270,12 @@ sysenter_past_esp:
 	pushl $(__USER_CS)
 	CFI_ADJUST_CFA_OFFSET 4
 	/*CFI_REL_OFFSET cs, 0*/
-	pushl $SYSENTER_RETURN
+	/*
+	 * Push current_thread_info()->sysenter_return to the stack.
+	 * A tiny bit of offset fixup is necessary - 4*4 means the 4 words
+	 * pushed above; +8 corresponds to copy_thread's esp0 setting.
+	 */
+	pushl (TI_sysenter_return-THREAD_SIZE+8+4*4)(%esp)
 	CFI_ADJUST_CFA_OFFSET 4
 	CFI_REL_OFFSET eip, 0
 
diff -puN arch/i386/kernel/signal.c~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma arch/i386/kernel/signal.c
--- a/arch/i386/kernel/signal.c~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma
+++ a/arch/i386/kernel/signal.c
@@ -351,7 +351,7 @@ static int setup_frame(int sig, struct k
 			goto give_sigsegv;
 	}
 
-	restorer = &__kernel_sigreturn;
+	restorer = (void *)VDSO_SYM(&__kernel_sigreturn);
 	if (ka->sa.sa_flags & SA_RESTORER)
 		restorer = ka->sa.sa_restorer;
 
@@ -447,7 +447,7 @@ static int setup_rt_frame(int sig, struc
 		goto give_sigsegv;
 
 	/* Set up to return from userspace.  */
-	restorer = &__kernel_rt_sigreturn;
+	restorer = (void *)VDSO_SYM(&__kernel_rt_sigreturn);
 	if (ka->sa.sa_flags & SA_RESTORER)
 		restorer = ka->sa.sa_restorer;
 	err |= __put_user(restorer, &frame->pretcode);
diff -puN arch/i386/kernel/sysenter.c~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma arch/i386/kernel/sysenter.c
--- a/arch/i386/kernel/sysenter.c~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma
+++ a/arch/i386/kernel/sysenter.c
@@ -2,6 +2,8 @@
  * linux/arch/i386/kernel/sysenter.c
  *
  * (C) Copyright 2002 Linus Torvalds
+ * Portions based on the vdso-randomization code from exec-shield:
+ * Copyright(C) 2005-2006, Red Hat, Inc., Ingo Molnar
  *
  * This file contains the needed initializations to support sysenter.
  */
@@ -13,12 +15,31 @@
 #include <linux/gfp.h>
 #include <linux/string.h>
 #include <linux/elf.h>
+#include <linux/mm.h>
+#include <linux/module.h>
 
 #include <asm/cpufeature.h>
 #include <asm/msr.h>
 #include <asm/pgtable.h>
 #include <asm/unistd.h>
 
+/*
+ * Should the kernel map a VDSO page into processes and pass its
+ * address down to glibc upon exec()?
+ */
+unsigned int __read_mostly vdso_enabled = 1;
+
+EXPORT_SYMBOL_GPL(vdso_enabled);
+
+static int __init vdso_setup(char *s)
+{
+	vdso_enabled = simple_strtoul(s, NULL, 0);
+
+	return 1;
+}
+
+__setup("vdso=", vdso_setup);
+
 extern asmlinkage void sysenter_entry(void);
 
 void enable_sep_cpu(void)
@@ -45,23 +66,122 @@ void enable_sep_cpu(void)
  */
 extern const char vsyscall_int80_start, vsyscall_int80_end;
 extern const char vsyscall_sysenter_start, vsyscall_sysenter_end;
+static void *syscall_page;
 
 int __init sysenter_setup(void)
 {
-	void *page = (void *)get_zeroed_page(GFP_ATOMIC);
+	syscall_page = (void *)get_zeroed_page(GFP_ATOMIC);
 
-	__set_fixmap(FIX_VSYSCALL, __pa(page), PAGE_READONLY_EXEC);
+#ifdef CONFIG_COMPAT_VDSO
+	__set_fixmap(FIX_VDSO, __pa(syscall_page), PAGE_READONLY);
+	printk("Compat vDSO mapped to %08lx.\n", __fix_to_virt(FIX_VDSO));
+#else
+	/*
+	 * In the non-compat case the ELF coredumping code needs the fixmap:
+	 */
+	__set_fixmap(FIX_VDSO, __pa(syscall_page), PAGE_KERNEL_RO);
+#endif
 
 	if (!boot_cpu_has(X86_FEATURE_SEP)) {
-		memcpy(page,
+		memcpy(syscall_page,
 		       &vsyscall_int80_start,
 		       &vsyscall_int80_end - &vsyscall_int80_start);
 		return 0;
 	}
 
-	memcpy(page,
+	memcpy(syscall_page,
 	       &vsyscall_sysenter_start,
 	       &vsyscall_sysenter_end - &vsyscall_sysenter_start);
 
 	return 0;
 }
+
+static struct page *syscall_nopage(struct vm_area_struct *vma,
+				unsigned long adr, int *type)
+{
+	struct page *p = virt_to_page(adr - vma->vm_start + syscall_page);
+	get_page(p);
+	return p;
+}
+
+/* Prevent VMA merging */
+static void syscall_vma_close(struct vm_area_struct *vma)
+{
+}
+
+static struct vm_operations_struct syscall_vm_ops = {
+	.close = syscall_vma_close,
+	.nopage = syscall_nopage,
+};
+
+/* Defined in vsyscall-sysenter.S */
+extern void SYSENTER_RETURN;
+
+/* Setup a VMA at program startup for the vsyscall page */
+int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack)
+{
+	struct vm_area_struct *vma;
+	struct mm_struct *mm = current->mm;
+	unsigned long addr;
+	int ret;
+
+	down_write(&mm->mmap_sem);
+	addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0);
+	if (IS_ERR_VALUE(addr)) {
+		ret = addr;
+		goto up_fail;
+	}
+
+	vma = kmem_cache_zalloc(vm_area_cachep, SLAB_KERNEL);
+	if (!vma) {
+		ret = -ENOMEM;
+		goto up_fail;
+	}
+
+	vma->vm_start = addr;
+	vma->vm_end = addr + PAGE_SIZE;
+	/* MAYWRITE to allow gdb to COW and set breakpoints */
+	vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE;
+	vma->vm_flags |= mm->def_flags;
+	vma->vm_page_prot = protection_map[vma->vm_flags & 7];
+	vma->vm_ops = &syscall_vm_ops;
+	vma->vm_mm = mm;
+
+	ret = insert_vm_struct(mm, vma);
+	if (ret)
+		goto free_vma;
+
+	current->mm->context.vdso = (void *)addr;
+	current_thread_info()->sysenter_return =
+				    (void *)VDSO_SYM(&SYSENTER_RETURN);
+	mm->total_vm++;
+up_fail:
+	up_write(&mm->mmap_sem);
+	return ret;
+
+free_vma:
+	kmem_cache_free(vm_area_cachep, vma);
+	return ret;
+}
+
+const char *arch_vma_name(struct vm_area_struct *vma)
+{
+	if (vma->vm_mm && vma->vm_start == (long)vma->vm_mm->context.vdso)
+		return "[vdso]";
+	return NULL;
+}
+
+struct vm_area_struct *get_gate_vma(struct task_struct *tsk)
+{
+	return NULL;
+}
+
+int in_gate_area(struct task_struct *task, unsigned long addr)
+{
+	return 0;
+}
+
+int in_gate_area_no_task(unsigned long addr)
+{
+	return 0;
+}
diff -puN arch/i386/kernel/vsyscall.lds.S~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma arch/i386/kernel/vsyscall.lds.S
--- a/arch/i386/kernel/vsyscall.lds.S~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma
+++ a/arch/i386/kernel/vsyscall.lds.S
@@ -7,7 +7,7 @@
 
 SECTIONS
 {
-  . = VSYSCALL_BASE + SIZEOF_HEADERS;
+  . = VDSO_PRELINK + SIZEOF_HEADERS;
 
   .hash           : { *(.hash) }		:text
   .dynsym         : { *(.dynsym) }
@@ -20,7 +20,7 @@ SECTIONS
      For the layouts to match, we need to skip more than enough
      space for the dynamic symbol table et al.  If this amount
      is insufficient, ld -shared will barf.  Just increase it here.  */
-  . = VSYSCALL_BASE + 0x400;
+  . = VDSO_PRELINK + 0x400;
 
   .text           : { *(.text) }		:text =0x90909090
   .note		  : { *(.note.*) }		:text :note
diff -puN arch/i386/kernel/vsyscall-sysenter.S~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma arch/i386/kernel/vsyscall-sysenter.S
--- a/arch/i386/kernel/vsyscall-sysenter.S~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma
+++ a/arch/i386/kernel/vsyscall-sysenter.S
@@ -42,10 +42,10 @@ __kernel_vsyscall:
 	/* 7: align return point with nop's to make disassembly easier */
 	.space 7,0x90
 
-	/* 14: System call restart point is here! (SYSENTER_RETURN - 2) */
+	/* 14: System call restart point is here! (SYSENTER_RETURN-2) */
 	jmp .Lenter_kernel
 	/* 16: System call normal return point is here! */
-	.globl SYSENTER_RETURN	/* Symbol used by entry.S.  */
+	.globl SYSENTER_RETURN	/* Symbol used by sysenter.c  */
 SYSENTER_RETURN:
 	pop %ebp
 .Lpop_ebp:
diff -puN Documentation/kernel-parameters.txt~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma Documentation/kernel-parameters.txt
--- a/Documentation/kernel-parameters.txt~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma
+++ a/Documentation/kernel-parameters.txt
@@ -1669,6 +1669,10 @@ running once the system is up.
 	usbhid.mousepoll=
 			[USBHID] The interval which mice are to be polled at.
 
+	vdso=		[IA-32]
+			vdso=1: enable VDSO (default)
+			vdso=0: disable VDSO mapping
+
 	video=		[FB] Frame buffer configuration
 			See Documentation/fb/modedb.txt.
 
diff -puN fs/proc/task_mmu.c~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma fs/proc/task_mmu.c
--- a/fs/proc/task_mmu.c~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma
+++ a/fs/proc/task_mmu.c
@@ -122,6 +122,11 @@ struct mem_size_stats
 	unsigned long private_dirty;
 };
 
+__attribute__((weak)) const char *arch_vma_name(struct vm_area_struct *vma)
+{
+	return NULL;
+}
+
 static int show_map_internal(struct seq_file *m, void *v, struct mem_size_stats *mss)
 {
 	struct proc_maps_private *priv = m->private;
@@ -158,22 +163,23 @@ static int show_map_internal(struct seq_
 		pad_len_spaces(m, len);
 		seq_path(m, file->f_vfsmnt, file->f_dentry, "\n");
 	} else {
-		if (mm) {
-			if (vma->vm_start <= mm->start_brk &&
+		const char *name = arch_vma_name(vma);
+		if (!name) {
+			if (mm) {
+				if (vma->vm_start <= mm->start_brk &&
 						vma->vm_end >= mm->brk) {
-				pad_len_spaces(m, len);
-				seq_puts(m, "[heap]");
-			} else {
-				if (vma->vm_start <= mm->start_stack &&
-					vma->vm_end >= mm->start_stack) {
-
-					pad_len_spaces(m, len);
-					seq_puts(m, "[stack]");
+					name = "[heap]";
+				} else if (vma->vm_start <= mm->start_stack &&
+					   vma->vm_end >= mm->start_stack) {
+					name = "[stack]";
 				}
+			} else {
+				name = "[vdso]";
 			}
-		} else {
+		}
+		if (name) {
 			pad_len_spaces(m, len);
-			seq_puts(m, "[vdso]");
+			seq_puts(m, name);
 		}
 	}
 	seq_putc(m, '\n');
diff -puN include/asm-i386/elf.h~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma include/asm-i386/elf.h
--- a/include/asm-i386/elf.h~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma
+++ a/include/asm-i386/elf.h
@@ -10,6 +10,7 @@
 #include <asm/processor.h>
 #include <asm/system.h>		/* for savesegment */
 #include <asm/auxvec.h>
+#include <asm/desc.h>
 
 #include <linux/utsname.h>
 
@@ -129,15 +130,41 @@ extern int dump_task_extended_fpu (struc
 #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
 #define ELF_CORE_COPY_XFPREGS(tsk, elf_xfpregs) dump_task_extended_fpu(tsk, elf_xfpregs)
 
-#define VSYSCALL_BASE	(__fix_to_virt(FIX_VSYSCALL))
-#define VSYSCALL_EHDR	((const struct elfhdr *) VSYSCALL_BASE)
-#define VSYSCALL_ENTRY	((unsigned long) &__kernel_vsyscall)
+#define VDSO_HIGH_BASE		(__fix_to_virt(FIX_VDSO))
+#define VDSO_BASE		((unsigned long)current->mm->context.vdso)
+
+#ifdef CONFIG_COMPAT_VDSO
+# define VDSO_COMPAT_BASE	VDSO_HIGH_BASE
+# define VDSO_PRELINK		VDSO_HIGH_BASE
+#else
+# define VDSO_COMPAT_BASE	VDSO_BASE
+# define VDSO_PRELINK		0
+#endif
+
+#define VDSO_COMPAT_SYM(x) \
+		(VDSO_COMPAT_BASE + (unsigned long)(x) - VDSO_PRELINK)
+
+#define VDSO_SYM(x) \
+		(VDSO_BASE + (unsigned long)(x) - VDSO_PRELINK)
+
+#define VDSO_HIGH_EHDR		((const struct elfhdr *) VDSO_HIGH_BASE)
+#define VDSO_EHDR		((const struct elfhdr *) VDSO_COMPAT_BASE)
+
 extern void __kernel_vsyscall;
 
+#define VDSO_ENTRY		VDSO_SYM(&__kernel_vsyscall)
+
+#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
+struct linux_binprm;
+extern int arch_setup_additional_pages(struct linux_binprm *bprm,
+                                       int executable_stack);
+
+extern unsigned int vdso_enabled;
+
 #define ARCH_DLINFO						\
-do {								\
-		NEW_AUX_ENT(AT_SYSINFO,	VSYSCALL_ENTRY);	\
-		NEW_AUX_ENT(AT_SYSINFO_EHDR, VSYSCALL_BASE);	\
+do if (vdso_enabled) {						\
+		NEW_AUX_ENT(AT_SYSINFO,	VDSO_ENTRY);		\
+		NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_COMPAT_BASE);	\
 } while (0)
 
 /*
@@ -148,15 +175,15 @@ do {								\
  * Dumping its extra ELF program headers includes all the other information
  * a debugger needs to easily find how the vsyscall DSO was being used.
  */
-#define ELF_CORE_EXTRA_PHDRS		(VSYSCALL_EHDR->e_phnum)
+#define ELF_CORE_EXTRA_PHDRS		(VDSO_HIGH_EHDR->e_phnum)
 #define ELF_CORE_WRITE_EXTRA_PHDRS					      \
 do {									      \
 	const struct elf_phdr *const vsyscall_phdrs =			      \
-		(const struct elf_phdr *) (VSYSCALL_BASE		      \
-					   + VSYSCALL_EHDR->e_phoff);	      \
+		(const struct elf_phdr *) (VDSO_HIGH_BASE		      \
+					   + VDSO_HIGH_EHDR->e_phoff);    \
 	int i;								      \
 	Elf32_Off ofs = 0;						      \
-	for (i = 0; i < VSYSCALL_EHDR->e_phnum; ++i) {			      \
+	for (i = 0; i < VDSO_HIGH_EHDR->e_phnum; ++i) {		      \
 		struct elf_phdr phdr = vsyscall_phdrs[i];		      \
 		if (phdr.p_type == PT_LOAD) {				      \
 			BUG_ON(ofs != 0);				      \
@@ -174,10 +201,10 @@ do {									      \
 #define ELF_CORE_WRITE_EXTRA_DATA					      \
 do {									      \
 	const struct elf_phdr *const vsyscall_phdrs =			      \
-		(const struct elf_phdr *) (VSYSCALL_BASE		      \
-					   + VSYSCALL_EHDR->e_phoff);	      \
+		(const struct elf_phdr *) (VDSO_HIGH_BASE		      \
+					   + VDSO_HIGH_EHDR->e_phoff);    \
 	int i;								      \
-	for (i = 0; i < VSYSCALL_EHDR->e_phnum; ++i) {			      \
+	for (i = 0; i < VDSO_HIGH_EHDR->e_phnum; ++i) {		      \
 		if (vsyscall_phdrs[i].p_type == PT_LOAD)		      \
 			DUMP_WRITE((void *) vsyscall_phdrs[i].p_vaddr,	      \
 				   PAGE_ALIGN(vsyscall_phdrs[i].p_memsz));    \
diff -puN include/asm-i386/fixmap.h~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma include/asm-i386/fixmap.h
--- a/include/asm-i386/fixmap.h~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma
+++ a/include/asm-i386/fixmap.h
@@ -51,7 +51,7 @@
  */
 enum fixed_addresses {
 	FIX_HOLE,
-	FIX_VSYSCALL,
+	FIX_VDSO,
 #ifdef CONFIG_X86_LOCAL_APIC
 	FIX_APIC_BASE,	/* local (CPU) APIC) -- required for SMP or not */
 #endif
@@ -115,14 +115,6 @@ extern void __set_fixmap (enum fixed_add
 #define __fix_to_virt(x)	(FIXADDR_TOP - ((x) << PAGE_SHIFT))
 #define __virt_to_fix(x)	((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
 
-/*
- * This is the range that is readable by user mode, and things
- * acting like user mode such as get_user_pages.
- */
-#define FIXADDR_USER_START	(__fix_to_virt(FIX_VSYSCALL))
-#define FIXADDR_USER_END	(FIXADDR_USER_START + PAGE_SIZE)
-
-
 extern void __this_fixmap_does_not_exist(void);
 
 /*
diff -puN include/asm-i386/mmu.h~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma include/asm-i386/mmu.h
--- a/include/asm-i386/mmu.h~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma
+++ a/include/asm-i386/mmu.h
@@ -12,6 +12,7 @@ typedef struct { 
 	int size;
 	struct semaphore sem;
 	void *ldt;
+	void *vdso;
 } mm_context_t;
 
 #endif
diff -puN include/asm-i386/page.h~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma include/asm-i386/page.h
--- a/include/asm-i386/page.h~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma
+++ a/include/asm-i386/page.h
@@ -96,6 +96,8 @@ typedef struct { unsigned long pgprot; }
 
 #ifndef __ASSEMBLY__
 
+struct vm_area_struct;
+
 /*
  * This much address space is reserved for vmalloc() and iomap()
  * as well as fixmap mappings.
@@ -139,6 +141,7 @@ extern int page_is_ram(unsigned long pag
 #include <asm-generic/memory_model.h>
 #include <asm-generic/page.h>
 
+#define __HAVE_ARCH_GATE_AREA 1
 #endif /* __KERNEL__ */
 
 #endif /* _I386_PAGE_H */
diff -puN include/asm-i386/thread_info.h~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma include/asm-i386/thread_info.h
--- a/include/asm-i386/thread_info.h~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma
+++ a/include/asm-i386/thread_info.h
@@ -37,6 +37,7 @@ struct thread_info {
 					 	   0-0xBFFFFFFF for user-thead
 						   0-0xFFFFFFFF for kernel-thread
 						*/
+	void			*sysenter_return;
 	struct restart_block    restart_block;
 
 	unsigned long           previous_esp;   /* ESP of the previous stack in case
diff -puN include/asm-i386/unwind.h~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma include/asm-i386/unwind.h
--- a/include/asm-i386/unwind.h~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma
+++ a/include/asm-i386/unwind.h
@@ -78,8 +78,8 @@ static inline int arch_unw_user_mode(con
 	return user_mode_vm(&info->regs);
 #else
 	return info->regs.eip < PAGE_OFFSET
-	       || (info->regs.eip >= __fix_to_virt(FIX_VSYSCALL)
-	            && info->regs.eip < __fix_to_virt(FIX_VSYSCALL) + PAGE_SIZE)
+	       || (info->regs.eip >= __fix_to_virt(FIX_VDSO)
+	            && info->regs.eip < __fix_to_virt(FIX_VDSO) + PAGE_SIZE)
 	       || info->regs.esp < PAGE_OFFSET;
 #endif
 }
diff -puN include/linux/mm.h~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma include/linux/mm.h
--- a/include/linux/mm.h~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma
+++ a/include/linux/mm.h
@@ -1065,5 +1065,7 @@ void drop_slab(void);
 extern int randomize_va_space;
 #endif
 
+const char *arch_vma_name(struct vm_area_struct *vma);
+
 #endif /* __KERNEL__ */
 #endif /* _LINUX_MM_H */
diff -puN include/linux/sysctl.h~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma include/linux/sysctl.h
--- a/include/linux/sysctl.h~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma
+++ a/include/linux/sysctl.h
@@ -189,6 +189,7 @@ enum
 	VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */
 	VM_ZONE_RECLAIM_INTERVAL=32, /* time period to wait after reclaim failure */
 	VM_PANIC_ON_OOM=33,	/* panic at out-of-memory */
+	VM_VDSO_ENABLED=34,	/* map VDSO into new processes? */
 };
 
 
diff -puN kernel/sysctl.c~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma kernel/sysctl.c
--- a/kernel/sysctl.c~vdso-randomize-the-i386-vdso-by-moving-it-into-a-vma
+++ a/kernel/sysctl.c
@@ -928,6 +928,18 @@ static ctl_table vm_table[] = {
 		.strategy	= &sysctl_jiffies,
 	},
 #endif
+#ifdef CONFIG_X86_32
+	{
+		.ctl_name	= VM_VDSO_ENABLED,
+		.procname	= "vdso_enabled",
+		.data		= &vdso_enabled,
+		.maxlen		= sizeof(vdso_enabled),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &zero,
+	},
+#endif
 	{ .ctl_name = 0 }
 };
 
_

Patches currently in -mm which might be from mingo@xxxxxxx are

origin.patch
disable-debugging-version-of-write_lock.patch
cpu_relax-use-in-acpi-lock-fix.patch
acpi_srat-needs-acpi.patch
lock-validator-fix-ns83820c-irq-flags-bug.patch
revert-gregkh-pci-pci-test-that-drivers-properly-call-pci_set_master.patch
x86-do_irq-check-irq-number.patch
sched-clean-up-fallout-of-recent-changes.patch
sched-cleanup-remove-task_t-convert-to-struct-task_struct.patch
sched-cleanup-convert-schedc-internal-typedefs-to-struct.patch
sched-fix-bug-in-__migrate_task.patch
sched-add-above-background-load-function.patch
mm-implement-swap-prefetching.patch
sched-cleanup-remove-task_t-convert-to-struct-task_struct-prefetch.patch
genirq-rename-desc-handler-to-desc-chip.patch
genirq-rename-desc-handler-to-desc-chip-power-fix.patch
genirq-rename-desc-handler-to-desc-chip-ia64-fix.patch
genirq-rename-desc-handler-to-desc-chip-ia64-fix-2.patch
genirq-rename-desc-handler-to-desc-chip-terminate_irqs-fix.patch
genirq-sem2mutex-probe_sem-probing_active.patch
genirq-cleanup-merge-irq_affinity-into-irq_desc.patch
genirq-cleanup-remove-irq_descp.patch
genirq-cleanup-remove-irq_descp-fix.patch
genirq-cleanup-remove-fastcall.patch
genirq-cleanup-misc-code-cleanups.patch
genirq-cleanup-reduce-irq_desc_t-use-mark-it-obsolete.patch
genirq-cleanup-include-linux-irqh.patch
genirq-cleanup-merge-irq_dir-smp_affinity_entry-into-irq_desc.patch
genirq-cleanup-merge-pending_irq_cpumask-into-irq_desc.patch
genirq-cleanup-turn-arch_has_irq_per_cpu-into-config_irq_per_cpu.patch
genirq-debug-better-debug-printout-in-enable_irq.patch
genirq-add-retrigger-irq-op-to-consolidate-hw_irq_resend.patch
genirq-doc-comment-include-linux-irqh-structures.patch
genirq-doc-handle_irq_event-and-__do_irq-comments.patch
genirq-cleanup-no_irq_type-cleanups.patch
genirq-doc-add-design-documentation.patch
genirq-add-genirq-sw-irq-retrigger.patch
genirq-add-irq_noprobe-support.patch
genirq-add-irq_norequest-support.patch
genirq-add-irq_noautoen-support.patch
genirq-update-copyrights.patch
genirq-core.patch
genirq-core-revert-noisiness-on-spurious-interrupts.patch
genirq-msi-fixes-2.patch
genirq-add-irq-chip-support.patch
genirq-add-irq-chip-support-fix.patch
genirq-add-irq-chip-support-misroute-irq-dont-call-desc-chip-end.patch
genirq-add-handle_bad_irq.patch
genirq-add-irq-wake-power-management-support.patch
genirq-add-sa_trigger-support.patch
genirq-cleanup-no_irq_type-no_irq_chip-rename.patch
genirq-more-verbose-debugging-on-unexpected-irq-vectors.patch
genirq-ia64-build-fix.patch
genirq-add-irq_type_sense_mask.patch
genirq-add-irq-chip-support-fasteoi-handler-handle-interrupt-disabling.patch
genirq-irq-document-what-an-irq-is.patch
genirq-add-chip-eoi-fastack-fasteoi-core.patch
genirq-add-chip-eoi-fastack-fasteoi-fix.patch
lockdep-floppyc-irq-release-fix.patch
lockdep-acpi-locking-fix.patch
lockdep-console_init-after-local_irq_enable.patch
lockdep-add-is_module_address.patch
lockdep-add-print_ip_sym.patch
lockdep-add-per_cpu_offset.patch
lockdep-add-disable-enable_irq_lockdep-api.patch
lockdep-add-local_irq_enable_in_hardirq-api.patch
lockdep-add-declare_completion_onstack-api.patch
lockdep-clean-up-rwsems.patch
lockdep-remove-rwsem_debug-remnants.patch
lockdep-rename-debug_warn_on.patch
lockdep-remove-debug_bug_on.patch
lockdep-remove-mutex-deadlock-checking-code.patch
lockdep-better-lock-debugging.patch
lockdep-mutex-section-binutils-workaround.patch
lockdep-locking-init-debugging-improvement.patch
lockdep-beautify-x86_64-stacktraces.patch
lockdep-x86_64-document-stack-frame-internals.patch
lockdep-i386-remove-multi-entry-backtraces.patch
lockdep-stacktrace-subsystem-core.patch
lockdep-s390-config_frame_pointer-support.patch
lockdep-stacktrace-subsystem-i386-support.patch
lockdep-stacktrace-subsystem-x86_64-support.patch
lockdep-stacktrace-subsystem-s390-support.patch
lockdep-irqtrace-subsystem-core.patch
lockdep-irqtrace-subsystem-docs.patch
lockdep-irqtrace-subsystem-i386-support.patch
lockdep-irqtrace-cleanup-of-include-asm-i386-irqflagsh.patch
lockdep-irqtrace-subsystem-x86_64-support.patch
lockdep-irqtrace-subsystem-x86_64-support-fix.patch
lockdep-irqtrace-subsystem-x86_64-support-fix-2.patch
lockdep-irqtrace-cleanup-of-include-asm-x86_64-irqflagsh.patch
lockdep-irqtrace-subsystem-s390-support.patch
lockdep-locking-api-self-tests.patch
lockdep-core.patch
lockdep-design-docs.patch
lockdep-procfs.patch
lockdep-prove-rwsem-locking-correctness.patch
lockdep-prove-spinlock-rwlock-locking-correctness.patch
lockdep-prove-mutex-locking-correctness.patch
lockdep-kconfig.patch
lockdep-print-all-lock-classes-on-sysrq-d.patch
lockdep-x86_64-early-init.patch
lockdep-x86-smp-alternatives-workaround.patch
lockdep-do-not-recurse-in-printk.patch
lockdep-fix-rt_hash_lock_sz.patch
lockdep-s390-turn-validator-off-in-machine-check-handler.patch
lockdep-enable-on-i386.patch
lockdep-enable-on-x86_64.patch
lockdep-enable-on-s390.patch
lockdep-annotate-direct-io.patch
lockdep-annotate-serial.patch
lockdep-annotate-dcache.patch
lockdep-annotate-i_mutex.patch
lockdep-annotate-futex.patch
lockdep-annotate-genirq.patch
lockdep-annotate-waitqueues.patch
lockdep-annotate-mm.patch
lockdep-annotate-serio.patch
lockdep-annotate-skb_queue_head_init.patch
lockdep-annotate-timer-base-locks.patch
lockdep-annotate-scheduler-runqueue-locks.patch
lockdep-annotate-hrtimer-base-locks.patch
lockdep-annotate-sock_lock_init.patch
lockdep-annotate-af_unix-locking.patch
lockdep-annotate-bh_lock_sock.patch
lockdep-annotate-ieee1394-skb-queue-head-locking.patch
lockdep-annotate-mmap_sem.patch
lockdep-annotate-sunrpc-code.patch
lockdep-annotate-ntfs-locking-rules.patch
lockdep-annotate-the-quota-code.patch
lockdep-annotate-usbfs.patch
lockdep-annotate-sound-core-seq-seq_portsc.patch
lockdep-annotate-sound-core-seq-seq_devicec.patch
lockdep-annotate-8390c-disable_irq.patch
lockdep-annotate-3c59xc-disable_irq.patch
lockdep-annotate-forcedethc-disable_irq.patch
lockdep-annotate-enable_in_hardirq.patch
lockdep-annotate-on-stack-completions.patch
lockdep-annotate-qeth-driver.patch
lockdep-annotate-s_lock.patch
lockdep-annotate-sb-s_umount.patch
lockdep-annotate-slab-code.patch
lockdep-annotate-blkdev-nesting.patch
lockdep-annotate-vlan-net-device-as-being-a-special-class.patch
lockdep-annotate-vlan-net-device-as-being-a-special-class-fix.patch
detect-atomic-counter-underflows.patch
debug-shared-irqs.patch
make-frame_pointer-default=y.patch
mutex-subsystem-synchro-test-module.patch
vdso-print-fatal-signals.patch
vdso-improve-print_fatal_signals-support-by-adding-memory-maps.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