public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Andrew Morton <akpm@osdl.org>
Cc: torvalds@osdl.org, rusty@rustcorp.com.au,
	linux-kernel@vger.kernel.org, virtualization@lists.osdl.org,
	kraxel@suse.de, zach@vmware.com
Subject: Re: [patch] i386, vdso=[0|1] boot option and /proc/sys/vm/vdso_enabled
Date: Sat, 20 May 2006 11:54:23 +0200	[thread overview]
Message-ID: <20060520095423.GA660@elte.hu> (raw)
In-Reply-To: <20060520022650.46b048f8.akpm@osdl.org>


* Andrew Morton <akpm@osdl.org> wrote:

> >  arch/i386/kernel/sysenter.c |   21 +++++++++++++++++++++
> >  include/linux/sysctl.h      |    1 +
> >  kernel/sysctl.c             |   16 ++++++++++++++++
> >  3 files changed, 38 insertions(+)
> 
> Documentation/kernel-parameters.txt, please.

grumble. I had this done but quilt didnt pick it up.

> > +unsigned int vdso_enabled = 1;
> 
> __read_mostly.

done. New patch attached.

------
Subject: i386, vdso=[0|1] boot option and /proc/sys/vm/vdso_enabled
From: Ingo Molnar <mingo@elte.hu>

add the vdso=0 boot option and the /proc/sys/vm/vdso_enabled
sysctl, on i386. VDSO defaults to enabled.

 # cat /proc/self/maps | grep vdso
 b7f42000-b7f43000 r-xp b7f42000 00:00 0          [vdso]
 # echo 0 > /proc/sys/vm/vdso_enabled
 # cat /proc/self/maps | grep vdso
 # echo 1 > /proc/sys/vm/vdso_enabled
 # cat /proc/self/maps | grep vdso
 b7f05000-b7f06000 r-xp b7f05000 00:00 0          [vdso]
 #

Signed-off-by: Ingo Molnar <mingo@elte.hu>

---
 Documentation/kernel-parameters.txt |    4 ++++
 arch/i386/kernel/sysenter.c         |   21 +++++++++++++++++++++
 include/linux/sysctl.h              |    1 +
 kernel/sysctl.c                     |   16 ++++++++++++++++
 4 files changed, 42 insertions(+)

Index: linux-vdso-rand.q/Documentation/kernel-parameters.txt
===================================================================
--- linux-vdso-rand.q.orig/Documentation/kernel-parameters.txt
+++ linux-vdso-rand.q/Documentation/kernel-parameters.txt
@@ -1646,6 +1646,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.
 
Index: linux-vdso-rand.q/arch/i386/kernel/sysenter.c
===================================================================
--- linux-vdso-rand.q.orig/arch/i386/kernel/sysenter.c
+++ linux-vdso-rand.q/arch/i386/kernel/sysenter.c
@@ -22,6 +22,21 @@
 #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;
+
+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)
@@ -97,6 +112,9 @@ int arch_setup_additional_pages(struct l
 	unsigned long addr;
 	int ret;
 
+	if (unlikely(!vdso_enabled))
+		return 0;
+
 	down_write(&mm->mmap_sem);
 	addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0);
 	if (IS_ERR_VALUE(addr)) {
@@ -122,16 +140,19 @@ int arch_setup_additional_pages(struct l
 	ret = insert_vm_struct(mm, vma);
 	if (ret)
 		goto free_vma;
+
 	current->mm->context.vdso = (void *)addr;
 	current_thread_info()->sysenter_return = SYSENTER_RETURN_OFFSET + addr;
 	mm->total_vm++;
 	up_write(&mm->mmap_sem);
+
 	return 0;
 
 free_vma:
 	kmem_cache_free(vm_area_cachep, vma);
 up_fail:
 	up_write(&mm->mmap_sem);
+
 	return ret;
 }
 
Index: linux-vdso-rand.q/include/linux/sysctl.h
===================================================================
--- linux-vdso-rand.q.orig/include/linux/sysctl.h
+++ linux-vdso-rand.q/include/linux/sysctl.h
@@ -186,6 +186,7 @@ enum
 	VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */
 	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_VDSO_ENABLED=33,	/* map VDSO into new processes? */
 };
 
 
