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

go/types: panic: runtime error: invalid memory address or nil pointer dereference with go1.22rc1 #64812

Closed
MadhavJivrajani opened this issue Dec 20, 2023 · 4 comments

Comments

@MadhavJivrajani
Copy link

MadhavJivrajani commented Dec 20, 2023

Go version

go version go1.22rc1 darwin/amd64

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

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/mjivrajani/Library/Caches/go-build'
GOENV='/Users/mjivrajani/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/mjivrajani/gocode/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/mjivrajani/gocode'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/mjivrajani/gocode/pkg/mod/golang.org/toolchain@v0.0.1-go1.22rc1.darwin-amd64'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='go1.22rc1'
GOTOOLDIR='/Users/mjivrajani/gocode/pkg/mod/golang.org/toolchain@v0.0.1-go1.22rc1.darwin-amd64/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.22rc1'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/mjivrajani/gocode/src/github.com/MadhavJivrajani/kubernetes/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/r7/f6kyp7vs0sv90105pjh1t8340000gp/T/go-build620260146=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

Started testing Kubernetes with go1.22rc1.
Ref: kubernetes/kubernetes#122410

Steps to reproduce the error:

Clone Kubernetes

git clone git@github.com:kubernetes/kubernetes.git --depth 1

Run test

In the root of the repo:

GO_VERSION=1.22rc1 ./hack/verify-typecheck-providerless.sh

What did you expect to see?

I expected the test to work as before without the panic.

If you run the same test with go1.21.5:

GO_VERSION=1.21.5 ./hack/verify-typecheck-providerless.sh

This should pass.

What did you see instead?

On running

GO_VERSION=1.22rc1 ./hack/verify-typecheck-providerless.sh

You should see:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x8b1d95e]

goroutine 1105 [running]:
go/types.(*Checker).handleBailout(0xc004566e00, 0xc00457fbd0)
	/Users/mjivrajani/gocode/src/github.com/MadhavJivrajani/kubernetes/_output/local/.gimme/versions/go1.22rc1.darwin.amd64/src/go/types/check.go:367 +0x88
panic({0x8c0b020?, 0x8da4520?})
	/Users/mjivrajani/gocode/src/github.com/MadhavJivrajani/kubernetes/_output/local/.gimme/versions/go1.22rc1.darwin.amd64/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0x8c48240, 0x8da7440})
	/Users/mjivrajani/gocode/src/github.com/MadhavJivrajani/kubernetes/_output/local/.gimme/versions/go1.22rc1.darwin.amd64/src/go/types/sizes.go:228 +0x31e
...

PS - we get the same result on linux/amd64 as well: https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/122410/pull-kubernetes-typecheck/1737348733923758080

@MadhavJivrajani
Copy link
Author

I see SizeOf at the top of the call stack, which internally uses an implementation of types.Sizes. From the go1.22 release notes (https://tip.golang.org/doc/go1.22):

The implementation of SizesFor has been adjusted to compute the same type sizes as the compiler when the compiler argument for SizesFor is "gc". The default Sizes implementation used by the type checker is now types.SizesFor("gc", "amd64").

I wonder if this is related

@cuonglm
Copy link
Member

cuonglm commented Dec 20, 2023

@MadhavJivrajani Yes, see this for more details: #61035 (comment)

@cuonglm
Copy link
Member

cuonglm commented Dec 20, 2023

Duplicated of #62167

@cuonglm cuonglm closed this as completed Dec 20, 2023
MadhavJivrajani added a commit to MadhavJivrajani/kubernetes that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
@MadhavJivrajani
Copy link
Author

Thanks @cuonglm!
After bumping x/tools, this was resolved ❤️

MadhavJivrajani added a commit to MadhavJivrajani/kubernetes that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
MadhavJivrajani added a commit to MadhavJivrajani/kubernetes that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
k8s-publishing-bot pushed a commit to kubernetes/code-generator that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/apimachinery that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/api that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/client-go that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/component-base that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/component-helpers that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/kms that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/apiserver that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/kube-aggregator that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/sample-apiserver that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/sample-controller that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/apiextensions-apiserver that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/metrics that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/cli-runtime that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/sample-cli-plugin that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/kube-proxy that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/cri-api that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/kubelet that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/kube-scheduler that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/controller-manager that referenced this issue Dec 20, 2023
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: a8da4202c0ac785d57b545e6e310fd754888b50e
k8s-publishing-bot pushed a commit to kubernetes/mount-utils that referenced this issue Jan 10, 2024
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: ad5cf74325652795717d80940e0e04ed5b7c047d
k8s-publishing-bot pushed a commit to kubernetes/mount-utils that referenced this issue Jan 10, 2024
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: b055126537b1e2b59890469dcfbf795596cc8556
k8s-publishing-bot pushed a commit to kubernetes/legacy-cloud-providers that referenced this issue Jan 10, 2024
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: 18f057f9b74256d45138538a6168802fe96f5e65
k8s-publishing-bot pushed a commit to kubernetes/legacy-cloud-providers that referenced this issue Jan 10, 2024
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: ad5cf74325652795717d80940e0e04ed5b7c047d
k8s-publishing-bot pushed a commit to kubernetes/legacy-cloud-providers that referenced this issue Jan 10, 2024
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: b055126537b1e2b59890469dcfbf795596cc8556
k8s-publishing-bot pushed a commit to kubernetes/kubectl that referenced this issue Jan 10, 2024
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: 18f057f9b74256d45138538a6168802fe96f5e65
k8s-publishing-bot pushed a commit to kubernetes/kubectl that referenced this issue Jan 10, 2024
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: ad5cf74325652795717d80940e0e04ed5b7c047d
k8s-publishing-bot pushed a commit to kubernetes/kubectl that referenced this issue Jan 10, 2024
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: b055126537b1e2b59890469dcfbf795596cc8556
k8s-publishing-bot pushed a commit to kubernetes/pod-security-admission that referenced this issue Jan 10, 2024
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: 18f057f9b74256d45138538a6168802fe96f5e65
k8s-publishing-bot pushed a commit to kubernetes/pod-security-admission that referenced this issue Jan 10, 2024
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: ad5cf74325652795717d80940e0e04ed5b7c047d
k8s-publishing-bot pushed a commit to kubernetes/pod-security-admission that referenced this issue Jan 10, 2024
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: b055126537b1e2b59890469dcfbf795596cc8556
k8s-publishing-bot pushed a commit to kubernetes/dynamic-resource-allocation that referenced this issue Jan 10, 2024
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: 18f057f9b74256d45138538a6168802fe96f5e65
k8s-publishing-bot pushed a commit to kubernetes/dynamic-resource-allocation that referenced this issue Jan 10, 2024
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: ad5cf74325652795717d80940e0e04ed5b7c047d
k8s-publishing-bot pushed a commit to kubernetes/dynamic-resource-allocation that referenced this issue Jan 10, 2024
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: b055126537b1e2b59890469dcfbf795596cc8556
k8s-publishing-bot pushed a commit to kubernetes/endpointslice that referenced this issue Jan 10, 2024
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: ad5cf74325652795717d80940e0e04ed5b7c047d
k8s-publishing-bot pushed a commit to kubernetes/endpointslice that referenced this issue Jan 10, 2024
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: b055126537b1e2b59890469dcfbf795596cc8556
jiahuif pushed a commit to jiahuif-forks/kubernetes that referenced this issue Jan 23, 2024
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
sergeydobrodey added a commit to sergeydobrodey/sqlvet that referenced this issue Mar 20, 2024
houqp pushed a commit to houqp/sqlvet that referenced this issue Mar 21, 2024
* golang 1.22.x support (golang/go#64812)

* protobuf: fix CVE-2024-24786
dinhxuanvu pushed a commit to dinhxuanvu/kubernetes that referenced this issue Mar 28, 2024
Bumping tools to include the fix for a nil pointer
deref error in go/types. See golang/go#64812
for more details.

This fix is needed for when we bump to go1.22.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
Groxx added a commit to Groxx/cadence-client that referenced this issue May 20, 2024
Mockery is currenty failing on 1.22 due to golang/go#64812
Groxx added a commit to uber-go/cadence-client that referenced this issue May 20, 2024
Mockery is currently failing on go 1.22 on Linux due to golang/go#64812
tl;dr, changes in go 1.22 break the popular `x/tools/go/packages.Load` tool, which Mockery uses.

Upgrading our tools' `x/tools` (to latest) resolves it, and appears to work fine for go 1.19 and above on both Linux and OSX, and has zero effect on our users.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants