]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: fix hang when using Unshareflags: CLONE_NEWUSER with uid/gid mapping (linux)
authorMichael Stapelberg <stapelberg@google.com>
Thu, 17 Jan 2019 15:20:51 +0000 (16:20 +0100)
committerIan Lance Taylor <iant@golang.org>
Wed, 6 Mar 2019 14:49:30 +0000 (14:49 +0000)
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 <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/syscall/exec_linux.go

index 6c761f85c441882e0b5d2adc4c947c834fe209d8..79c0d774222df8174d216cbdd95db1eed8974bd1 100644 (file)
@@ -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)