Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin: Open SIGBUS while opening plugin #19631

Closed
krhubert opened this issue Mar 21, 2017 · 2 comments
Closed

plugin: Open SIGBUS while opening plugin #19631

krhubert opened this issue Mar 21, 2017 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@krhubert
Copy link

krhubert commented Mar 21, 2017

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.8 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/usr/src/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build298816360=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

https://play.golang.org/p/k0Rqdts-vc

What did you expect to see?

cannot read file data || nil

What did you see instead?

fatal error: unexpected signal during runtime execution
[signal SIGBUS: bus error code=0x2 addr=0x7f084832ae38 pc=0x7f084a352a84]

runtime stack:
runtime.throw(0x569dd4, 0x2a)
	/usr/local/go/src/runtime/panic.go:596 +0x95
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:274 +0x2db

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x52d350, 0xc420047c08, 0xc420094010)
	/usr/local/go/src/runtime/cgocall.go:131 +0xe2 fp=0xc420047bd8 sp=0xc420047b98
plugin._Cfunc_pluginOpen(0x8a7420, 0xc420094010, 0x0)
	plugin/_obj/_cgo_gotypes.go:98 +0x4e fp=0xc420047c08 sp=0xc420047bd8
plugin.open.func3(0x8a7420, 0xc420094010, 0xc420092140)
	/usr/local/go/src/plugin/plugin_dlopen.go:61 +0xc7 fp=0xc420047c50 sp=0xc420047c08
plugin.open(0xc420010530, 0xe, 0x0, 0x0, 0x0)
	/usr/local/go/src/plugin/plugin_dlopen.go:61 +0x1ea fp=0xc420047e90 sp=0xc420047c50
plugin.Open(0xc420010530, 0xe, 0x1, 0xc420088140, 0xc42008e0d0)
	/usr/local/go/src/plugin/plugin.go:30 +0x35 fp=0xc420047ec8 sp=0xc420047e90
main.main()
	/usr/src/go/src/github.com/krhubert/go-bug/main.go:24 +0x202 fp=0xc420047f88 sp=0xc420047ec8
runtime.main()
	/usr/local/go/src/runtime/proc.go:185 +0x20a fp=0xc420047fe0 sp=0xc420047f88
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc420047fe8 sp=0xc420047fe0

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:2197 +0x1

goroutine 5 [runnable]:
syscall.Syscall6(0xe8, 0x4, 0xc4200a5cb4, 0x7, 0xffffffffffffffff, 0x0, 0x0, 0x1, 0x7, 0x0)
	/usr/local/go/src/syscall/asm_linux_amd64.s:44 +0x5
golang.org/x/sys/unix.EpollWait(0x4, 0xc4200a5cb4, 0x7, 0x7, 0xffffffffffffffff, 0xc420001ba0, 0x0, 0xc420052200)
	/usr/src/go/src/golang.org/x/sys/unix/zsyscall_linux_amd64.go:1231 +0x77
gopkg.in/fsnotify%2ev1.(*fdPoller).wait(0xc42000c320, 0xc420060100, 0x0, 0x563301)
	/usr/src/go/src/gopkg.in/fsnotify.v1/inotify_poller.go:86 +0x91
gopkg.in/fsnotify%2ev1.(*Watcher).readEvents(0xc4200560a0)
	/usr/src/go/src/gopkg.in/fsnotify.v1/inotify.go:192 +0x196
created by gopkg.in/fsnotify%2ev1.NewWatcher
	/usr/src/go/src/gopkg.in/fsnotify.v1/inotify.go:61 +0x2c8
exit status 2
@krhubert krhubert changed the title panic() SIGBUS while opening plugin SIGBUS while opening plugin Mar 21, 2017
@krhubert krhubert changed the title SIGBUS while opening plugin plugin: Open SIGBUS while opening plugin Mar 21, 2017
@bradfitz bradfitz added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 21, 2017
@bradfitz bradfitz added this to the Go1.9Maybe milestone Mar 21, 2017
@tzneal
Copy link
Member

tzneal commented Apr 13, 2017

This isn't go specific, you're effectively calling dlopen on part of a .so file as it's being written. I can reproduce an identical crash by reading a partial .so (created with head -c) using C & dlopen.

@ianlancetaylor
Copy link
Contributor

Closing based on @tzneal 's comment (thanks).

@golang golang locked and limited conversation to collaborators Apr 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants