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

This commit is contained in:
Jan Synacek 2014-12-18 15:36:07 +01:00
parent 378cf2ba6f
commit 5606d835af
2 changed files with 58 additions and 1 deletions

View File

@ -0,0 +1,53 @@
From 6ae61e265d8becff0960c0911e8bd37b0df42386 Mon Sep 17 00:00:00 2001
From: Fedora systemd team <systemd-maint@redhat.com>
Date: Thu, 18 Dec 2014 15:21:22 +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 0466ddb..2f57e65 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -2982,9 +2982,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_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 478988c..8ea3807 100644
--- a/src/shared/missing.h
+++ b/src/shared/missing.h
@@ -631,3 +631,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
+}
--
2.2.0

View File

@ -16,7 +16,7 @@
Name: systemd
Url: http://www.freedesktop.org/wiki/Software/systemd
Version: 218
Release: 1%{?gitcommit:.git%{gitcommit}}%{?dist}
Release: 2%{?gitcommit:.git%{gitcommit}}%{?dist}
# For a breakdown of the licensing, see README
License: LGPLv2+ and MIT and GPLv2+
Summary: A System and Service Manager
@ -39,6 +39,7 @@ Source6: sysctl.conf.README
# Patch series is available from http://cgit.freedesktop.org/systemd/systemd-stable/log/?h=v218-stable
# GIT_DIR=~/src/systemd/.git git format-patch-ab -M -N --no-signature v218..v218-stable
# i=1; for p in 0*patch;do printf "Patch%04d: %s\n" $i $p; ((i++));done
Patch0001: 0001-nspawn-fix-invocation-of-the-raw-clone-system-call-o.patch
Patch0998: fedora-disable-resolv.conf-symlink.patch
Patch0999: fedora-add-bridge-sysctl-configuration.patch
@ -837,6 +838,9 @@ getent passwd systemd-journal-upload >/dev/null 2>&1 || useradd -r -l -g systemd
%{_datadir}/systemd/gatewayd
%changelog
* Thu Dec 18 2014 Jan Synáček <jsynacek@redhat.com> - 218-2
- systemd-nspawn doesn't work on s390/s390x (#1175394)
* Wed Dec 10 2014 Lennart Poettering <lpoetter@redhat.com> - 218-1
- New upstream release
- Enable "nss-mymachines" in /etc/nsswitch.conf