On s390 and PPC, the mm_context does not have a void *vdso member, but
rather an unsigned long vdso_base.  Since we cast the void * to an
unsigned long anyway, add an arch-specific cr_arch_vdso() function to
return the address.

This is tested on s390 and x86, but needs PPC validation.

    Signed-off-by: Dan Smith <[email protected]>
---
 arch/powerpc/mm/checkpoint.c |    6 ++++++
 arch/s390/mm/checkpoint.c    |    6 ++++++
 arch/x86/mm/checkpoint.c     |    5 +++++
 checkpoint/checkpoint_arch.h |    1 +
 checkpoint/rstr_mem.c        |    2 +-
 5 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/mm/checkpoint.c b/arch/powerpc/mm/checkpoint.c
index 731874b..7d56ff7 100644
--- a/arch/powerpc/mm/checkpoint.c
+++ b/arch/powerpc/mm/checkpoint.c
@@ -498,3 +498,9 @@ int cr_read_mm_context(struct cr_ctx *ctx, struct mm_struct 
*mm)
 {
        return 0;
 }
+
+unsigned long cr_arch_vdso(struct cr_ctx *ctx, struct mm_struct *mm)
+{
+       return mm->context.vdso_base;
+}
+
diff --git a/arch/s390/mm/checkpoint.c b/arch/s390/mm/checkpoint.c
index 263d8bd..68be905 100644
--- a/arch/s390/mm/checkpoint.c
+++ b/arch/s390/mm/checkpoint.c
@@ -119,3 +119,9 @@ int cr_write_mm_context(struct cr_ctx *ctx, struct 
mm_struct *mm)
 
        return ret;
 }
+
+unsigned long cr_arch_vdso(struct cr_ctx *ctx, struct mm_struct *mm)
+{
+       return mm->context.vdso_base;
+}
+
diff --git a/arch/x86/mm/checkpoint.c b/arch/x86/mm/checkpoint.c
index 64e6635..0a3fee6 100644
--- a/arch/x86/mm/checkpoint.c
+++ b/arch/x86/mm/checkpoint.c
@@ -271,3 +271,8 @@ int cr_write_mm_context(struct cr_ctx *ctx, struct 
mm_struct *mm)
        mutex_unlock(&mm->context.lock);
        return ret;
 }
+
+unsigned long cr_arch_vdso(struct cr_ctx *ctx, struct mm_struct *mm)
+{
+       return (unsigned long)mm->context.vdso;
+}
diff --git a/checkpoint/checkpoint_arch.h b/checkpoint/checkpoint_arch.h
index 0afe666..e189811 100644
--- a/checkpoint/checkpoint_arch.h
+++ b/checkpoint/checkpoint_arch.h
@@ -1,6 +1,7 @@
 #include <linux/checkpoint.h>
 
 extern int cr_retval_restart(struct cr_ctx *ctx);
+extern unsigned long cr_arch_vdso(struct cr_ctx *ctx, struct mm_struct *mm);
 
 extern int cr_write_head_arch(struct cr_ctx *ctx);
 extern int cr_write_thread(struct cr_ctx *ctx, struct task_struct *t);
diff --git a/checkpoint/rstr_mem.c b/checkpoint/rstr_mem.c
index 7e73129..ca3a2fd 100644
--- a/checkpoint/rstr_mem.c
+++ b/checkpoint/rstr_mem.c
@@ -416,7 +416,7 @@ static int cr_read_vma(struct cr_ctx *ctx, struct mm_struct 
*mm)
 
        /* handle special VDSO vma */
        if (vma_type == CR_VMA_VDSO) {
-               if (vm_start != (unsigned long) mm->context.vdso)
+               if (vm_start != cr_arch_vdso(ctx, mm))
                        goto out;
                /* FIXME: uggh ... need to dig in */
                ret = 0;
-- 
1.6.1

_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers

_______________________________________________
Devel mailing list
[email protected]
https://openvz.org/mailman/listinfo/devel

Reply via email to