diff options
author | Devon H. O'Dell <devon.odell@gmail.com> | 2011-03-06 14:57:05 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2011-03-06 14:57:05 -0500 |
commit | eeb8d00c867570a500029cd113e6e34119c54766 (patch) | |
tree | d4f11d92905da6363212d04adf97a2777591dfb7 | |
parent | 9e25eccf48338902740bae65a2e40f68a2b8a842 (diff) | |
download | go-eeb8d00c867570a500029cd113e6e34119c54766.tar.gz go-eeb8d00c867570a500029cd113e6e34119c54766.zip |
syscall: work around FreeBSD execve kernel bug
FreeBSD's execve implementation has an integer underflow in a bounds test which
causes it to erroneously think the argument list is too long when argv[0] is
longer than interpreter + path.
R=rsc, bradfitz, rsc1
CC=golang-dev
https://golang.org/cl/4259056
-rw-r--r-- | src/pkg/syscall/exec_unix.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pkg/syscall/exec_unix.go b/src/pkg/syscall/exec_unix.go index 04c066918f..2e09539eea 100644 --- a/src/pkg/syscall/exec_unix.go +++ b/src/pkg/syscall/exec_unix.go @@ -238,6 +238,10 @@ func forkExec(argv0 string, argv []string, envv []string, traceme bool, dir stri dirp = StringBytePtr(dir) } + if OS == "freebsd" && len(argv[0]) > len(argv0) { + argvp[0] = argv0p + } + // Acquire the fork lock so that no other threads // create new fds that are not yet close-on-exec // before we fork. |