All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] s390: fix checkpoint and restart compat wrappers
@ 2009-06-15 17:04 Serge E. Hallyn
       [not found] ` <20090615170443.GA14808-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Serge E. Hallyn @ 2009-06-15 17:04 UTC (permalink / raw)
  To: Linux Containers

They need to actually jump to the real syscall.

Though c/r from 31-bit compat is completely untested and
should maybe just be disabled for now...

Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
 arch/s390/kernel/compat_wrapper.S |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index ece87c8..c2228b2 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1829,9 +1829,11 @@ sys_checkpoint_wrapper:
 	lgfr	%r2,%r2			# pid_t
 	lgfr	%r3,%r3			# int
 	llgfr	%r4,%r4			# unsigned long
+	jg	compat_sys_checkpoint
 
 	.globl sys_restore_wrapper
 sys_restore_wrapper:
 	lgfr	%r2,%r2			# int
 	lgfr	%r3,%r3			# int
 	llgfr	%r4,%r4			# unsigned long
+	jg	compat_sys_restore
-- 
1.6.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] clone_with_pids: define the s390 syscall
       [not found] ` <20090615170443.GA14808-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2009-06-15 17:05   ` Serge E. Hallyn
       [not found]     ` <20090615170524.GA14950-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Serge E. Hallyn @ 2009-06-15 17:05 UTC (permalink / raw)
  To: Linux Containers; +Cc: linux-s390-u79uwXL29TY76Z2rM5mHXA

Hook up the clone_with_pids system call for s390x.  clone_with_pids()
takes an additional argument over clone(), which we pass in through
register 7.  Stub code for using the syscall looks like:

struct target_pid_set {
        int num_pids;
        pid_t *target_pids;
        unsigned long flags;
};

        register unsigned long int __r2 asm ("2") = (unsigned long int)(stack);\
        register unsigned long int __r3 asm ("3") = (unsigned long int)(flags);\
        register unsigned long int __r4 asm ("4") = (unsigned long int)(NULL); \
        register unsigned long int __r5 asm ("5") = (unsigned long int)(NULL); \
        register unsigned long int __r6 asm ("6") = (unsigned long int)(NULL); \
        register unsigned long int __r7 asm ("7") = (unsigned long int)(setp); \
        register unsigned long int __result asm ("2"); \
        __asm__ __volatile__( \
                " lghi %%r1,332\n" \
                " svc 0\n" \
                : "=d" (__result) \
                : "0" (__r2), "d" (__r3), \
                  "d" (__r4), "d" (__r5), "d" (__r6), "d" (__r7) \
                : "1", "cc", "memory" \
        ); \
                __result; \
        })

        struct target_pid_set pid_set;
        int pids[1] = { 19799 };
        pid_set.num_pids = 1;
        pid_set.target_pids = &pids[0];
        pid_set.flags = 0;

        rc = do_clone_with_pids(topstack, clone_flags, setp);
	if (rc == 0)
		printf("Child\n");
	else if (rc > 0)
		printf("Parent: child pid %d\n", rc);
	else
		printf("Error %d\n", rc);

Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
 arch/s390/include/asm/unistd.h    |    3 ++-
 arch/s390/kernel/compat_wrapper.S |   10 ++++++++++
 arch/s390/kernel/process.c        |   19 +++++++++++++++++++
 3 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h
index 3d22f17..d2facab 100644
--- a/arch/s390/include/asm/unistd.h
+++ b/arch/s390/include/asm/unistd.h
@@ -269,7 +269,8 @@
 #define	__NR_pwritev		329
 #define __NR_checkpoint		330
 #define __NR_restart		331
-#define NR_syscalls 332
+#define __NR_clone_with_pids	332
+#define NR_syscalls 333
 
 /* 
  * There are some system calls that are not present on 64 bit, some
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index c2228b2..bf13315 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1837,3 +1837,13 @@ sys_restore_wrapper:
 	lgfr	%r3,%r3			# int
 	llgfr	%r4,%r4			# unsigned long
 	jg	compat_sys_restore
+
+	.globl sys_clone_with_pids_wrapper
+sys_clone_with_pids_wrapper:
+	llgfr	%r2,%r2			# unsigned long
+	llgfr	%r3,%r3			# unsigned long
+	llgtr	%r4,%r4			# int *
+	llgtr	%r5,%r5			# int *
+	llgtr	%r6,%r6			# void *
+	llgtr	%r7,%r7			# void *
+	jg	compat_sys_clone_with_pids
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index a3acd8e..fa187bf 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -246,6 +246,25 @@ SYSCALL_DEFINE0(clone)
 		       parent_tidptr, child_tidptr);
 }
 
+SYSCALL_DEFINE0(clone_with_pids)
+{
+	struct pt_regs *regs = task_pt_regs(current);
+	unsigned long clone_flags;
+	unsigned long newsp;
+	int __user *parent_tidptr, *child_tidptr;
+	void __user *upid_setp;
+
+	clone_flags = regs->gprs[3];
+	newsp = regs->orig_gpr2;
+	parent_tidptr = (int __user *) regs->gprs[4];
+	child_tidptr = (int __user *) regs->gprs[5];
+	upid_setp = (void __user *) regs->gprs[7];
+	if (!newsp)
+		newsp = regs->gprs[15];
+	return do_fork_with_pids(clone_flags, newsp, regs, 0, parent_tidptr,
+			child_tidptr, upid_setp);
+}
+
 /*
  * This is trivial, and on the face of it looks like it
  * could equally well be done in user mode.
-- 
1.6.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] clone_with_pids: define the s390 syscall
  2009-06-15 17:05   ` [PATCH 2/2] clone_with_pids: define the s390 syscall Serge E. Hallyn
@ 2009-06-15 17:16         ` Serge E. Hallyn
  0 siblings, 0 replies; 8+ messages in thread
From: Serge E. Hallyn @ 2009-06-15 17:16 UTC (permalink / raw)
  To: Linux Containers; +Cc: linux-s390-u79uwXL29TY76Z2rM5mHXA

Gah, sorry, git user error.  syscalls.S update was not in the patch.
Here is an update:

thanks,
-serge

From 788c5bcc14211608f187f36d327a9d6d87b19755 Mon Sep 17 00:00:00 2001
From: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Date: Mon, 15 Jun 2009 12:14:11 -0400
Subject: [PATCH 2/2] clone_with_pids: define the s390 syscall

Hook up the clone_with_pids system call for s390x.  clone_with_pids()
takes an additional argument over clone(), which we pass in through
register 7.  Stub code for using the syscall looks like:

struct target_pid_set {
        int num_pids;
        pid_t *target_pids;
        unsigned long flags;
};

        register unsigned long int __r2 asm ("2") = (unsigned long int)(stack);\
        register unsigned long int __r3 asm ("3") = (unsigned long int)(flags);\
        register unsigned long int __r4 asm ("4") = (unsigned long int)(NULL); \
        register unsigned long int __r5 asm ("5") = (unsigned long int)(NULL); \
        register unsigned long int __r6 asm ("6") = (unsigned long int)(NULL); \
        register unsigned long int __r7 asm ("7") = (unsigned long int)(setp); \
        register unsigned long int __result asm ("2"); \
        __asm__ __volatile__( \
                " lghi %%r1,332\n" \
                " svc 0\n" \
                : "=d" (__result) \
                : "0" (__r2), "d" (__r3), \
                  "d" (__r4), "d" (__r5), "d" (__r6), "d" (__r7) \
                : "1", "cc", "memory" \
        ); \
                __result; \
        })

        struct target_pid_set pid_set;
        int pids[1] = { 19799 };
        pid_set.num_pids = 1;
        pid_set.target_pids = &pids[0];
        pid_set.flags = 0;

        rc = do_clone_with_pids(topstack, clone_flags, setp);
	if (rc == 0)
		printf("Child\n");
	else if (rc > 0)
		printf("Parent: child pid %d\n", rc);
	else
		printf("Error %d\n", rc);

Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
 arch/s390/include/asm/unistd.h    |    3 ++-
 arch/s390/kernel/compat_wrapper.S |   10 ++++++++++
 arch/s390/kernel/process.c        |   19 +++++++++++++++++++
 arch/s390/kernel/syscalls.S       |    1 +
 4 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h
index 3d22f17..d2facab 100644
--- a/arch/s390/include/asm/unistd.h
+++ b/arch/s390/include/asm/unistd.h
@@ -269,7 +269,8 @@
 #define	__NR_pwritev		329
 #define __NR_checkpoint		330
 #define __NR_restart		331
-#define NR_syscalls 332
+#define __NR_clone_with_pids	332
+#define NR_syscalls 333
 
 /* 
  * There are some system calls that are not present on 64 bit, some
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index c2228b2..bf13315 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1837,3 +1837,13 @@ sys_restore_wrapper:
 	lgfr	%r3,%r3			# int
 	llgfr	%r4,%r4			# unsigned long
 	jg	compat_sys_restore
+
+	.globl sys_clone_with_pids_wrapper
+sys_clone_with_pids_wrapper:
+	llgfr	%r2,%r2			# unsigned long
+	llgfr	%r3,%r3			# unsigned long
+	llgtr	%r4,%r4			# int *
+	llgtr	%r5,%r5			# int *
+	llgtr	%r6,%r6			# void *
+	llgtr	%r7,%r7			# void *
+	jg	compat_sys_clone_with_pids
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index a3acd8e..fa187bf 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -246,6 +246,25 @@ SYSCALL_DEFINE0(clone)
 		       parent_tidptr, child_tidptr);
 }
 
+SYSCALL_DEFINE0(clone_with_pids)
+{
+	struct pt_regs *regs = task_pt_regs(current);
+	unsigned long clone_flags;
+	unsigned long newsp;
+	int __user *parent_tidptr, *child_tidptr;
+	void __user *upid_setp;
+
+	clone_flags = regs->gprs[3];
+	newsp = regs->orig_gpr2;
+	parent_tidptr = (int __user *) regs->gprs[4];
+	child_tidptr = (int __user *) regs->gprs[5];
+	upid_setp = (void __user *) regs->gprs[7];
+	if (!newsp)
+		newsp = regs->gprs[15];
+	return do_fork_with_pids(clone_flags, newsp, regs, 0, parent_tidptr,
+			child_tidptr, upid_setp);
+}
+
 /*
  * This is trivial, and on the face of it looks like it
  * could equally well be done in user mode.
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index e755e93..1d638f5 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -340,3 +340,4 @@ SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv_wrapper)
 SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper)
 SYSCALL(sys_checkpoint,sys_checkpoint,sys_checkpoint_wrapper) /* 330 */
 SYSCALL(sys_restart,sys_restart,sys_restore_wrapper)
