systemd-nspawn doesn't work on s390/s390x (#1175394)

This commit is contained in:
Jan Synacek 2014-12-18 10:09:06 +01:00
parent 0ea5bee27b
commit 572940a9b3
2 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,53 @@
From e6ec314b4a905e0967b08202ebc6509753f2d518 Mon Sep 17 00:00:00 2001
From: Fedora systemd team <systemd-maint@redhat.com>
Date: Fri, 19 Dec 2014 08:06:15 +0100
Subject: [PATCH] nspawn: fix invocation of the raw clone() system call on s390
and cris
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.
(cherry-picked from 60e1651a31c9c0ed1caef1a63f5e3a87156b0b1e)
---
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 f332ade..e7d36bb 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -3187,9 +3187,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)
log_error("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 c98d027..4b4c6df 100644
--- a/src/shared/missing.h
+++ b/src/shared/missing.h
@@ -595,3 +595,13 @@ static inline int setns(int fd, int nstype) {
#ifndef LOOPBACK_IFINDEX
#define LOOPBACK_IFINDEX 1
#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
++}
--
2.2.0

View File

@ -89,6 +89,7 @@ Patch0045: 0045-shared-create-files-even-if-the-SELinux-policy-has-n.patch
Patch0046: 0046-shutdown-fix-arguments-to-run-initramfs-shutdown.patch
Patch0047: 0047-login-rerun-vconsole-setup-when-switching-from-vgaco.patch
Patch0048: 0048-systemctl-fix-argument-handling-when-invoked-as-shut.patch
Patch0049: 0049-nspawn-fix-invocation-of-the-raw-clone-system-call-o.patch
Patch0996: Accept-StartTimeout-options-for-compatibility.patch
@ -879,6 +880,9 @@ getent passwd systemd-journal-upload >/dev/null 2>&1 || useradd -r -l -g systemd
%{_datadir}/systemd/gatewayd
%changelog
* Fri Dec 19 2014 Jan Synáček <jsynacek@redhat.com> - 216-13
- systemd-nspawn doesn't work on s390/s390x (#1175394)
* Tue Dec 16 2014 Jan Synáček <jsynacek@redhat.com> - 216-13
- [abrt] systemd: log_assert_failed_unreachable(): systemctl killed by SIGABRT (#1173100)
- Cleanup whitespace and confusing patch subject.