Skip to contentSkip to conversation

fix 31-bit s390 checkpoint/restart wrappers

PATCH In review Serge E. Hallyn 2 participants 2 messages Jan 28, 2010 – Feb 5, 2010 1 message not in the archive s390

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix 31-bit s390 checkpoint/restart wrappers

This patch makes it possible to compile with CONFIG_COMPAT=y. It also refuses checkpoint of a 31-bit task, or restart from a 31-bit task. That's just a temporary restriction as there won't be time to get 31-bit support for v19.

---
 arch/s390/kernel/checkpoint.c     |    9 +++++++++
 arch/s390/kernel/compat_wrapper.S |   12 +++++++-----
 arch/s390/kernel/process.c        |   12 ++++++++++++
 arch/s390/kernel/syscalls.S       |    2 +-
 4 files changed, 29 insertions(+), 6 deletions(-)
arch/s390/kernel/checkpoint.c +9 -0
index 40dd417..8ec12c6 100644
@@ -83,6 +83,11 @@ static void s390_mm(int op, struct ckpt_hdr_mm_context *h,
 
 int checkpoint_thread(struct ckpt_ctx *ctx, struct task_struct *t)
 {
+	/* we will eventually support this, as we do on x86-64 */
+	if (test_tsk_thread_flag(t, TIF_31BIT)) {
+		ckpt_err(ctx, -EINVAL, "checkpoint of 31-bit task\n");
+		return -EINVAL;
+	}
 	return 0;
 }
 
@@ -143,6 +148,10 @@ int checkpoint_mm_context(struct ckpt_ctx *ctx, struct mm_struct *mm)
 
 int restore_thread(struct ckpt_ctx *ctx)
 {
+	if (test_tsk_thread_flag(current, TIF_31BIT)) {
+		ckpt_err(ctx, -EINVAL, "restart from 31-bit task\n");
+		return -EINVAL;
+	}
 	return 0;
 }
 
arch/s390/kernel/compat_wrapper.S +7 -5
index 8d0ba6a..bb38630 100644
@@ -1869,11 +1869,13 @@ sys_checkpoint_wrapper:
 	lgfr	%r2,%r2			# pid_t
 	lgfr	%r3,%r3			# int
 	llgfr	%r4,%r4			# unsigned long
-	jg	compat_sys_checkpoint
+	lgfr	%r5,%r5			# int
+	jg	sys_checkpoint
 
-	.globl sys_restore_wrapper
-sys_restore_wrapper:
-	lgfr	%r2,%r2			# int
+	.globl sys_restart_wrapper
+sys_restart_wrapper:
+	lgfr	%r2,%r2			# pid_t
 	lgfr	%r3,%r3			# int
 	llgfr	%r4,%r4			# unsigned long
-	jg	compat_sys_restore
+	lgfr	%r5,%r5			# int
+	jg	sys_restart
arch/s390/kernel/process.c +12 -0
index a7cb6bc..61b469f 100644
@@ -258,6 +258,18 @@ SYSCALL_DEFINE4(restart, pid_t, pid, int, fd, unsigned long, flags,
 {
 	return do_sys_restart(pid, fd, flags, logfd);
 }
+#else
+SYSCALL_DEFINE4(checkpoint, pid_t, pid, int, fd, unsigned long, flags,
+		int, logfd)
+{
+	return -ENOSYS;
+}
+
+SYSCALL_DEFINE4(restart, pid_t, pid, int, fd, unsigned long, flags,
+		int, logfd)
+{
+	return -ENOSYS;
+}
 #endif
 
 SYSCALL_DEFINE4(eclone, unsigned int, flags_low, struct clone_args __user *,
arch/s390/kernel/syscalls.S +1 -1
index ff222e1..a29f9e1 100644
@@ -342,4 +342,4 @@ SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo
 SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper)
 SYSCALL(sys_eclone,sys_eclone,sys_eclone_wrapper)
 SYSCALL(sys_checkpoint,sys_checkpoint,sys_checkpoint_wrapper)
-SYSCALL(sys_restart,sys_restart,sys_restore_wrapper)
+SYSCALL(sys_restart,sys_restart,sys_restart_wrapper)
Signature · 1 line
1.6.1

A message that is not in the archive (sent off-list or not yet received): 20100128181138.GA18197-r/[email protected]

#2 lore raw

Got it

Quoted 96 lines · Serge E. Hallyn

This patch makes it possible to compile with CONFIG_COMPAT=y. It also refuses checkpoint of a 31-bit task, or restart from a 31-bit task. That's just a temporary restriction as there won't be time to get 31-bit support for v19.

---
 arch/s390/kernel/checkpoint.c     |    9 +++++++++
 arch/s390/kernel/compat_wrapper.S |   12 +++++++-----
 arch/s390/kernel/process.c        |   12 ++++++++++++
 arch/s390/kernel/syscalls.S       |    2 +-
 4 files changed, 29 insertions(+), 6 deletions(-)
arch/s390/kernel/checkpoint.c +9 -0
index 40dd417..8ec12c6 100644
@@ -83,6 +83,11 @@ static void s390_mm(int op, struct ckpt_hdr_mm_context *h,
 
 int checkpoint_thread(struct ckpt_ctx *ctx, struct task_struct *t)
 {
+	/* we will eventually support this, as we do on x86-64 */
+	if (test_tsk_thread_flag(t, TIF_31BIT)) {
+		ckpt_err(ctx, -EINVAL, "checkpoint of 31-bit task\n");
+		return -EINVAL;
+	}
 	return 0;
 }
 
@@ -143,6 +148,10 @@ int checkpoint_mm_context(struct ckpt_ctx *ctx, struct mm_struct *mm)
 
 int restore_thread(struct ckpt_ctx *ctx)
 {
+	if (test_tsk_thread_flag(current, TIF_31BIT)) {
+		ckpt_err(ctx, -EINVAL, "restart from 31-bit task\n");
+		return -EINVAL;
+	}
 	return 0;
 }
 
arch/s390/kernel/compat_wrapper.S +7 -5
index 8d0ba6a..bb38630 100644
@@ -1869,11 +1869,13 @@ sys_checkpoint_wrapper:
 	lgfr	%r2,%r2			# pid_t
 	lgfr	%r3,%r3			# int
 	llgfr	%r4,%r4			# unsigned long
-	jg	compat_sys_checkpoint
+	lgfr	%r5,%r5			# int
+	jg	sys_checkpoint
 
-	.globl sys_restore_wrapper
-sys_restore_wrapper:
-	lgfr	%r2,%r2			# int
+	.globl sys_restart_wrapper
+sys_restart_wrapper:
+	lgfr	%r2,%r2			# pid_t
 	lgfr	%r3,%r3			# int
 	llgfr	%r4,%r4			# unsigned long
-	jg	compat_sys_restore
+	lgfr	%r5,%r5			# int
+	jg	sys_restart
arch/s390/kernel/process.c +12 -0
index a7cb6bc..61b469f 100644
@@ -258,6 +258,18 @@ SYSCALL_DEFINE4(restart, pid_t, pid, int, fd, unsigned long, flags,
 {
 	return do_sys_restart(pid, fd, flags, logfd);
 }
+#else
+SYSCALL_DEFINE4(checkpoint, pid_t, pid, int, fd, unsigned long, flags,
+		int, logfd)
+{
+	return -ENOSYS;
+}
+
+SYSCALL_DEFINE4(restart, pid_t, pid, int, fd, unsigned long, flags,
+		int, logfd)
+{
+	return -ENOSYS;
+}
 #endif
 
 SYSCALL_DEFINE4(eclone, unsigned int, flags_low, struct clone_args __user *,
arch/s390/kernel/syscalls.S +1 -1
index ff222e1..a29f9e1 100644
@@ -342,4 +342,4 @@ SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo
 SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper)
 SYSCALL(sys_eclone,sys_eclone,sys_eclone_wrapper)
 SYSCALL(sys_checkpoint,sys_checkpoint,sys_checkpoint_wrapper)
-SYSCALL(sys_restart,sys_restart,sys_restore_wrapper)
+SYSCALL(sys_restart,sys_restart,sys_restart_wrapper)