Skip to contentSkip to conversation

c/r: Fix arch-specific use of mm->context.vdso in v14-rc3

PATCH In review Dan Smith 3 participants 3 messages Apr 7, 2009 – Apr 12, 2009 1 message not in the archive

Subsystems (5)
x86 PowerPC s390 x86 MM +1 more subsystems
lore
Share & tools
lore

Dan Smith

author
#0 lore raw

PATCH 1/1 c/r: Fix arch-specific use of mm->context.vdso in v14-rc3

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.

---
 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(-)
arch/powerpc/mm/checkpoint.c +6 -0
index 731874b..7d56ff7 100644
@@ -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;
+}
+
arch/s390/mm/checkpoint.c +6 -0
index 263d8bd..68be905 100644
@@ -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;
+}
+
arch/x86/mm/checkpoint.c +5 -0
index 64e6635..0a3fee6 100644
@@ -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;
+}
checkpoint/checkpoint_arch.h +1 -0
index 0afe666..e189811 100644
@@ -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);
checkpoint/rstr_mem.c +1 -1
index 7e73129..ca3a2fd 100644
@@ -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;
Signature · 1 line
1.6.1
#2 lore raw
In reply to a message not in the archive
Quoted 4 lines · Dan Smith

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.

Looks technically correct for powerpc at least, thanks.

#3 lore raw
In reply to a message not in the archive

Added.

Quoted 82 lines · Dan Smith

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.

---
 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(-)
arch/powerpc/mm/checkpoint.c +6 -0
index 731874b..7d56ff7 100644
@@ -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;
+}
+
arch/s390/mm/checkpoint.c +6 -0
index 263d8bd..68be905 100644
@@ -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;
+}
+
arch/x86/mm/checkpoint.c +5 -0
index 64e6635..0a3fee6 100644
@@ -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;
+}
checkpoint/checkpoint_arch.h +1 -0
index 0afe666..e189811 100644
@@ -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);
checkpoint/rstr_mem.c +1 -1
index 7e73129..ca3a2fd 100644
@@ -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;