[CRIU] [PATCH 3/3] arm64: detect vDSO remaps

Alexander Kartashov alekskartashov at parallels.com
Mon Mar 10 03:00:48 PDT 2014


This patch introduces the routine vdso_mapping_open() that
intercepts vDSO VMA remappings and adjusts the pointer
to the vDSO base accordingly.

Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
---
 arch/arm64/kernel/vdso.c |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
index 50384fe..6a51cd1 100644
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -134,6 +134,21 @@ static int __init vdso_init(void)
 }
 arch_initcall(vdso_init);
 
+
+static void vdso_mapping_open(struct vm_area_struct *area)
+{
+	void *vdso_base = (void*)area->vm_start;
+
+	if (area->vm_mm->context.vdso != vdso_base)
+		area->vm_mm->context.vdso = (void*)vdso_base;
+}
+
+static const struct vm_operations_struct vdso_mapping_vmops = {
+	.open = vdso_mapping_open,
+	.close = special_mapping_close,
+	.fault = special_mapping_fault,
+};
+
 int arch_setup_additional_pages(struct linux_binprm *bprm,
 				int uses_interp)
 {
@@ -152,10 +167,10 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
 	}
 	mm->context.vdso = (void *)vdso_base;
 
-	ret = install_special_mapping(mm, vdso_base, vdso_mapping_len,
+	ret = _install_special_mapping(mm, vdso_base, vdso_mapping_len,
 				      VM_READ|VM_EXEC|
 				      VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
-				      vdso_pagelist);
+				      vdso_pagelist, &vdso_mapping_vmops);
 	if (ret) {
 		mm->context.vdso = NULL;
 		goto up_fail;
-- 
1.7.9.5



More information about the CRIU mailing list