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: segfault on go mod tidy -e #53461

Open
smowton opened this issue Jun 20, 2022 · 2 comments
Open

cmd/go: segfault on go mod tidy -e #53461

smowton opened this issue Jun 20, 2022 · 2 comments
Labels
NeedsInvestigation
Milestone

Comments

@smowton
Copy link

@smowton smowton commented Jun 20, 2022

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

$ go version
go version go1.18.3 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/chris/Library/Caches/go-build"
GOENV="/Users/chris/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/chris/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/chris/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.18.3"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/tmp/secretless-broker/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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/qf/lz68g8yn69xfxtdgmhs1lx_80000gn/T/go-build3273412121=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

git clone https://github.com/cyberark/secretless-broker
git checkout 9e5c440ff94c9f8f4cc5b93058936b759ba7c224 # As of now this is the tip of 'main'
cd secretless-broker && go mod tidy -e

What did you expect to see?

Not a segfault

What did you see instead?

...
go: github.com/cyberark/conjur-authn-k8s-client@v0.23.5: parsing go.mod: go.mod:14:2: require github.com/cyberark/conjur-opentelemetry-tracer: version "latest" invalid: must be of the form v1.2.3
go: github.com/cyberark/conjur-authn-k8s-client@v0.23.5: parsing go.mod: go.mod:14:2: require github.com/cyberark/conjur-opentelemetry-tracer: version "latest" invalid: must be of the form v1.2.3
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x13fe66b]

goroutine 1 [running]:
cmd/go/internal/modload.loadFromRoots({0x16dcb38, 0xc000122000}, {{{0x0, 0x0}, 0xc0001c6060, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...})
	/usr/local/go/src/cmd/go/internal/modload/load.go:1183 +0xa6b
cmd/go/internal/modload.LoadPackages({0x16dcb38?, 0xc000122000}, {{0x0, 0x0}, 0xc0001c6060, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
	/usr/local/go/src/cmd/go/internal/modload/load.go:343 +0x308
cmd/go/internal/modcmd.runTidy({0x16dcb38, 0xc000122000}, 0xc00013c3f0?, {0xc00013e030?, 0x4?, 0x2?})
	/usr/local/go/src/cmd/go/internal/modcmd/tidy.go:114 +0x198
main.invoke(0x19bb520, {0xc00013e020, 0x2, 0x2})
	/usr/local/go/src/cmd/go/main.go:218 +0x2ee
main.main()
	/usr/local/go/src/cmd/go/main.go:175 +0x78e

@dmitshur dmitshur changed the title Segfault on go mod tidy -e cmd/go: segfault on go mod tidy -e Jun 20, 2022
@gregory-m
Copy link
Contributor

@gregory-m gregory-m commented Jun 20, 2022

I have short reproducer without using external repo:

gregory@Gregorys-MBP  ~/Documents/my/mod-test
⇢ $ ls -la  
total 16
drwxr-xr-x   4 gregory  staff  128 20 Jun 19:34 .
drwxr-xr-x  28 gregory  staff  896 20 Jun 19:32 ..
-rw-r--r--   1 gregory  staff  126 20 Jun 19:33 go.mod
-rw-r--r--   1 gregory  staff  110 20 Jun 19:34 main.go

gregory@Gregorys-MBP  ~/Documents/my/mod-test
⇢ $ cat go.mod
go 1.18

module github.com/gregory-m/mod-test

require (

)

require (
	github.com/cyberark/conjur-authn-k8s-client latest
)

gregory@Gregorys-MBP  ~/Documents/my/mod-test
⇢ $ cat main.go
package main

import (
	 "github.com/cyberark/conjur-authn-k8s-client/pkg/authenticator"
)


func main() {

}

gregory@Gregorys-MBP  ~/Documents/my/mod-test
⇢ $ go mod tidy -e
go: github.com/cyberark/conjur-authn-k8s-client@v0.23.5: parsing go.mod: go.mod:14:2: require github.com/cyberark/conjur-opentelemetry-tracer: version "latest" invalid: must be of the form v1.2.3
go: github.com/cyberark/conjur-authn-k8s-client@v0.23.5: parsing go.mod: go.mod:14:2: require github.com/cyberark/conjur-opentelemetry-tracer: version "latest" invalid: must be of the form v1.2.3
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x13fe56b]

goroutine 1 [running]:
cmd/go/internal/modload.loadFromRoots({0x16dca98, 0xc0000a2000}, {{{0x0, 0x0}, 0xc0001c4060, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...})
	/usr/local/Cellar/go/1.18.3/libexec/src/cmd/go/internal/modload/load.go:1183 +0xa6b
cmd/go/internal/modload.LoadPackages({0x16dca98?, 0xc0000a2000}, {{0x0, 0x0}, 0xc0001c4060, 0x1, {0x0, 0x0}, 0x1, 0x1, ...}, ...)
	/usr/local/Cellar/go/1.18.3/libexec/src/cmd/go/internal/modload/load.go:343 +0x308
cmd/go/internal/modcmd.runTidy({0x16dca98, 0xc0000a2000}, 0xc0000d0438?, {0xc0000be030?, 0x4?, 0x2?})
	/usr/local/Cellar/go/1.18.3/libexec/src/cmd/go/internal/modcmd/tidy.go:114 +0x198
main.invoke(0x19bf520, {0xc0000be020, 0x2, 0x2})
	/usr/local/Cellar/go/1.18.3/libexec/src/cmd/go/main.go:218 +0x2ee
main.main()
	/usr/local/Cellar/go/1.18.3/libexec/src/cmd/go/main.go:175 +0x78e

@cagedmantis cagedmantis added the NeedsInvestigation label Jun 23, 2022
@cagedmantis cagedmantis added this to the Backlog milestone Jun 23, 2022
@cagedmantis
Copy link
Contributor

@cagedmantis cagedmantis commented Jun 23, 2022

/cc @bcmills @matloob

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation
Projects
None yet
Development

No branches or pull requests

3 participants