1
0
mirror of https://github.com/golang/go synced 2024-10-03 02:31:21 -06:00
go/src
David Crawshaw ce9b512ccc runtime: copy env strings on startup
Some versions of libc, in this case Android's bionic, point environ
directly at the envp memory.

https://android.googlesource.com/platform/bionic/+/master/libc/bionic/libc_init_common.cpp#104

The Go runtime does something surprisingly similar, building the
runtime's envs []string using gostringnocopy. Both libc and the Go
runtime reusing memory interacts badly. When syscall.Setenv uses cgo
to call setenv(3), C modifies the underlying memory of a Go string.

This manifests on android/arm. With GOROOT=/data/local/tmp, a
runtime test calls syscall.Setenv("/os"), resulting in
runtime.GOROOT()=="/os\x00a/local/tmp/goroot".

Avoid this by copying environment string memory into Go.

Covered by runtime.TestFixedGOROOT on android/arm.

Change-Id: Id0cf9553969f587addd462f2239dafca1cf371fa
Reviewed-on: https://go-review.googlesource.com/7663
Reviewed-by: Keith Randall <khr@golang.org>
2015-03-17 17:27:42 +00:00
..
archive archive/zip: remove WriterOptions and replace with SetOffset method 2015-03-12 21:32:09 +00:00
bufio
builtin
bytes
cmd cmd/yacc: fix path in documentation 2015-03-17 04:53:21 +00:00
compress all: don't refer to code.google.com/p/go{,-wiki}/ 2015-02-06 14:41:47 +00:00
container
crypto crypto/tls: return correct hash function when using client certificates in handshake 2015-03-16 23:38:51 +00:00
database/sql
debug debug/elf: support reading debug info from 32-bit PPC objects 2015-03-14 01:31:28 +00:00
encoding encoding/binary: cull dead code 2015-03-14 02:51:22 +00:00
errors
expvar expvar: fix build 2015-02-05 13:53:29 +00:00
flag flag: use four spaces before tab, not three 2015-03-12 18:43:06 +00:00
fmt fmt: document existing behavior of nil receivers 2015-03-01 18:17:53 +00:00
go go/build: add GOARCH=arm64 2015-03-16 18:44:35 +00:00
hash os/signal, hash/crc32: add arm64 build tags 2015-03-16 18:46:43 +00:00
html all: don't refer to code.google.com/p/go{,-wiki}/ 2015-02-06 14:41:47 +00:00
image image/jpeg: reject bad Tq values in SOF data. 2015-03-13 05:22:55 +00:00
index/suffixarray
internal runtime: remove futile wakeups from trace 2015-03-17 14:14:55 +00:00
io
log log/syslog: avoid unix sockets on darwin/arm 2015-03-04 22:13:06 +00:00
math math/big: cleaner handling of exponent under/overflow 2015-03-17 16:09:34 +00:00
mime mime/quotedprintable: create the package 2015-02-26 20:09:28 +00:00
net net/http/pprof: Use relative links to profiles in index html 2015-03-12 01:13:26 +00:00
os os/signal, hash/crc32: add arm64 build tags 2015-03-16 18:46:43 +00:00
path path/filepath: clarify the package doc about '/' in returned results. 2015-03-11 20:25:35 +00:00
reflect reflect: add support for GOARCH=arm64 2015-03-16 18:46:27 +00:00
regexp
runtime runtime: copy env strings on startup 2015-03-17 17:27:42 +00:00
sort sort: fixed small typo in comments 2015-02-08 23:38:50 +00:00
strconv strconv: simplify code for binary exponent float format 2015-03-05 16:52:41 +00:00
strings
sync sync/atomic: add support for GOARCH=arm64 2015-03-16 18:46:18 +00:00
syscall syscall: add support for GOARCH=arm64 2015-03-16 18:46:02 +00:00
testing testing: pad benchmark names to align results 2015-02-07 21:52:25 +00:00
text text/template: protect against explicit nil in field chains 2015-03-16 22:35:49 +00:00
time time: zoneinfo support for darwin 2015-03-03 15:37:14 +00:00
unicode unicode: Fixed an out of date comment (MaxLatin1, not Latin1Max). 2015-02-16 21:35:33 +00:00
unsafe
all.bash
all.bat
all.rc
androidtest.bash androidtest.bash: remove use of cp --preserve. 2015-02-13 21:16:25 +00:00
bootstrap.bash build: add bootstrap.bash for bootstrapping new systems 2015-03-02 17:51:56 +00:00
clean.bash
clean.bat
clean.rc
make.bash [dev.cc] cmd/go: fix expansion of 'std', add 'cmd' 2015-02-23 15:13:17 +00:00
make.bat build: update Windows make.bat to use CC_FOR_TARGET. 2015-03-02 02:20:46 +00:00
Make.dist
make.rc all: delete C libraries and cmd/dist code that builds them 2015-03-01 00:40:23 +00:00
nacltest.bash cmd/dist: reactivate vfp detection on linux/arm 2015-02-10 00:17:06 +00:00
race.bash [dev.cc] cmd/go: fix expansion of 'std', add 'cmd' 2015-02-23 15:13:17 +00:00
race.bat [dev.cc] cmd/go: fix expansion of 'std', add 'cmd' 2015-02-23 15:13:17 +00:00
run.bash build: convert run.bash, run.bat, and run.rc into a Go program 2015-03-03 23:22:11 +00:00
run.bat build: convert run.bash, run.bat, and run.rc into a Go program 2015-03-03 23:22:11 +00:00
run.rc build: convert run.bash, run.bat, and run.rc into a Go program 2015-03-03 23:22:11 +00:00