Index: linux-vdso-rand.q/kernel/sysctl.c
===================================================================
--- linux-vdso-rand.q.orig/kernel/sysctl.c
+++ linux-vdso-rand.q/kernel/sysctl.c
@@ -158,6 +158,10 @@ extern ctl_table inotify_table[];
 int sysctl_legacy_va_layout;
 #endif
 
+#ifdef CONFIG_X86_32
+extern int vdso_enabled;
+#endif
+
 /* /proc declarations: */
 
 #ifdef CONFIG_PROC_FS
@@ -915,6 +919,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 }
 };
 

  parent reply	other threads:[~2006-05-20  9:54 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-16  6:03 [PATCH] Gerd Hoffman's move-vsyscall-into-user-address-range patch Rusty Russell
2006-05-16  6:47 ` Ingo Molnar
2006-05-16  8:16   ` Zachary Amsden
2006-05-16  8:40     ` Chris Wright
2006-05-16  8:59       ` Zachary Amsden
2006-05-17  7:49   ` Rusty Russell
2006-05-18  7:54     ` Ingo Molnar
2006-05-18  8:29       ` Gerd Hoffmann
2006-05-20  0:43     ` Andrew Morton
2006-05-20  1:03       ` Ingo Molnar
2006-05-20  1:11         ` Andrew Morton
2006-05-20  1:15           ` Linus Torvalds
2006-05-20  8:53             ` [patch] i386, vdso=[0|1] boot option and /proc/sys/vm/vdso_enabled Ingo Molnar
2006-05-20  9:26               ` Andrew Morton
2006-05-20  9:30                 ` Zachary Amsden
2006-05-20  9:43                   ` Zachary Amsden
2006-05-20  9:48                   ` Andrew Morton
2006-05-20 10:04                     ` Zachary Amsden
2006-05-21  4:38                       ` Rusty Russell
2006-05-21  9:35                         ` Rusty Russell
2006-05-21  9:52                           ` Andrew Morton
2006-05-21 10:41                           ` Ingo Molnar
2006-05-21 11:06                             ` Rusty Russell
2006-05-20  9:54                 ` Ingo Molnar [this message]
2006-05-20 10:16                 ` [patch] add print_fatal_signals support Ingo Molnar
2006-05-21 11:03                 ` [patch] i386, vdso=[0|1] boot option and /proc/sys/vm/vdso_enabled Ingo Molnar
2006-05-21 11:38                   ` Ingo Molnar
2006-05-21 12:33                     ` Andrew Morton
2006-05-21 14:10                 ` Arjan van de Ven
2006-05-22 14:32                   ` Alexey Kuznetsov
2006-05-20  1:16           ` [PATCH] Gerd Hoffman's move-vsyscall-into-user-address-range patch Zachary Amsden
2006-05-20  1:49           ` Andi Kleen
2006-05-20  1:24       ` Arjan van de Ven
2006-05-22 16:29       ` Jakub Jelinek
2006-05-22 16:44         ` Zachary Amsden
2006-05-22 17:14           ` Andrew Morton
2006-05-22 17:27             ` Ingo Molnar
2006-05-22 17:46               ` Linus Torvalds
2006-05-22 19:09                 ` Ingo Molnar
2006-05-22 19:40                   ` Linus Torvalds
2006-05-22 19:14                 ` Adrian Bunk
2006-05-22 19:45                   ` Linus Torvalds
2006-05-22 17:53               ` Andrew Morton

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=20060520095423.GA660@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@osdl.org \
    --cc=kraxel@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@osdl.org \
    --cc=virtualization@lists.osdl.org \
    --cc=zach@vmware.com \
    /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