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

cmd/link: go.1.18.3 unexpected fault SIGBUS: bus error in Linux (Ubuntu) #53292

Closed
josvazg opened this issue Jun 8, 2022 · 5 comments
Closed
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@josvazg
Copy link
Contributor

josvazg commented Jun 8, 2022

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

$ go version
go version go1.18.3 linux/amd64

go.1.18.2 does not sigbus

Does this issue reproduce with the latest release?

Yes, go.18.3 is the latest Go out there today.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/josvaz/.cache/go-build"
GOENV="/home/josvaz/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/josvaz/go/pkg/mod"
GONOPROXY="gitlab.eng.vmware.com"
GONOSUMDB="gitlab.eng.vmware.com"
GOOS="linux"
GOPATH="/home/josvaz/go"
GOPRIVATE="gitlab.eng.vmware.com"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/josvaz/go/sdk/1.18.3"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/josvaz/go/sdk/1.18.3/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18.3"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/josvaz/vmware/gemfire/controller-tools/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2603388422=/tmp/go-build -gno-record-gcc-switches"

What did you do?

As explained here: kubernetes-sigs/controller-tools#690
I initially thought it was a bug in the controller-tools project.

$ git clone git@github.com:kubernetes-sigs/controller-tools.git
$ cd controller-tools/
$ ./test.sh 
using tools
fetching tools
kubebuilder/
...
kubebuilder/bin/etcd
setting up env vars
generating marker help
# command-line-arguments
unexpected fault address 0x7f0bc41b1043
fatal error: fault
[signal SIGBUS: bus error code=0x2 addr=0x7f0bc41b1043 pc=0x4f986e]

goroutine 1 [running]:
runtime.throw({0x673634?, 0x412439?})
	/usr/local/go/src/runtime/panic.go:992 +0x71 fp=0xc000114638 sp=0xc000114608 pc=0x4347f1
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:815 +0x125 fp=0xc000114688 sp=0xc000114638 pc=0x44a8c5
encoding/binary.littleEndian.Uint64(...)
	/usr/local/go/src/encoding/binary/binary.go:79
cmd/internal/goobj.(*Reader).uint64At(...)
	/usr/local/go/src/cmd/internal/goobj/objfile.go:618
cmd/internal/goobj.(*Reader).Hash64(...)
	/usr/local/go/src/cmd/internal/goobj/objfile.go:763
cmd/link/internal/loader.(*loadState).addSym.func2()
	/usr/local/go/src/cmd/link/internal/loader/loader.go:413 +0x4e fp=0xc0001146b0 sp=0xc000114688 pc=0x4f986e
cmd/link/internal/loader.(*loadState).addSym(0x63b820?, {0x0?, 0x3c?}, 0x0?, 0xc000b6a000, 0x31db, 0x0?, 0x7f0bc4880690?)
	/usr/local/go/src/cmd/link/internal/loader/loader.go:427 +0x402 fp=0xc000114810 sp=0xc0001146b0 pc=0x4f8ee2
cmd/link/internal/loader.(*loadState).preloadSyms(0xc000114b60, 0xc000b6a000, 0xc000114948?)
	/usr/local/go/src/cmd/link/internal/loader/loader.go:2157 +0x37a fp=0xc0001148e8 sp=0xc000114810 pc=0x4ff1ba
cmd/link/internal/loader.(*Loader).LoadSyms(0xc0000ac000, 0xc00007e810?)
	/usr/local/go/src/cmd/link/internal/loader/loader.go:2204 +0x40b fp=0xc000114be8 sp=0xc0001148e8 pc=0x4ffaeb
cmd/link/internal/ld.(*Link).loadlib(0xc000158000)
	/usr/local/go/src/cmd/link/internal/ld/lib.go:577 +0x46f fp=0xc000114c98 sp=0xc000114be8 pc=0x58df4f
