]> Cypherpunks repositories - gostls13.git/commit
runtime, syscall: workaround for bug in Linux's execve
authorJohn R. Lenton <jlenton@gmail.com>
Sat, 20 May 2017 16:22:36 +0000 (17:22 +0100)
committerIan Lance Taylor <iant@golang.org>
Tue, 20 Jun 2017 23:53:17 +0000 (23:53 +0000)
commit91139b87f776a553524b022753981e7909386777
tree509628949dc32d2ead832939d26256627a7f077a
parent3ca8ee14d15d8fdf152c28e98812347419f8084c
runtime, syscall: workaround for bug in Linux's execve

Linux's execve has (at the time of writing, and since v2.6.30) a bug when it ran
concurrently with clone, in that it would fail to set up some datastructures if
the thread count before and after some steps differed. This is described better
and in more detail by Colin King in Launchpad¹ and kernel² bugs. When a program
written in Go runtime.Exec's a setuid binary, this issue may cause the resulting
process to not have the expected uid. This patch works around the issue by using
a mutex to serialize exec and clone.

1. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1672819
2. https://bugzilla.kernel.org/show_bug.cgi?id=195453

Fixes #19546

Change-Id: I126e87d1d9ce3be5ea4ec9c7ffe13f92e087903d
Reviewed-on: https://go-review.googlesource.com/43713
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/runtime/proc.go
src/syscall/exec_unix.go