]> Cypherpunks repositories - gostls13.git/commit
runtime: mark cgo callback results as written for msan
authorIan Lance Taylor <iant@golang.org>
Wed, 4 Nov 2015 01:15:30 +0000 (17:15 -0800)
committerIan Lance Taylor <iant@golang.org>
Wed, 11 Nov 2015 05:58:19 +0000 (05:58 +0000)
commit8f3f2ccac077c73249349e9cf975dcca7e803f6a
tree825e8aaf8740c10c43b204e73b720a509f2a8bcf
parentf84420c20daddf5f0a3e73f64bd2d39cebd22218
runtime: mark cgo callback results as written for msan

This is a fix for the -msan option when using cgo callbacks.  A cgo
callback works by writing out C code that puts a struct on the stack and
passes the address of that struct into Go.  The result parameters are
fields of the struct.  The Go code will write to the result parameters,
but the Go code thinks it is just writing into the Go stack, and
therefore won't call msanwrite.  This CL adds a call to msanwrite in the
cgo callback code so that the C knows that results were written.

Change-Id: I80438dbd4561502bdee97fad3f02893a06880ee1
Reviewed-on: https://go-review.googlesource.com/16611
Reviewed-by: David Crawshaw <crawshaw@golang.org>
misc/cgo/testsanitizers/msan3.go [new file with mode: 0644]
misc/cgo/testsanitizers/test.bash
src/runtime/cgocall.go