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: index out of range panic when linking program #47432

Closed
ddelnano opened this issue Jul 28, 2021 · 3 comments
Closed

cmd/link: index out of range panic when linking program #47432

ddelnano opened this issue Jul 28, 2021 · 3 comments

Comments

@ddelnano
Copy link

@ddelnano ddelnano commented Jul 28, 2021

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

$ go version
go version go1.16.6 linux/amd64

Does this issue reproduce with the latest release?

Have not had a chance to test yet

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ddelnano/.cache/go-build"
GOENV="/home/ddelnano/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/ddelnano/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/ddelnano/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.6"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/ddelnano/go/src/github.com/ddelnano/terraform-provider-xenorchestra/go.mod"
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-build4227241103=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version go1.16.6 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.16.6
uname -sr: Linux 5.13.4-arch2-1
/usr/lib/libc.so.6: GNU C Library (GNU libc) release release version 2.33.
gdb --version: GNU gdb (GDB) 10.2

What did you do?

I was trying to run the tests of my terraform project (terraform-provider-xenorchestra), which is written in go. Since the error occurs during the linking of the program, this should be easy to reproduce even though the test suite itself requires infrastructure to run successfully.

The following process should be able to reproduce the issue:

  1. git clone https://github.com/ddelnano/terraform-provider-xenorchestra
  2. make testacc or go build from the project root

What did you expect to see?

I expected the go's test suite to run or for my project to compile

What did you see instead?

$ make testacc
TF_ACC=1  go test ./... -parallel 5 -v -count 1 -timeout 40m
?       github.com/ddelnano/terraform-provider-xenorchestra     [no test files]
# github.com/ddelnano/terraform-provider-xenorchestra/xoa/internal.test
panic: runtime error: index out of range [2147483664] with length 5713

goroutine 1 [running]:
cmd/link/internal/loader.(*Loader).toGlobal(...)
        /usr/lib/go/src/cmd/link/internal/loader/loader.go:603
cmd/link/internal/loader.(*Loader).resolve(0xc000590000, 0xc001064080, 0x800000107ffffffb, 0x2e9f2)
        /usr/lib/go/src/cmd/link/internal/loader/loader.go:646 +0x226
cmd/link/internal/loader.Reloc.Sym(0x7f63daabf00a, 0xc001064080, 0xc000590000, 0x0, 0x2e9f2)
        /usr/lib/go/src/cmd/link/internal/loader/loader.go:64 +0x48
cmd/link/internal/loader.(*Loader).UndefinedRelocTargets(0xc000590000, 0x1, 0x6dd224, 0x6, 0x8bfda0)
        /usr/lib/go/src/cmd/link/internal/loader/loader.go:2483 +0x107
cmd/link/internal/ld.(*Link).loadlib(0xc000108000)
        /usr/lib/go/src/cmd/link/internal/ld/lib.go:581 +0x5d1
cmd/link/internal/ld.Main(0x87f340, 0x20, 0x20, 0x1, 0x7, 0x10, 0x0, 0x0, 0x6e86a7, 0x1b, ...)
        /usr/lib/go/src/cmd/link/internal/ld/main.go:244 +0xdbc
main.main()
        /usr/lib/go/src/cmd/link/main.go:68 +0x258
# github.com/ddelnano/terraform-provider-xenorchestra/xoa.test
panic: runtime error: index out of range [2147483664] with length 5713

goroutine 1 [running]:
cmd/link/internal/loader.(*Loader).toGlobal(...)
        /usr/lib/go/src/cmd/link/internal/loader/loader.go:603
cmd/link/internal/loader.(*Loader).resolve(0xc000734000, 0xc000f49680, 0x800000107ffffffb, 0x2f3f1)
        /usr/lib/go/src/cmd/link/internal/loader/loader.go:646 +0x226
cmd/link/internal/loader.Reloc.Sym(0x7f9c9dcd700a, 0xc000f49680, 0xc000734000, 0x0, 0x2f3f1)
        /usr/lib/go/src/cmd/link/internal/loader/loader.go:64 +0x48
cmd/link/internal/loader.(*Loader).UndefinedRelocTargets(0xc000734000, 0x1, 0x6dd224, 0x6, 0x8bfda0)
        /usr/lib/go/src/cmd/link/internal/loader/loader.go:2483 +0x107
cmd/link/internal/ld.(*Link).loadlib(0xc000150000)
        /usr/lib/go/src/cmd/link/internal/ld/lib.go:581 +0x5d1
cmd/link/internal/ld.Main(0x87f340, 0x20, 0x20, 0x1, 0x7, 0x10, 0x0, 0x0, 0x6e86a7, 0x1b, ...)
        /usr/lib/go/src/cmd/link/internal/ld/main.go:244 +0xdbc
main.main()
        /usr/lib/go/src/cmd/link/main.go:68 +0x258
FAIL    github.com/ddelnano/terraform-provider-xenorchestra/xoa [build failed]
FAIL    github.com/ddelnano/terraform-provider-xenorchestra/xoa/internal [build failed]
FAIL
make: *** [Makefile:37: testacc] Error 2


@mvdan mvdan changed the title Index out of range panic when linking go program cmd/link: index out of range panic when linking program Jul 28, 2021
@mvdan
Copy link
Member

@mvdan mvdan commented Jul 28, 2021

Loading

@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented Jul 29, 2021

I did

git clone https://github.com/ddelnano/terraform-provider-xenorchestra
go build 

but I cannot reproduce it on my local machine, with both Go 1.16 and tip.

As it seems your failure is from building a test, I also tried go test -c github.com/ddelnano/terraform-provider-xenorchestra/xoa/internal but cannot reproduce either.

Could you share the go command you run to reproduce? Thanks.

Loading

@ddelnano
Copy link
Author

@ddelnano ddelnano commented Aug 4, 2021

Hm, I can't seem to reproduce this now. I'll reopen and provide more details if this gives me more trouble.

Loading

@ddelnano ddelnano closed this Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants