mirror of
https://github.com/clearlinux/systemd-stable.git
synced 2026-09-08 06:31:56 +00:00
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 commit 60e1651a31)
Conflicts:
src/shared/missing.h
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
1c06a92987
commit
98963dfd60
+3
-3
@@ -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");
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user