overlay: fix call to clone on s390x
the two arguments to clone are swapped on s390x. This patch fixes the call when running on s390x. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2108887 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
04d8b90f9d
commit
f91fa54453
|
|
@ -6,6 +6,7 @@ package overlay
|
|||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
|
|
@ -112,7 +113,14 @@ func createIDMappedMount(source, target string, pid int) error {
|
|||
// createUsernsProcess forks the current process and creates a user namespace using the specified
|
||||
// mappings. It returns the pid of the new process.
|
||||
func createUsernsProcess(uidMaps []idtools.IDMap, gidMaps []idtools.IDMap) (int, func(), error) {
|
||||
pid, _, err := syscall.Syscall6(uintptr(unix.SYS_CLONE), unix.CLONE_NEWUSER|uintptr(unix.SIGCHLD), 0, 0, 0, 0, 0)
|
||||
var pid uintptr
|
||||
var err syscall.Errno
|
||||
|
||||
if runtime.GOARCH == "s390x" {
|
||||
pid, _, err = syscall.Syscall6(uintptr(unix.SYS_CLONE), 0, unix.CLONE_NEWUSER|uintptr(unix.SIGCHLD), 0, 0, 0, 0)
|
||||
} else {
|
||||
pid, _, err = syscall.Syscall6(uintptr(unix.SYS_CLONE), unix.CLONE_NEWUSER|uintptr(unix.SIGCHLD), 0, 0, 0, 0, 0)
|
||||
}
|
||||
if err != 0 {
|
||||
return -1, nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue