From 958e212db799e609b2a8df51cdd85c9341e7a404 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Thu, 17 Jan 2019 16:20:51 +0100 Subject: [PATCH] syscall: fix hang when using Unshareflags: CLONE_NEWUSER with uid/gid mapping (linux) Note that this particular combination of properties still fails (EPERM), but it no longer hangs. Updates #29789 Change-Id: I29b15b85a25a7acd7ae89ffc5fed074bcdfe0a12 Reviewed-on: https://go-review.googlesource.com/c/go/+/158297 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/syscall/exec_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go index 6c761f85c4..79c0d77422 100644 --- a/src/syscall/exec_linux.go +++ b/src/syscall/exec_linux.go @@ -154,7 +154,7 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att runtime_BeforeFork() locked = true switch { - case runtime.GOARCH == "amd64" && sys.Cloneflags&CLONE_NEWUSER == 0: + case runtime.GOARCH == "amd64" && (sys.Cloneflags&CLONE_NEWUSER == 0 && sys.Unshareflags&CLONE_NEWUSER == 0): r1, err1 = rawVforkSyscall(SYS_CLONE, uintptr(SIGCHLD|CLONE_VFORK|CLONE_VM)|sys.Cloneflags) case runtime.GOARCH == "s390x": r1, _, err1 = RawSyscall6(SYS_CLONE, 0, uintptr(SIGCHLD)|sys.Cloneflags, 0, 0, 0, 0) -- 2.50.0