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/go/internal/modload: SIGSEGV: segmentation violation #51589

Open
10ne1 opened this issue Mar 10, 2022 · 1 comment
Open

cmd/go/internal/modload: SIGSEGV: segmentation violation #51589

10ne1 opened this issue Mar 10, 2022 · 1 comment
Assignees
Labels
modules NeedsInvestigation
Milestone

Comments

@10ne1
Copy link

@10ne1 10ne1 commented Mar 10, 2022

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

go version go1.17.1 linux/amd64
and also
go version go1.17.8 linux/amd64

These versions are used within the ChromeOS SDK / chroot environment.

Does this issue reproduce with the latest release?

I only tried the latest v1.17 minor release. I did not test v1.18 which is not released yet.

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

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/adi/.cache/go-build"
GOENV="/home/adi/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/adi/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/adi/go"
GOPRIVATE=""
GOPROXY="file:///usr/lib/go/proxy/"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.1"
GCCGO="gccgo"
AR="ar"
CC="x86_64-pc-linux-gnu-clang"
CXX="x86_64-pc-linux-gnu-clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2529356632=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I'm migrating the ChromeOS SDK from GOPATH mode to modules mode, so I'm making all ebuilds install into a GOPROXY file:/// path from where go mod download fetches, then go mod tidy is run before the build cmd. It all works neatly except when trying to build the golint packages & module deps, go segfaults.

I know golint is abandoned and frozen, but we still need to use it for now in ChromeOS - we have TODO to replace it with something else, but I think that is irrelevant to this segfault.

What did you expect to see?

The error about the missing .mod file should be fine. The SIGSEGV is unexpected.

What did you see instead?

Here is the full output:

golang.org/x/lint imports
        golang.org/x/tools/go/gcexportdata imports
        golang.org/x/tools/go/internal/gcimporter tested by
        golang.org/x/tools/go/internal/gcimporter.test imports
        golang.org/x/tools/go/buildutil tested by
        golang.org/x/tools/go/buildutil.test imports
        golang.org/x/tools/go/packages/packagestest imports
        golang.org/x/tools/go/expect imports
        golang.org/x/mod/modfile: golang.org/x/tools@v0.1.9 requires
        golang.org/x/sys@v0.0.0-20220309133719-04245dca01da: reading file:///usr/lib/go/proxy/golang.org/x/sys/@v/v0.0.0-20220309133719-04245dca01da.mod: no such file or directory
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x7d3f2d]

goroutine 1 [running]:
cmd/go/internal/modload.(*loader).checkMultiplePaths(0xc00004c480)
        /usr/lib/go/src/cmd/go/internal/modload/load.go:1747 +0x2d
cmd/go/internal/modload.loadFromRoots({0xa726a0, 0xc000124000}, {{{0x0, 0x0}, 0xc0001b9ce0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...})
        /usr/lib/go/src/cmd/go/internal/modload/load.go:1122 +0xd78
cmd/go/internal/modload.LoadPackages({0xa726a0, 0xc000124000}, {{0x0, 0x0}, 0xc0001b9ce0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
        /usr/lib/go/src/cmd/go/internal/modload/load.go:329 +0x328
cmd/go/internal/modcmd.runTidy({0xa726a0, 0xc000124000}, 0xc000164318, {0xc000136030, 0x4, 0x35})
        /usr/lib/go/src/cmd/go/internal/modcmd/tidy.go:114 +0x1b7
main.invoke(0xd81680, {0xc000136020, 0x2, 0x2})
        /usr/lib/go/src/cmd/go/main.go:216 +0x2f6
main.main()
        /usr/lib/go/src/cmd/go/main.go:173 +0x78e

Please ask if you need any help or more testing. Thank you!

@10ne1
Copy link
Author

@10ne1 10ne1 commented Mar 10, 2022

Here is another log, a bit longer from testify instead of golint:

go: gopkg.in/yaml.v3@v3.0.0-20220309205602-496545a6307b requires
        github.com/kr/text@v0.2.0 requires
        golang.org/x/sys@v0.0.0-20220309202614-04245dca01da: reading file:///usr/lib/go/proxy/golang.org/x/sys/@v/v0.0.0-20220309202614-04245dca01da.mod: no such file or directory
go: gopkg.in/yaml.v3@v3.0.0-20220309205602-496545a6307b requires
        github.com/kr/text@v0.2.0 requires
        golang.org/x/sys@v0.0.0-20220309202614-04245dca01da: reading file:///usr/lib/go/proxy/golang.org/x/sys/@v/v0.0.0-20220309202614-04245dca01da.mod: no such file or directory
go: gopkg.in/yaml.v3@v3.0.0-20220309205602-496545a6307b requires
        github.com/kr/text@v0.2.0 requires
        golang.org/x/sys@v0.0.0-20220309202614-04245dca01da: reading file:///usr/lib/go/proxy/golang.org/x/sys/@v/v0.0.0-20220309202614-04245dca01da.mod: no such file or directory
github.com/stretchr/testify/assert imports
        github.com/davecgh/go-spew/spew tested by
        github.com/davecgh/go-spew/spew.test imports
        github.com/davecgh/go-spew/spew/testdata: gopkg.in/yaml.v3@v3.0.0-20220309205602-496545a6307b requires
        github.com/kr/text@v0.2.0 requires
        golang.org/x/sys@v0.0.0-20220309202614-04245dca01da: reading file:///usr/lib/go/proxy/golang.org/x/sys/@v/v0.0.0-20220309202614-04245dca01da.mod: no such file or directory
github.com/stretchr/testify/assert imports
        gopkg.in/yaml.v3 tested by
        gopkg.in/yaml.v3.test imports
        gopkg.in/check.v1: gopkg.in/yaml.v3@v3.0.0-20220309205602-496545a6307b requires
        github.com/kr/text@v0.2.0 requires
        golang.org/x/sys@v0.0.0-20220309202614-04245dca01da: reading file:///usr/lib/go/proxy/golang.org/x/sys/@v/v0.0.0-20220309202614-04245dca01da.mod: no such file or directory
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x7d28ad]

goroutine 1 [running]:
cmd/go/internal/modload.(*loader).checkMultiplePaths(0xc00003a580)
        /usr/lib/go/src/cmd/go/internal/modload/load.go:1747 +0x2d
cmd/go/internal/modload.loadFromRoots({0xa70580, 0xc0000266d0}, {{{0x0, 0x0}, 0xc0001ddce0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...})
        /usr/lib/go/src/cmd/go/internal/modload/load.go:1122 +0xd78
cmd/go/internal/modload.LoadPackages({0xa70580, 0xc0000266d0}, {{0x0, 0x0}, 0xc0001ddce0, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
        /usr/lib/go/src/cmd/go/internal/modload/load.go:329 +0x328
cmd/go/internal/modcmd.runTidy({0xa70580, 0xc0000266d0}, 0xc0000329c0, {0xc0000200b0, 0x4, 0x35})
        /usr/lib/go/src/cmd/go/internal/modcmd/tidy.go:114 +0x1b7
main.invoke(0xd7f5e0, {0xc0000200a0, 0x2, 0x2})
        /usr/lib/go/src/cmd/go/main.go:216 +0x2f6
main.main()
        /usr/lib/go/src/cmd/go/main.go:173 +0x78e

@bcmills bcmills self-assigned this Mar 10, 2022
@bcmills bcmills added modules NeedsInvestigation labels Mar 10, 2022
@bcmills bcmills added this to the Go1.19 milestone Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
modules NeedsInvestigation
Projects
None yet
Development

No branches or pull requests

2 participants