+SYSCALL(sys_clone_with_pids,sys_clone_with_pids,sys_clone_with_pids_wrapper)
-- 
1.6.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] clone_with_pids: define the s390 syscall
@ 2009-06-15 17:16         ` Serge E. Hallyn
  0 siblings, 0 replies; 8+ messages in thread
From: Serge E. Hallyn @ 2009-06-15 17:16 UTC (permalink / raw)
  To: linux-s390

Gah, sorry, git user error.  syscalls.S update was not in the patch.
Here is an update:

thanks,
-serge

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] clone_with_pids: define the s390 syscall
       [not found]         ` <20090615171645.GA15217-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2009-06-19  6:56           ` Oren Laadan
  2009-06-19 11:16           ` Martin Schwidefsky
  1 sibling, 0 replies; 8+ messages in thread
From: Oren Laadan @ 2009-06-19  6:56 UTC (permalink / raw)
  To: Serge E. Hallyn; +Cc: Linux Containers, linux-s390-u79uwXL29TY76Z2rM5mHXA


Applied.

Serge E. Hallyn wrote:
> Gah, sorry, git user error.  syscalls.S update was not in the patch.
> Here is an update:
> 
> thanks,
> -serge
> 
> From 788c5bcc14211608f187f36d327a9d6d87b19755 Mon Sep 17 00:00:00 2001
> From: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> Date: Mon, 15 Jun 2009 12:14:11 -0400
> Subject: [PATCH 2/2] clone_with_pids: define the s390 syscall
> 
> Hook up the clone_with_pids system call for s390x.  clone_with_pids()
> takes an additional argument over clone(), which we pass in through
> register 7.  Stub code for using the syscall looks like:
> 
> struct target_pid_set {
>         int num_pids;
>         pid_t *target_pids;
>         unsigned long flags;
> };
> 
>         register unsigned long int __r2 asm ("2") = (unsigned long int)(stack);\
>         register unsigned long int __r3 asm ("3") = (unsigned long int)(flags);\
>         register unsigned long int __r4 asm ("4") = (unsigned long int)(NULL); \
>         register unsigned long int __r5 asm ("5") = (unsigned long int)(NULL); \
>         register unsigned long int __r6 asm ("6") = (unsigned long int)(NULL); \
>         register unsigned long int __r7 asm ("7") = (unsigned long int)(setp); \
>         register unsigned long int __result asm ("2"); \
>         __asm__ __volatile__( \
>                 " lghi %%r1,332\n" \
>                 " svc 0\n" \
>                 : "=d" (__result) \
>                 : "0" (__r2), "d" (__r3), \
>                   "d" (__r4), "d" (__r5), "d" (__r6), "d" (__r7) \
>                 : "1", "cc", "memory" \
>         ); \
>                 __result; \
>         })
> 
>         struct target_pid_set pid_set;
>         int pids[1] = { 19799 };
>         pid_set.num_pids = 1;
>         pid_set.target_pids = &pids[0];
>         pid_set.flags = 0;
> 
>         rc = do_clone_with_pids(topstack, clone_flags, setp);
> 	if (rc == 0)
> 		printf("Child\n");
> 	else if (rc > 0)
> 		printf("Parent: child pid %d\n", rc);
> 	else
> 		printf("Error %d\n", rc);
> 
> Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> ---
>  arch/s390/include/asm/unistd.h    |    3 ++-
>  arch/s390/kernel/compat_wrapper.S |   10 ++++++++++
>  arch/s390/kernel/process.c        |   19 +++++++++++++++++++
>  arch/s390/kernel/syscalls.S       |    1 +
>  4 files changed, 32 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h
> index 3d22f17..d2facab 100644
> --- a/arch/s390/include/asm/unistd.h
> +++ b/arch/s390/include/asm/unistd.h
> @@ -269,7 +269,8 @@
>  #define	__NR_pwritev		329
>  #define __NR_checkpoint		330
>  #define __NR_restart		331
> -#define NR_syscalls 332
> +#define __NR_clone_with_pids	332
> +#define NR_syscalls 333
>  
>  /* 
>   * There are some system calls that are not present on 64 bit, some
> diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
> index c2228b2..bf13315 100644
> --- a/arch/s390/kernel/compat_wrapper.S
> +++ b/arch/s390/kernel/compat_wrapper.S
> @@ -1837,3 +1837,13 @@ sys_restore_wrapper:
>  	lgfr	%r3,%r3			# int
>  	llgfr	%r4,%r4			# unsigned long
>  	jg	compat_sys_restore
> +
> +	.globl sys_clone_with_pids_wrapper
> +sys_clone_with_pids_wrapper:
> +	llgfr	%r2,%r2			# unsigned long
> +	llgfr	%r3,%r3			# unsigned long
> +	llgtr	%r4,%r4			# int *
> +	llgtr	%r5,%r5			# int *
> +	llgtr	%r6,%r6			# void *
> +	llgtr	%r7,%r7			# void *
> +	jg	compat_sys_clone_with_pids
> diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
> index a3acd8e..fa187bf 100644
> --- a/arch/s390/kernel/process.c
> +++ b/arch/s390/kernel/process.c
> @@ -246,6 +246,25 @@ SYSCALL_DEFINE0(clone)
>  		       parent_tidptr, child_tidptr);
>  }
>  
> +SYSCALL_DEFINE0(clone_with_pids)
> +{
> +	struct pt_regs *regs = task_pt_regs(current);
> +	unsigned long clone_flags;
> +	unsigned long newsp;
> +	int __user *parent_tidptr, *child_tidptr;
> +	void __user *upid_setp;
> +
> +	clone_flags = regs->gprs[3];
> +	newsp = regs->orig_gpr2;
> +	parent_tidptr = (int __user *) regs->gprs[4];
> +	child_tidptr = (int __user *) regs->gprs[5];
> +	upid_setp = (void __user *) regs->gprs[7];
> +	if (!newsp)
> +		newsp = regs->gprs[15];
> +	return do_fork_with_pids(clone_flags, newsp, regs, 0, parent_tidptr,
> +			child_tidptr, upid_setp);
> +}
> +
>  /*
>   * This is trivial, and on the face of it looks like it
>   * could equally well be done in user mode.
> diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
> index e755e93..1d638f5 100644
> --- a/arch/s390/kernel/syscalls.S
> +++ b/arch/s390/kernel/syscalls.S
> @@ -340,3 +340,4 @@ SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv_wrapper)
>  SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper)
>  SYSCALL(sys_checkpoint,sys_checkpoint,sys_checkpoint_wrapper) /* 330 */
>  SYSCALL(sys_restart,sys_restart,sys_restore_wrapper)
> +SYSCALL(sys_clone_with_pids,sys_clone_with_pids,sys_clone_with_pids_wrapper)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] clone_with_pids: define the s390 syscall
       [not found]         ` <20090615171645.GA15217-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
  2009-06-19  6:56           ` Oren Laadan
@ 2009-06-19 11:16           ` Martin Schwidefsky
  2009-06-19 15:13             ` Serge E. Hallyn
  1 sibling, 1 reply; 8+ messages in thread
From: Martin Schwidefsky @ 2009-06-19 11:16 UTC (permalink / raw)
  To: Serge E. Hallyn; +Cc: Linux Containers, linux-s390-u79uwXL29TY76Z2rM5mHXA

Hi Serge,

On Mon, 15 Jun 2009 12:16:45 -0500
"Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> wrote:

> diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
> index c2228b2..bf13315 100644
> --- a/arch/s390/kernel/compat_wrapper.S
> +++ b/arch/s390/kernel/compat_wrapper.S
> @@ -1837,3 +1837,13 @@ sys_restore_wrapper:
>  	lgfr	%r3,%r3			# int
>  	llgfr	%r4,%r4			# unsigned long
>  	jg	compat_sys_restore
> +
> +	.globl sys_clone_with_pids_wrapper
> +sys_clone_with_pids_wrapper:
> +	llgfr	%r2,%r2			# unsigned long
> +	llgfr	%r3,%r3			# unsigned long
> +	llgtr	%r4,%r4			# int *
> +	llgtr	%r5,%r5			# int *
> +	llgtr	%r6,%r6			# void *
> +	llgtr	%r7,%r7			# void *
> +	jg	compat_sys_clone_with_pids

This is incorrect. If you have a system call that takes 6 parameters
you need to load/store the 6th parameter from the stack. Check out the
futex system call wrapper. But before you do that see the next comment.

> diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
> index a3acd8e..fa187bf 100644
> --- a/arch/s390/kernel/process.c
> +++ b/arch/s390/kernel/process.c
> @@ -246,6 +246,25 @@ SYSCALL_DEFINE0(clone)
>  		       parent_tidptr, child_tidptr);
>  }
> 
> +SYSCALL_DEFINE0(clone_with_pids)
> +{
> +	struct pt_regs *regs = task_pt_regs(current);
> +	unsigned long clone_flags;
> +	unsigned long newsp;
> +	int __user *parent_tidptr, *child_tidptr;
> +	void __user *upid_setp;
> +
> +	clone_flags = regs->gprs[3];
> +	newsp = regs->orig_gpr2;
> +	parent_tidptr = (int __user *) regs->gprs[4];
> +	child_tidptr = (int __user *) regs->gprs[5];
> +	upid_setp = (void __user *) regs->gprs[7];
> +	if (!newsp)
> +		newsp = regs->gprs[15];
> +	return do_fork_with_pids(clone_flags, newsp, regs, 0, parent_tidptr,
> +			child_tidptr, upid_setp);
> +}
> +
>  /*
>   * This is trivial, and on the face of it looks like it
>   * could equally well be done in user mode.

clone_with_pids is declared as system call with no paramters. In this
case the system call wrapper is not needed (empty) and you have to do
the compat conversion inside the system call. See sys32_clone.

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] clone_with_pids: define the s390 syscall
  2009-06-19 11:16           ` Martin Schwidefsky
@ 2009-06-19 15:13             ` Serge E. Hallyn
       [not found]               ` <20090619151341.GC22381-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Serge E. Hallyn @ 2009-06-19 15:13 UTC (permalink / raw)
  To: Martin Schwidefsky; +Cc: Linux Containers, linux-s390-u79uwXL29TY76Z2rM5mHXA

Quoting Martin Schwidefsky (schwidefsky-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org):
> Hi Serge,
> 
> On Mon, 15 Jun 2009 12:16:45 -0500
> "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> wrote:
> 
> > diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
> > index c2228b2..bf13315 100644
> > --- a/arch/s390/kernel/compat_wrapper.S
> > +++ b/arch/s390/kernel/compat_wrapper.S
> > @@ -1837,3 +1837,13 @@ sys_restore_wrapper:
> >  	lgfr	%r3,%r3			# int
> >  	llgfr	%r4,%r4			# unsigned long
> >  	jg	compat_sys_restore
> > +
> > +	.globl sys_clone_with_pids_wrapper
> > +sys_clone_with_pids_wrapper:
> > +	llgfr	%r2,%r2			# unsigned long
> > +	llgfr	%r3,%r3			# unsigned long
> > +	llgtr	%r4,%r4			# int *
> > +	llgtr	%r5,%r5			# int *
> > +	llgtr	%r6,%r6			# void *
> > +	llgtr	%r7,%r7			# void *
> > +	jg	compat_sys_clone_with_pids
> 
> This is incorrect. If you have a system call that takes 6 parameters
> you need to load/store the 6th parameter from the stack. Check out the
> futex system call wrapper. But before you do that see the next comment.
> 
> > diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
> > index a3acd8e..fa187bf 100644
> > --- a/arch/s390/kernel/process.c
> > +++ b/arch/s390/kernel/process.c
> > @@ -246,6 +246,25 @@ SYSCALL_DEFINE0(clone)
> >  		       parent_tidptr, child_tidptr);
> >  }
> > 
> > +SYSCALL_DEFINE0(clone_with_pids)
> > +{
> > +	struct pt_regs *regs = task_pt_regs(current);
> > +	unsigned long clone_flags;
> > +	unsigned long newsp;
> > +	int __user *parent_tidptr, *child_tidptr;
> > +	void __user *upid_setp;
> > +
> > +	clone_flags = regs->gprs[3];
> > +	newsp = regs->orig_gpr2;
> > +	parent_tidptr = (int __user *) regs->gprs[4];
> > +	child_tidptr = (int __user *) regs->gprs[5];
> > +	upid_setp = (void __user *) regs->gprs[7];
> > +	if (!newsp)
> > +		newsp = regs->gprs[15];
> > +	return do_fork_with_pids(clone_flags, newsp, regs, 0, parent_tidptr,
> > +			child_tidptr, upid_setp);
> > +}
> > +
> >  /*
> >   * This is trivial, and on the face of it looks like it
> >   * could equally well be done in user mode.
> 
> clone_with_pids is declared as system call with no paramters. In this
> case the system call wrapper is not needed (empty) and you have to do
> the compat conversion inside the system call. See sys32_clone.

Ah, I see, thanks.

So in that case, is it ok for me to just use gprs[7] to pass in the
upid_setp variable?

thanks,
-serge

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] clone_with_pids: define the s390 syscall
       [not found]               ` <20090619151341.GC22381-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2009-06-22  7:21                 ` Martin Schwidefsky
  0 siblings, 0 replies; 8+ messages in thread
From: Martin Schwidefsky @ 2009-06-22  7:21 UTC (permalink / raw)
  To: Serge E. Hallyn; +Cc: Linux Containers, linux-s390-u79uwXL29TY76Z2rM5mHXA

On Fri, 19 Jun 2009 10:13:41 -0500
"Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> wrote:

> > clone_with_pids is declared as system call with no paramters. In this
> > case the system call wrapper is not needed (empty) and you have to do
> > the compat conversion inside the system call. See sys32_clone.  
> 
> Ah, I see, thanks.
> 
> So in that case, is it ok for me to just use gprs[7] to pass in the
> upid_setp variable?

Yes, correct.

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-06-22  7:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-15 17:04 [PATCH 1/2] s390: fix checkpoint and restart compat wrappers Serge E. Hallyn
     [not found] ` <20090615170443.GA14808-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-06-15 17:05   ` [PATCH 2/2] clone_with_pids: define the s390 syscall Serge E. Hallyn
     [not found]     ` <20090615170524.GA14950-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-06-15 17:16       ` Serge E. Hallyn
2009-06-15 17:16         ` Serge E. Hallyn
     [not found]         ` <20090615171645.GA15217-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-06-19  6:56           ` Oren Laadan
2009-06-19 11:16           ` Martin Schwidefsky
2009-06-19 15:13             ` Serge E. Hallyn
     [not found]               ` <20090619151341.GC22381-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-06-22  7:21                 ` Martin Schwidefsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.