LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Re: [PATCH 1/11] Fix CONFIG_COMPAT_VDSO
@ 2007-01-15 11:59 Al Boldi
  0 siblings, 0 replies; 5+ messages in thread
From: Al Boldi @ 2007-01-15 11:59 UTC (permalink / raw)
  To: roland; +Cc: linux-kernel

Roland McGrath wrote:
>
> I wouldn't mind if CONFIG_COMPAT_VDSO went away entirely.
> But if it's there, it should work properly.  Currently
> it's quite haphazard: both real vma and fixmap are
> mapped, both are put in the two different AT_* slots,
> sysenter returns to the vma address rather than the
> fixmap address, and core dumps yet are another story.
>
> This patch makes CONFIG_COMPAT_VDSO disable the real vma
> and use the fixmap area consistently.  This makes it
> actually compatible with what the old vdso implementation did.

I just tried your patch, but your changes seem to revert performance 
improvements achieved with 2.6.19, when vdso_enabled=1 and 
randomize_va_space=0.


Thanks!

--
Al


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/11] Fix CONFIG_COMPAT_VDSO
  2007-01-17  9:03   ` Roland McGrath
@ 2007-01-24 10:25     ` Paul Mundt
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Mundt @ 2007-01-24 10:25 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Ingo Molnar, Linus Torvalds, Andrew Morton, linux-kernel

On Wed, Jan 17, 2007 at 01:03:34AM -0800, Roland McGrath wrote:
> > i think your patches #1...#7 are must-haves for v2.6.20, while #8-#11 
> > could be delayed to v2.6.21?
> 
> Indeed 1-7 are fixes while 8-11 are only cleanups not changing behavior.
> 
Here's an update for the SH bits when the 8-11 parts are ready..

Signed-off-by: Paul Mundt <lethal@linux-sh.org>

diff --git a/arch/sh/kernel/vsyscall/vsyscall.c b/arch/sh/kernel/vsyscall/vsyscall.c
index deb4694..7b0f66f 100644
--- a/arch/sh/kernel/vsyscall/vsyscall.c
+++ b/arch/sh/kernel/vsyscall/vsyscall.c
@@ -37,11 +37,12 @@ __setup("vdso=", vdso_setup);
  * of the ELF DSO images included therein.
  */
 extern const char vsyscall_trapa_start, vsyscall_trapa_end;