cmd/link/internal/ld.Main(_, {0x20, 0x20, 0x1, 0x7, 0x10, 0x0, {0x0, 0x0}, {0x67f575, ...}, ...})
	/usr/local/go/src/cmd/link/internal/ld/main.go:261 +0xe2b fp=0xc000114f28 sp=0xc000114c98 pc=0x5ac2eb
main.main()
	/usr/local/go/src/cmd/link/main.go:69 +0xfe5 fp=0xc000115f80 sp=0xc000114f28 pc=0x6188e5
runtime.main()
	/usr/local/go/src/runtime/proc.go:250 +0x212 fp=0xc000115fe0 sp=0xc000115f80 pc=0x436f12
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc000115fe8 sp=0xc000115fe0 pc=0x463b21
main.go:39: running "go": exit status 2

What did you expect to see?

That should compile, or at least not throw away a SIGBUS fault.

I tested 1.17 and that worked. With 1.18.2 I got compiler errors, but not a SIGBUS, I am guessing that project is not 1.18 ready, but still it should not sigfault right?

What did you see instead?

The SIGBUS fault referenced above.

@seankhliao
Copy link
Member

seankhliao commented Jun 8, 2022

what sort of filesystem are you using?

@josvazg
Copy link
Contributor Author

josvazg commented Jun 8, 2022

$ mount |grep '/ '
/dev/mapper/vgubuntu-root on / type ext4 (rw,relatime,errors=remount-ro)
$ blkid
/dev/mapper/nvme0n1p3_crypt: UUID="OSQ82R-...-cE2a38" TYPE="LVM2_member"
/dev/mapper/vgubuntu-swap_1: UUID="7cc33721-...-df562c6bf03f" TYPE="swap"
/dev/mapper/vgubuntu-root: UUID="bc796560-...-83219df83397" TYPE="ext4"

It is an encrypted filesystem.

@cherrymui
Copy link
Member

cherrymui commented Jun 8, 2022

One possibility for error like that is that the object file is corrupted. Could you try a clean the build cache (go clean -cache, go clean -modcache) and do a fresh build? Thanks.

@cherrymui cherrymui changed the title affected/package: go.1.18.3 unexpected fault SIGBUS: bus error in Linux (Ubuntu) cmd/link: go.1.18.3 unexpected fault SIGBUS: bus error in Linux (Ubuntu) Jun 8, 2022
@cherrymui cherrymui added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jun 8, 2022
@josvazg
Copy link
Contributor Author

josvazg commented Jun 9, 2022

Uhm, strange I downloaded the binary straight from https://go.dev/dl/
I just did it again and checked the sha256 matches the one in that page for:

go1.18.3.linux-amd64.tar.gz
956f8507b302ab0bb747613695cdae10af99bbd39a90cae522b7c0302cc27245

$ shasum -a 256 /tmp/go1.18.3.linux-amd64.tar.gz
956f8507b302ab0bb747613695cdae10af99bbd39a90cae522b7c0302cc27245  /tmp/go1.18.3.linux-amd64.tar.gz
$ shasum -a 256 bin/go
7d356589258095955510e2c5c3d2de749cf04a65549ad4f83099c29b32efd51b  bin/go

But hey!
This time I did the cleanup:

$ go clean -cache && go clean -modcache

And when I tried to build I did not get the SIGBUS, instead I got the same errors that 1.18.2 would produce, which might be due to that project not supporting 1.18 yet.

Thank you very much!

One question, should I be running those build cache cleanups on every go upgrade?

@cherrymui
Copy link
Member

cherrymui commented Jun 9, 2022

Generally you don't have to clean the caches. But if you got weird errors like that, it could be a file corruption and it's probably worth trying cleaning the cache. Also, as the cache is keyed by some hash value, I guess under rare circumstances there could be hash collision.

On the other hand, if you upgrade the Go toolchain, the old cache is not useful anyway, as the toolchain version is part of the cache key. So you may well clean it to free up some disk space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants