Subject: [PATCHv3 8/8] powerpc/vdso: remove arch_vma_name

From: Dmitry Safonov <[email-masked]>
Date: Thu, 27 Oct 2016 20:09:48 +0300

It's not needed since vdso is inserted with vm_special_mapping
which contains vma name.
This also reverts commit f2053f1a7bf6 ("powerpc/perf_counter: Fix vdso
detection") as not needed anymore.
See also commit f7b6eb3fa072 ("x86: Set context.vdso before installing
the mapping").

Cc: Benjamin Herrenschmidt <[email-masked]>
Cc: Paul Mackerras <[email-masked]>
Cc: Michael Ellerman <[email-masked]>
Cc: Andy Lutomirski <[email-masked]>
Cc: Oleg Nesterov <[email-masked]>
Cc: [email-masked]
Cc: [email-masked]
Signed-off-by: Dmitry Safonov <[email-masked]>
---
 arch/powerpc/kernel/vdso.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 431bdf7ec68e..f66f52aa94de 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -208,13 +208,6 @@ static int map_vdso(struct vm_special_mapping *vsm, unsigned long vdso_pages,
 	vdso_base = ALIGN(vdso_base, VDSO_ALIGNMENT);
 
 	/*
-	 * Put vDSO base into mm struct. We need to do this before calling
-	 * install_special_mapping or the perf counter mmap tracking code
-	 * will fail to recognise it as a vDSO (since arch_vma_name fails).
-	 */
-	current->mm->context.vdso_base = vdso_base;
-
-	/*
 	 * our vma flags don't have VM_WRITE so by default, the process isn't
 	 * allowed to write those pages.
 	 * gdb can break that with ptrace interface, and thus trigger COW on
@@ -228,10 +221,10 @@ static int map_vdso(struct vm_special_mapping *vsm, unsigned long vdso_pages,
 				     VM_READ|VM_EXEC|
 				     VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
 				     vsm);
-	if (IS_ERR(vma)) {
+	if (IS_ERR(vma))
 		ret = PTR_ERR(vma);
-		current->mm->context.vdso_base = 0;
-	}
+	else
+		current->mm->context.vdso_base = vdso_base;
 
 out_up_mmap_sem:
 	up_write(&mm->mmap_sem);
@@ -262,13 +255,6 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 	return -1;
 }
 
-const char *arch_vma_name(struct vm_area_struct *vma)
-{
-	if (vma->vm_mm && vma->vm_start == vma->vm_mm->context.vdso_base)
-		return "[vdso]";
-	return NULL;
-}
-
 #ifdef CONFIG_VDSO32
 #include "vdso_common.c"
 #endif /* CONFIG_VDSO32 */
-- 
2.10.1