Commit 934e055f authored by Ian Lance Taylor's avatar Ian Lance Taylor

runtime: call msanwrite on object passed to runtime/cgo

Avoids an msan error when runtime/cgo is explicitly rebuilt with
-fsanitize=memory.

Fixes #13815.

Change-Id: I70308034011fb308b63585bcd40b0d1e62ec93ef
Reviewed-on: https://go-review.googlesource.com/18263Reviewed-by: default avatarRuss Cox <rsc@golang.org>
parent 17ce0372
......@@ -61,7 +61,12 @@ if ! go run -msan msan.go; then
status=1
fi
if ! go run -msan msan2.go; then
if ! CGO_LDFLAGS="-fsanitize=memory" CGO_CPPFLAGS="-fsanitize=memory" go run -msan -a msan2.go; then
echo "FAIL: msan2 with -fsanitize=memory"
status=1
fi
if ! go run -msan -a msan2.go; then
echo "FAIL: msan2"
status=1
fi
......
......@@ -1489,6 +1489,9 @@ func newm(fn func(), _p_ *p) {
ts.g.set(mp.g0)
ts.tls = (*uint64)(unsafe.Pointer(&mp.tls[0]))
ts.fn = unsafe.Pointer(funcPC(mstart))
if msanenabled {
msanwrite(unsafe.Pointer(&ts), unsafe.Sizeof(ts))
}
asmcgocall(_cgo_thread_start, unsafe.Pointer(&ts))
return
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment