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

runtime: panic bsdthread_register error due to anti virus software #8801

Closed
gopherbot opened this issue Sep 24, 2014 · 11 comments
Closed

runtime: panic bsdthread_register error due to anti virus software #8801

gopherbot opened this issue Sep 24, 2014 · 11 comments

Comments

@gopherbot
Copy link

by berniedurfee:

Trying to run several Go based tools on my Mac, but consistently get an error.

For example...

> make updatedeps
cd config/ && \
go tool yacc -p "expr" expr.y
fatal error: runtime: bsdthread_register error

runtime stack:
runtime.throw(0x244895)
    /usr/local/go/src/pkg/runtime/panic.c:520 +0x69
runtime.goenvs()
    /usr/local/go/src/pkg/runtime/os_darwin.c:88 +0x62
runtime.schedinit()
    /usr/local/go/src/pkg/runtime/proc.c:164 +0x76
_rt0_go()
    /usr/local/go/src/pkg/runtime/asm_amd64.s:91 +0x114
make: *** [config/y.go] Error 1

...tried different executables, same result.

What does 'go version' print?

> go version
go version go1.3.1 darwin/amd64

> uname -prsv
Darwin 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun  3 21:27:35 PDT 2014;
root:xnu-2422.110.17~1/RELEASE_X86_64 i386


Tried a few different tools, plus just running 'go tool' seems to blow up. Assuming this
is related to some dependencies out of sorts. Any ideas? Need any more information to
help sort this out?

Thanks!
@minux
Copy link
Member

minux commented Sep 24, 2014

Comment 1:

what's the output of env?
or put it another way, are
you using any software that
works by injecting a dylib
into processes?

Status changed to WaitingForReply.

@gopherbot
Copy link
Author

Comment 2 by berniedurfee:

I don't have DYLD_INSERT_LIBRARIES set. Is there any other mechanism of dylib injection
that I should be looking for?

@gopherbot
Copy link
Author

Comment 3 by berniedurfee:

Tried to see if I could just build Go from source, but get the same failure...
> ./all.bash
# Building C bootstrap tool.
cmd/dist
# Building compilers and Go bootstrap tool for host, darwin/amd64.
lib9
libbio
liblink
misc/pprof
cmd/cc
cmd/gc
cmd/6l
cmd/6a
cmd/6c
cmd/6g
pkg/runtime
pkg/errors
pkg/sync/atomic
pkg/sync
pkg/io
pkg/unicode
pkg/unicode/utf8
pkg/unicode/utf16
pkg/bytes
pkg/math
pkg/strings
pkg/strconv
pkg/bufio
pkg/sort
pkg/container/heap
pkg/encoding/base64
pkg/syscall
pkg/time
pkg/os
pkg/reflect
pkg/fmt
pkg/encoding
pkg/encoding/json
pkg/flag
pkg/path/filepath
pkg/path
pkg/io/ioutil
pkg/log
pkg/regexp/syntax
pkg/regexp
pkg/go/token
pkg/go/scanner
pkg/go/ast
pkg/go/parser
pkg/os/exec
pkg/os/signal
pkg/net/url
pkg/text/template/parse
pkg/text/template
pkg/go/doc
pkg/go/build
cmd/go
fatal error: runtime: bsdthread_register error
runtime stack:
runtime.throw(0x3e42b5)
    /Users/200019822/projects/go/src/pkg/runtime/panic.c:520 +0x69
runtime.goenvs()
    /Users/200019822/projects/go/src/pkg/runtime/os_darwin.c:88 +0x62
runtime.schedinit()
    /Users/200019822/projects/go/src/pkg/runtime/proc.c:164 +0x76
_rt0_go()
    /Users/200019822/projects/go/src/pkg/runtime/asm_amd64.s:91 +0x114

@gopherbot
Copy link
Author

Comment 4 by berniedurfee:

Tried to see if I could just build Go from source, but get the same failure...
> ./all.bash
# Building C bootstrap tool.
cmd/dist
# Building compilers and Go bootstrap tool for host, darwin/amd64.
lib9
libbio
liblink
misc/pprof
cmd/cc
cmd/gc
cmd/6l
cmd/6a
cmd/6c
cmd/6g
pkg/runtime
pkg/errors
pkg/sync/atomic
pkg/sync
pkg/io
pkg/unicode
pkg/unicode/utf8
pkg/unicode/utf16
pkg/bytes
pkg/math
pkg/strings
pkg/strconv
pkg/bufio
pkg/sort
pkg/container/heap
pkg/encoding/base64
pkg/syscall
pkg/time
pkg/os
pkg/reflect
pkg/fmt
pkg/encoding
pkg/encoding/json
pkg/flag
pkg/path/filepath
pkg/path
pkg/io/ioutil
pkg/log
pkg/regexp/syntax
pkg/regexp
pkg/go/token
pkg/go/scanner
pkg/go/ast
pkg/go/parser
pkg/os/exec
pkg/os/signal
pkg/net/url
pkg/text/template/parse
pkg/text/template
pkg/go/doc
pkg/go/build
cmd/go
fatal error: runtime: bsdthread_register error
runtime stack:
runtime.throw(0x3e42b5)
    /Users/me/projects/go/src/pkg/runtime/panic.c:520 +0x69
runtime.goenvs()
    /Users/me/projects/go/src/pkg/runtime/os_darwin.c:88 +0x62
runtime.schedinit()
    /Users/me/projects/go/src/pkg/runtime/proc.c:164 +0x76
_rt0_go()
    /Users/me/projects/go/src/pkg/runtime/asm_amd64.s:91 +0x114

@gopherbot
Copy link
Author

Comment 5 by chris.celebi:

I'm having the same exact issue, only difference is kernel 13.4.

@davecheney
Copy link
Contributor

Comment 6:

Discussion continues: https://groups.google.com/forum/#!topic/golang-nuts/HtcZc3wO-rw
AV software is injecting a thread into the process (i'm guessing at startup).

Labels changed: added release-none, repo-main.

Status changed to Accepted.

@jeffallen
Copy link
Contributor

This happens for me using dtruss. Repro:

go test -c
dtruss -f ./package.test
fatal error: runtime: bsdthread_register error

runtime stack:
runtime.throw(0x20b895)
/Users/jeffall/go/src/runtime/panic.go:449 +0xad fp=0x7fff5fbffac0 sp=0x7fff5fbffa90
runtime.goenvs()
/Users/jeffall/go/src/runtime/os_darwin.c:104 +0x70 fp=0x7fff5fbffad8 sp=0x7fff5fbffac0
runtime.schedinit()
/Users/jeffall/go/src/runtime/proc.c:140 +0x5a fp=0x7fff5fbffb00 sp=0x7fff5fbffad8
runtime.rt0_go(0x7fff5fbffb30, 0x3, 0x7fff5fbffb30, 0x0, 0x3, 0x7fff5fbffc30, 0x7fff5fbffc3f, 0x7fff5fbffc4b, 0x0, 0x7fff5fbffc51, ...)
/Users/jeffall/go/src/runtime/asm_amd64.s:95 +0x116 fp=0x7fff5fbffb08 sp=0x7fff5fbffb00

It is a bummer that I cannot dtruss Go files.

@rsc
Copy link
Contributor

rsc commented Dec 10, 2014

If you build with -ldflags -linkmode=external then you should not get this
error anymore. Whether dtruss actually works at that point is a different
problem, not Go's. (In my experience dtruss jumbles together all the
activity of multiple threads, making the output basically useless.)

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
tonytheodore added a commit to tonytheodore/mxe that referenced this issue Jul 6, 2016
build fails with:

```
fatal error: runtime: bsdthread_register error (unset DYLD_INSERT_LIBRARIES)
```

building with `-ldflags -linkmode=external`[1] and `CGO_ENABLED=1` has no
affect on `go-native`, it does let `go` bootstrap, but then fails with a
similar error:

```
fatal error: runtime: bsdthread_register error
```

easiest to unset DYLD_INSERT_LIBRARIES - no need to check for `darwin` as it
only exists on that platform.

[1] golang/go#8801 (comment)
@ysmolski
Copy link
Member

ysmolski commented Nov 6, 2018

@bradfitz is this something to be solved by Go team? From the comments above we cannot fix it. Also from #18171 it seems to be about satisfying the antivirus.

@bradfitz
Copy link
Contributor

bradfitz commented Nov 6, 2018

@randall77, you're now the macOS expert (sorry). Thoughts? Do your latest changes impact this at all?

@randall77
Copy link
Contributor

Yes, this should have been fixed when we moved the runtime to use libSystem for 1.11.
I can run a Go binary under dtruss.
I don't have the kernel in question, but I'm going to assume this is fixed unless I hear otherwise.

@golang golang locked and limited conversation to collaborators Nov 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants