Re: [systemd-devel] [PATCH] nspawn: fix invocation of the raw clone() system call on s390 and cris
On 12/15/2014 06:27 PM, Lennart Poettering wrote: On Mon, 15.12.14 08:01, Ken Werner (k...@linux.vnet.ibm.com) wrote: From: Ken Werner k...@linux.vnet.ibm.com Since the order of the first and second arguments of the raw clone() system call is reversed on s390 and cris it needs to be invoked differently. Signed-off-by: Ken Werner k...@linux.vnet.ibm.com Hmm, I'd prefer if we could move the definition of this syscall wrapper into missing.h, and do the per-arch magic there, like we do for all the other syscalls missing from glibc. Maybe call the function raw_clone() there or so. Alright, I'll create and post an updated patch. Alternatively we could move to the glibc-provided wrapper, but I think it's nastier to use, since it requires a stack parameter to be specified. @@ -3133,9 +3133,17 @@ int main(int argc, char *argv[]) { goto finish; } +#if defined(__s390__) || defined(__CRIS) +/* On s390 and cris the order of the first and second arguments + * of the raw clone() system call is reversed. */ +pid = syscall(__NR_clone, NULL, SIGCHLD|CLONE_NEWNS| + (arg_share_system ? 0 : CLONE_NEWIPC|CLONE_NEWPID|CLONE_NEWUTS)| + (arg_private_network ? CLONE_NEWNET : 0)); +#else pid = syscall(__NR_clone, SIGCHLD|CLONE_NEWNS| (arg_share_system ? 0 : CLONE_NEWIPC|CLONE_NEWPID|CLONE_NEWUTS)| (arg_private_network ? CLONE_NEWNET : 0), NULL); +#endif if (pid 0) { if (errno == EINVAL) r = log_error_errno(errno, clone() failed, do you have namespace support enabled in your kernel? (You need UTS, IPC, PID and NET namespacing built in): %m); -- 1.7.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel Lennart Regards, Ken ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] nspawn: fix invocation of the raw clone() system call on s390 and cris
From: Ken Werner k...@linux.vnet.ibm.com Since the order of the first and second arguments of the raw clone() system call is reversed on s390 and cris it needs to be invoked differently. Signed-off-by: Ken Werner k...@linux.vnet.ibm.com --- src/nspawn/nspawn.c |6 +++--- src/shared/missing.h | 10 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 9ca53cd..a13c1fc 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -3133,9 +3133,9 @@ int main(int argc, char *argv[]) { goto finish; } -pid = syscall(__NR_clone, SIGCHLD|CLONE_NEWNS| - (arg_share_system ? 0 : CLONE_NEWIPC|CLONE_NEWPID|CLONE_NEWUTS)| - (arg_private_network ? CLONE_NEWNET : 0), NULL); +pid = raw_clone(SIGCHLD|CLONE_NEWNS| +(arg_share_system ? 0 : CLONE_NEWIPC|CLONE_NEWPID|CLONE_NEWUTS)| +(arg_private_network ? CLONE_NEWNET : 0), NULL); if (pid 0) { if (errno == EINVAL) r = log_error_errno(errno, clone() failed, do you have namespace support enabled in your kernel? (You need UTS, IPC, PID and NET namespacing built in): %m); diff --git a/src/shared/missing.h b/src/shared/missing.h index c547479..bea1254 100644 --- a/src/shared/missing.h +++ b/src/shared/missing.h @@ -635,3 +635,13 @@ static inline int setns(int fd, int nstype) { #ifndef CAP_AUDIT_READ #define CAP_AUDIT_READ 37 #endif + +static inline long raw_clone(unsigned long flags, void *child_stack) { +#if defined(__s390__) || defined(__CRIS__) +/* On s390 and cris the order of the first and second arguments + * of the raw clone() system call is reversed. */ +return syscall(__NR_clone, child_stack, flags); +#else +return syscall(__NR_clone, flags, child_stack); +#endif +} -- 1.7.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] nspawn: fix invocation of the raw clone() system call on s390 and cris
On Tue, Dec 16, 2014 at 06:06:41PM +0100, Ken Werner wrote: From: Ken Werner k...@linux.vnet.ibm.com Since the order of the first and second arguments of the raw clone() system call is reversed on s390 and cris it needs to be invoked differently. Applied. Zbyszek ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] nspawn: fix invocation of the raw clone() system call on s390 and cris
From: Ken Werner k...@linux.vnet.ibm.com Since the order of the first and second arguments of the raw clone() system call is reversed on s390 and cris it needs to be invoked differently. Signed-off-by: Ken Werner k...@linux.vnet.ibm.com --- src/nspawn/nspawn.c |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 9ca53cd..9bfd7a5 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -3133,9 +3133,17 @@ int main(int argc, char *argv[]) { goto finish; } +#if defined(__s390__) || defined(__CRIS) +/* On s390 and cris the order of the first and second arguments + * of the raw clone() system call is reversed. */ +pid = syscall(__NR_clone, NULL, SIGCHLD|CLONE_NEWNS| + (arg_share_system ? 0 : CLONE_NEWIPC|CLONE_NEWPID|CLONE_NEWUTS)| + (arg_private_network ? CLONE_NEWNET : 0)); +#else pid = syscall(__NR_clone, SIGCHLD|CLONE_NEWNS| (arg_share_system ? 0 : CLONE_NEWIPC|CLONE_NEWPID|CLONE_NEWUTS)| (arg_private_network ? CLONE_NEWNET : 0), NULL); +#endif if (pid 0) { if (errno == EINVAL) r = log_error_errno(errno, clone() failed, do you have namespace support enabled in your kernel? (You need UTS, IPC, PID and NET namespacing built in): %m); -- 1.7.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] nspawn: fix invocation of the raw clone() system call on s390 and cris
On Mon, 15.12.14 08:01, Ken Werner (k...@linux.vnet.ibm.com) wrote: From: Ken Werner k...@linux.vnet.ibm.com Since the order of the first and second arguments of the raw clone() system call is reversed on s390 and cris it needs to be invoked differently. Signed-off-by: Ken Werner k...@linux.vnet.ibm.com Hmm, I'd prefer if we could move the definition of this syscall wrapper into missing.h, and do the per-arch magic there, like we do for all the other syscalls missing from glibc. Maybe call the function raw_clone() there or so. Alternatively we could move to the glibc-provided wrapper, but I think it's nastier to use, since it requires a stack parameter to be specified. @@ -3133,9 +3133,17 @@ int main(int argc, char *argv[]) { goto finish; } +#if defined(__s390__) || defined(__CRIS) +/* On s390 and cris the order of the first and second arguments + * of the raw clone() system call is reversed. */ +pid = syscall(__NR_clone, NULL, SIGCHLD|CLONE_NEWNS| + (arg_share_system ? 0 : CLONE_NEWIPC|CLONE_NEWPID|CLONE_NEWUTS)| + (arg_private_network ? CLONE_NEWNET : 0)); +#else pid = syscall(__NR_clone, SIGCHLD|CLONE_NEWNS| (arg_share_system ? 0 : CLONE_NEWIPC|CLONE_NEWPID|CLONE_NEWUTS)| (arg_private_network ? CLONE_NEWNET : 0), NULL); +#endif if (pid 0) { if (errno == EINVAL) r = log_error_errno(errno, clone() failed, do you have namespace support enabled in your kernel? (You need UTS, IPC, PID and NET namespacing built in): %m); -- 1.7.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel