1
0
mirror of https://github.com/golang/go synced 2024-11-17 11:14:46 -07:00
go/misc/cgo
Ian Lance Taylor 0c1f0549b8 runtime, runtime/cgo: support using msan on cgo code
The memory sanitizer (msan) is a nice compiler feature that can
dynamically check for memory errors in C code.  It's not useful for Go
code, since Go is memory safe.  But it is useful to be able to use the
memory sanitizer on C code that is linked into a Go program via cgo.
Without this change it does not work, as msan considers memory passed
from Go to C as uninitialized.

To make this work, change the runtime to call the C mmap function when
using cgo.  When using msan the mmap call will be intercepted and marked
as returning initialized memory.

Work around what appears to be an msan bug by calling malloc before we
call mmap.

Change-Id: I8ab7286d7595ae84782f68a98bef6d3688b946f9
Reviewed-on: https://go-review.googlesource.com/15170
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-30 22:17:55 +00:00
..
errors build: convert run.bash, run.bat, and run.rc into a Go program 2015-03-03 23:22:11 +00:00
gmp Fix several out of date references to 4g/5g/6g/8g/9g. 2015-06-26 03:38:21 +00:00
life
nocgo cmd/ld: really import runtime/cgo for external link 2014-05-20 21:36:50 -07:00
stdio
test runtime: unblock special glibc signals on each thread 2015-09-14 21:59:54 +00:00
testasan
testcarchive cmd/go: install headers for c-archive/c-shared cgo exports 2015-05-07 17:39:56 +00:00
testcshared cmd/internal/ld: put read-only relocated data into .data.rel.ro when making a shared object 2015-09-08 23:34:16 +00:00
testgodefs build: convert run.bash, run.bat, and run.rc into a Go program 2015-03-03 23:22:11 +00:00
testsanitizers runtime, runtime/cgo: support using msan on cgo code 2015-09-30 22:17:55 +00:00
testshared cmd/internal/ld: put read-only relocated data into .data.rel.ro when making a shared object 2015-09-08 23:34:16 +00:00
testsigfwd runtime: signal forwarding 2015-04-24 05:19:39 +00:00
testso cmd/dist: convert testso test into Go 2015-06-12 04:33:50 +00:00
testsovar misc/cgo/testsovar: needs the extern keyword to export variables on non-windows platforms 2015-07-21 18:10:57 +00:00
testtls misc/cgo/testtls: make test less flaky 2014-01-21 19:44:51 -05:00