x86: Set context.vdso before installing the mapping
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Fri, 5 Jun 2009 12:04:51 +0000 (14:04 +0200)
committerIngo Molnar <mingo@elte.hu>
Fri, 5 Jun 2009 12:46:40 +0000 (14:46 +0200)
In order to make arch_vma_name() work from inside
install_special_mapping() we need to set the context.vdso
before calling it.

( This is needed for performance counters to be able to track
  this special executable area. )

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/vdso/vdso32-setup.c
arch/x86/vdso/vma.c

index 1241f118ab561b181b5dd9634f5c80d7783de493..58bc00f68b12edb451d3f619db81003925f85f47 100644 (file)
@@ -338,6 +338,8 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
                }
        }
 
+       current->mm->context.vdso = (void *)addr;
+
        if (compat_uses_vma || !compat) {
                /*
                 * MAYWRITE to allow gdb to COW and set breakpoints
@@ -358,11 +360,13 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
                        goto up_fail;
        }
 
-       current->mm->context.vdso = (void *)addr;
        current_thread_info()->sysenter_return =
                VDSO32_SYMBOL(addr, SYSENTER_RETURN);
 
   up_fail:
+       if (ret)
+               current->mm->context.vdso = NULL;
+
        up_write(&mm->mmap_sem);
 
        return ret;
index 7133cdf9098b7ef0366871a92c29ef8aa5445209..93b7a2938b2fb22c24c9d3b7dc03baf6f9ffe5cc 100644 (file)
@@ -115,15 +115,18 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
                goto up_fail;
        }
 
+       current->mm->context.vdso = (void *)addr;
+
        ret = install_special_mapping(mm, addr, vdso_size,
                                      VM_READ|VM_EXEC|
                                      VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
                                      VM_ALWAYSDUMP,
                                      vdso_pages);
-       if (ret)
+       if (ret) {
+               current->mm->context.vdso = NULL;
                goto up_fail;
+       }
 
-       current->mm->context.vdso = (void *)addr;
 up_fail:
        up_write(&mm->mmap_sem);
        return ret;