-static void *syscall_page;
+static struct page *syscall_pages[1];
 
 int __init vsyscall_init(void)
 {
-	syscall_page = (void *)get_zeroed_page(GFP_ATOMIC);
+	void *syscall_page = (void *)get_zeroed_page(GFP_ATOMIC);
+	syscall_pages[0] = virt_to_page(syscall_page);
 
 	/*
 	 * XXX: Map this page to a fixmap entry if we get around
@@ -55,37 +56,10 @@ int __init vsyscall_init(void)
 	return 0;
 }
 
-static struct page *syscall_vma_nopage(struct vm_area_struct *vma,
-				       unsigned long address, int *type)
-{
-	unsigned long offset = address - vma->vm_start;
-	struct page *page;
-
-	if (address < vma->vm_start || address > vma->vm_end)
-		return NOPAGE_SIGBUS;
-
-	page = virt_to_page(syscall_page + offset);
-
-	get_page(page);
-
-	return page;
-}
-
-/* Prevent VMA merging */
-static void syscall_vma_close(struct vm_area_struct *vma)
-{
-}
-
-static struct vm_operations_struct syscall_vm_ops = {
-	.nopage	= syscall_vma_nopage,
-	.close	= syscall_vma_close,
-};
-
 /* Setup a VMA at program startup for the vsyscall page */
 int arch_setup_additional_pages(struct linux_binprm *bprm,
 				int executable_stack)
 {
-	struct vm_area_struct *vma;
 	struct mm_struct *mm = current->mm;
 	unsigned long addr;
 	int ret;
@@ -97,30 +71,16 @@ int arch_setup_additional_pages(struct l
 		goto up_fail;
 	}
 
-	vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
-	if (!vma) {
-		ret = -ENOMEM;
+	ret = install_special_mapping(mm, addr, PAGE_SIZE,
+				      VM_READ | VM_EXEC |
+				      VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC |
+				      VM_ALWAYSDUMP,
+				      syscall_pages);
+	if (unlikely(ret))
 		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 (unlikely(ret)) {
-		kmem_cache_free(vm_area_cachep, vma);
-		goto up_fail;
-	}
 
 	current->mm->context.vdso = (void *)addr;
 
-	mm->total_vm++;
 up_fail:
 	up_write(&mm->mmap_sem);
 	return ret;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/11] Fix CONFIG_COMPAT_VDSO
  2007-01-17  8:49 ` Ingo Molnar
@ 2007-01-17  9:03   ` Roland McGrath
  2007-01-24 10:25     ` Paul Mundt
  0 siblings, 1 reply; 5+ messages in thread
From: Roland McGrath @ 2007-01-17  9:03 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Linus Torvalds, Andrew Morton, linux-kernel

> i think your patches #1...#7 are must-haves for v2.6.20, while #8-#11 
> could be delayed to v2.6.21?

Indeed 1-7 are fixes while 8-11 are only cleanups not changing behavior.


Thanks,
Roland

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/11] Fix CONFIG_COMPAT_VDSO
  2007-01-14  5:31 Roland McGrath
@ 2007-01-17  8:49 ` Ingo Molnar
  2007-01-17  9:03   ` Roland McGrath
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2007-01-17  8:49 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Linus Torvalds, Andrew Morton, linux-kernel


* Roland McGrath <roland@redhat.com> wrote:

> I wouldn't mind if CONFIG_COMPAT_VDSO went away entirely. But if it's 
> there, it should work properly.  Currently it's quite haphazard: both 
> real vma and fixmap are mapped, both are put in the two different AT_* 
> slots, sysenter returns to the vma address rather than the fixmap 
> address, and core dumps yet are another story.

i think your patches #1...#7 are must-haves for v2.6.20, while #8-#11 
could be delayed to v2.6.21?

	Ingo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/11] Fix CONFIG_COMPAT_VDSO
@ 2007-01-14  5:31 Roland McGrath
  2007-01-17  8:49 ` Ingo Molnar
  0 siblings, 1 reply; 5+ messages in thread
From: Roland McGrath @ 2007-01-14  5:31 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel


I wouldn't mind if CONFIG_COMPAT_VDSO went away entirely.
But if it's there, it should work properly.  Currently
it's quite haphazard: both real vma and fixmap are
mapped, both are put in the two different AT_* slots,
sysenter returns to the vma address rather than the
fixmap address, and core dumps yet are another story.

This patch makes CONFIG_COMPAT_VDSO disable the real vma
and use the fixmap area consistently.  This makes it
actually compatible with what the old vdso implementation did.

Signed-off-by: Roland McGrath <roland@redhat.com>
---
 arch/i386/kernel/entry.S    |    4 ++++
 arch/i386/kernel/sysenter.c |    2 ++
 include/asm-i386/elf.h      |    7 +++----
 include/asm-i386/fixmap.h   |    2 ++
 include/asm-i386/page.h     |    2 ++
 5 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
index 06461b8..5e47683 100644  
--- a/arch/i386/kernel/entry.S
+++ b/arch/i386/kernel/entry.S
@@ -302,12 +302,16 @@ sysenter_past_esp:
 	pushl $(__USER_CS)
 	CFI_ADJUST_CFA_OFFSET 4
 	/*CFI_REL_OFFSET cs, 0*/
+#ifndef CONFIG_COMPAT_VDSO
 	/*
 	 * 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)
+#else
+	pushl $SYSENTER_RETURN
+#endif
 	CFI_ADJUST_CFA_OFFSET 4
 	CFI_REL_OFFSET eip, 0
 
diff --git a/arch/i386/kernel/sysenter.c b/arch/i386/kernel/sysenter.c
index 7de9117..454d12d 100644  
--- a/arch/i386/kernel/sysenter.c
+++ b/arch/i386/kernel/sysenter.c
@@ -100,6 +100,7 @@ int __init sysenter_setup(void)
 	return 0;
 }
 
+#ifndef CONFIG_COMPAT_VDSO
 static struct page *syscall_nopage(struct vm_area_struct *vma,
 				unsigned long adr, int *type)
 {
@@ -187,3 +188,4 @@ int in_gate_area_no_task(unsigned long a
 {
 	return 0;
 }
+#endif
diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h
index 45d21a0..0515d61 100644  
--- a/include/asm-i386/elf.h
+++ b/include/asm-i386/elf.h
@@ -143,11 +143,8 @@ extern int dump_task_extended_fpu (struc
 # 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)
+		(VDSO_COMPAT_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)
@@ -156,10 +153,12 @@ extern void __kernel_vsyscall;
 
 #define VDSO_ENTRY		VDSO_SYM(&__kernel_vsyscall)
 
+#ifndef CONFIG_COMPAT_VDSO
 #define ARCH_HAS_SETUP_ADDITIONAL_PAGES
 struct linux_binprm;
 extern int arch_setup_additional_pages(struct linux_binprm *bprm,
                                        int executable_stack);
+#endif
 
 extern unsigned int vdso_enabled;
 
diff --git a/include/asm-i386/fixmap.h b/include/asm-i386/fixmap.h
index 02428cb..3e9f610 100644  
--- a/include/asm-i386/fixmap.h
+++ b/include/asm-i386/fixmap.h
@@ -23,6 +23,8 @@
 extern unsigned long __FIXADDR_TOP;
 #else
 #define __FIXADDR_TOP  0xfffff000
+#define FIXADDR_USER_START	__fix_to_virt(FIX_VDSO)
+#define FIXADDR_USER_END	__fix_to_virt(FIX_VDSO - 1)
 #endif
 
 #ifndef __ASSEMBLY__
diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h
index fd3f64a..7b19f45 100644  
--- a/include/asm-i386/page.h
+++ b/include/asm-i386/page.h
@@ -143,7 +143,9 @@ extern int page_is_ram(unsigned long pag
 #include <asm-generic/memory_model.h>
 #include <asm-generic/page.h>
 
+#ifndef CONFIG_COMPAT_VDSO
 #define __HAVE_ARCH_GATE_AREA 1
+#endif
 #endif /* __KERNEL__ */
 
 #endif /* _I386_PAGE_H */

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-01-24 10:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-15 11:59 [PATCH 1/11] Fix CONFIG_COMPAT_VDSO Al Boldi
  -- strict thread matches above, loose matches on Subject: below --
2007-01-14  5:31 Roland McGrath
2007-01-17  8:49 ` Ingo Molnar
2007-01-17  9:03   ` Roland McGrath
2007-01-24 10:25     ` Paul Mundt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).