You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When building with -buildmode=c-shared, runtime.rt_sigaction ends up calling msanread on its arguments during libpreinit (before the runtime has set up a g).
Unfortunately, msanread assumes that it is always called with a valid g, leading to a segfault.
src/msanshared/msanshared.go:
package main
import"C"funcmain() {}
src/msanshared/main.c:
intmain() {
return0;
}
$ go version
go version devel +c1730ae424 Wed Jan 18 15:40:33 2017 +0000 linux/amd64
$ go env CC
clang-3.8
$ go env GOGCCFLAGS
-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build181672777=/tmp/go-build -gno-record-gcc-switches
$ go build -msan -buildmode=c-shared -o libmsanshared.so src/msanshared/msanshared.go
$ $(go env CC) $(go env GOGCCFLAGS) -fsanitize=memory -o msanshared src/msanshared/main.c libmsanshared.so
$ LD_LIBRARY_PATH=. ./msanshared
Segmentation fault (core dumped)
The text was updated successfully, but these errors were encountered:
When building with
-buildmode=c-shared
,runtime.rt_sigaction
ends up callingmsanread
on its arguments duringlibpreinit
(before the runtime has set up ag
).Unfortunately,
msanread
assumes that it is always called with a validg
, leading to a segfault.src/msanshared/msanshared.go:
src/msanshared/main.c:
The text was updated successfully, but these errors were encountered: