• Ian Lance Taylor's avatar
    runtime, runtime/cgo: support using msan on cgo code · 0c1f0549
    Ian Lance Taylor authored
    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: 's avatarDavid Crawshaw <crawshaw@golang.org>
    0c1f0549
Name
Last commit
Last update
..
addr2line Loading commit data...
api Loading commit data...
asm Loading commit data...
cgo Loading commit data...
compile Loading commit data...
cover Loading commit data...
dist Loading commit data...
doc Loading commit data...
fix Loading commit data...
go Loading commit data...
gofmt Loading commit data...
internal Loading commit data...
link Loading commit data...
newlink Loading commit data...
nm Loading commit data...
objdump Loading commit data...
pack Loading commit data...
pprof Loading commit data...
trace Loading commit data...
vendor Loading commit data...
vet Loading commit data...
yacc Loading commit data...