[PATCH] x86_64 ia32 vDSO: define arch_vma_name
[sfrench/cifs-2.6.git] / arch / x86_64 / ia32 / syscall32.c
index adbc5f8089e9a209707087ca86048c8358caa93e..59f1fa1559151029d99f077d0861cd6bfd17392d 100644 (file)
@@ -49,20 +49,23 @@ int syscall32_setup_pages(struct linux_binprm *bprm, int exstack)
        struct mm_struct *mm = current->mm;
        int ret;
 
-       vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
+       vma = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL);
        if (!vma)
                return -ENOMEM;
-       if (security_vm_enough_memory(npages)) {
-               kmem_cache_free(vm_area_cachep, vma);
-               return -ENOMEM;
-       }
 
        memset(vma, 0, sizeof(struct vm_area_struct));
        /* Could randomize here */
        vma->vm_start = VSYSCALL32_BASE;
        vma->vm_end = VSYSCALL32_END;
        /* MAYWRITE to allow gdb to COW and set breakpoints */
-       vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYEXEC|VM_MAYWRITE;
+       vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE;
+       /*
+        * Make sure the vDSO gets into every core dump.
+        * Dumping its contents makes post-mortem fully interpretable later
+        * without matching up the same kernel and hardware config to see
+        * what PC values meant.
+        */
+       vma->vm_flags |= VM_ALWAYSDUMP;
        vma->vm_flags |= mm->def_flags;
        vma->vm_page_prot = protection_map[vma->vm_flags & 7];
        vma->vm_ops = &syscall32_vm_ops;
@@ -79,6 +82,14 @@ int syscall32_setup_pages(struct linux_binprm *bprm, int exstack)
        return 0;
 }
 
+const char *arch_vma_name(struct vm_area_struct *vma)
+{
+       if (vma->vm_start == VSYSCALL32_BASE &&
+           vma->vm_mm && vma->vm_mm->task_size == IA32_PAGE_OFFSET)
+               return "[vdso]";
+       return NULL;
+}
+
 static int __init init_syscall32(void)
 { 
        syscall32_page = (void *)get_zeroed_page(GFP_KERNEL);