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

x/debug: nil ptr dereference when parsing runtime.itabTableType #72878

Open
pwschuurman opened this issue Mar 15, 2025 · 3 comments
Open

x/debug: nil ptr dereference when parsing runtime.itabTableType #72878

pwschuurman opened this issue Mar 15, 2025 · 3 comments
Assignees
Labels
BugReport Issues describing a possible bug in the Go implementation. compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@pwschuurman
Copy link

Go version

go1.25-20250216-RC00

Output of go env in your module/workspace:

AR='ar'
CC='clang'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='clang++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/workspace/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/workspace/.config/go/env'
GOEXE=''
GOEXPERIMENT='fieldtrack,boringcrypto'
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build829528664=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/workspace/github_workspaces/debug/go.mod'
GOMODCACHE='/workspace/go/pkg/mod'
GOOS='linux'
GOPATH='/workspace/go'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/workspace/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/workspace/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/google-golang/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.25-20250216-RC00 cl/727547642 +d524e1eccd X:fieldtrack,boringcrypto'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

Ran viewcore on a coredump that had a runtime.itabTableType type allocated in heap. This caused the application to crash with a nil ptr dereference.

What did you see happen?

Core "tmp/core.283046" was generated by "/gce-pd-csi-driver"
Entering interactive mode (type 'help' for commands)
(viewcore) histogram
Error while trying to run command "histogram": runtime error: invalid memory address or nil pointer dereference
Stack: goroutine 1 [running]:
runtime/debug.Stack()
        /usr/lib/google-golang/src/runtime/debug/stack.go:26 +0x5e
main.capturePanic.func1()
        /workspace/debug/cmd/viewcore/main.go:372 +0x3d
panic({0x9e8b20?, 0xecb700?})
        /usr/lib/google-golang/src/runtime/panic.go:799 +0x132
golang.org/x/debug/internal/gocore.(*Type).field(...)
        /workspace/debug/internal/gocore/type.go:86
golang.org/x/debug/internal/gocore.runtimeItab.Type(...)
        /workspace/debug/internal/gocore/type.go:196
golang.org/x/debug/internal/gocore.(*Process).typeObject(0xc000280000, 0x300b8f0, 0xc001f242a0, {0xb348b0, 0xc000274000}, 0xc00b1e3280)
        /workspace/debug/internal/gocore/type.go:645 +0x155
golang.org/x/debug/internal/gocore.(*Process).doTypeHeap.func2(0x0?)
        /workspace/debug/internal/gocore/type.go:536 +0x91
golang.org/x/debug/internal/gocore.(*Process).ForEachRoot(...)
        /workspace/debug/internal/gocore/object.go:191
golang.org/x/debug/internal/gocore.(*Process).doTypeHeap(0xc000280000)
        /workspace/debug/internal/gocore/type.go:529 +0x1f6
sync.(*Once).doSlow(0x564562?, 0xc00b1e3560?)
        /usr/lib/google-golang/src/sync/once.go:78 +0xab
sync.(*Once).Do(...)
        /usr/lib/google-golang/src/sync/once.go:69
golang.org/x/debug/internal/gocore.(*Process).typeHeap(...)
        /workspace/debug/internal/gocore/type.go:400
golang.org/x/debug/internal/gocore.(*Process).Type(0xc000280000, 0xc000034000)
        /workspace/debug/internal/gocore/object.go:219 +0x4a
main.typeName(0xc000280000, 0xc000034000)
        /workspace/debug/cmd/viewcore/main.go:789 +0x9e
main.runHistogram.func1(0xc000280000?, 0xc000034000, 0x8?)
        /workspace/debug/cmd/viewcore/main.go:484 +0x3a
golang.org/x/debug/internal/gocore.(*Process).ForEachRootPtr.func1(0x0, 0xc00b35afc0?)
        /workspace/debug/internal/gocore/object.go:257 +0x3f
golang.org/x/debug/internal/gocore.walkRootTypePtrs(0xc000280000, 0xc002b15bc0, {0xc00b1e3718, 0x8, 0x8}, 0x0, 0xc007c4c360?, 0xc00b1e3720)
        /workspace/debug/internal/gocore/root.go:163 +0x2ab
golang.org/x/debug/internal/gocore.(*Process).forEachRootPtr(...)
        /workspace/debug/internal/gocore/object.go:269
golang.org/x/debug/internal/gocore.(*Process).ForEachRootPtr(0xc0000fa300?, 0xa6acf5?, 0x3?)
        /workspace/debug/internal/gocore/object.go:254 +0x4b
main.runHistogram(0xc0000fa300?, {0xeffd80?, 0x4?, 0xa6b4df?})
        /workspace/debug/cmd/viewcore/main.go:483 +0x1fb
github.com/spf13/cobra.(*Command).execute(0xed62e0, {0xeffd80, 0x0, 0x0})
        /gopath/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:944 +0x843
github.com/spf13/cobra.(*Command).ExecuteC(0xc0000ff208)
        /gopath/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
        /gopath/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
main.runRoot.func2()
        /workspace/debug/cmd/viewcore/main.go:361 +0x7c
main.capturePanic(0xb32820?)
        /workspace/debug/cmd/viewcore/main.go:376 +0x51
main.runRoot(0xed5760, {0xc00007e880?, 0x4?, 0xa6b4df?})
        /workspace/debug/cmd/viewcore/main.go:358 +0x672
github.com/spf13/cobra.(*Command).execute(0xed5760, {0xc000022120, 0x2, 0x2})
        /gopath/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:944 +0x843
github.com/spf13/cobra.(*Command).ExecuteC(0xed5760)
        /gopath/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
        /gopath/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
main.main()
        /workspace/debug/cmd/viewcore/main.go:244 +0x132
Core "tmp/core.283046" was generated by "/gce-pd-csi-driver"
Entering interactive mode (type 'help' for commands)
(viewcore) histogram
Error while trying to run command "histogram": runtime error: invalid memory address or nil pointer dereference
Stack: goroutine 1 [running]:
runtime/debug.Stack()
        /usr/lib/google-golang/src/runtime/debug/stack.go:26 +0x5e
main.capturePanic.func1()
        /workspace/debug/cmd/viewcore/main.go:372 +0x3d
panic({0x9e8b20?, 0xecb700?})
        /usr/lib/google-golang/src/runtime/panic.go:799 +0x132
golang.org/x/debug/internal/gocore.(*Process).typeObject(0xc0002ca000, 0x300b8f0, 0xc0033a8300, {0xb348b0, 0xc0002be000}, 0xc00b28d280)
        /workspace/debug/internal/gocore/type.go:648 +0xedb
golang.org/x/debug/internal/gocore.(*Process).doTypeHeap.func2(0x0?)
        /workspace/debug/internal/gocore/type.go:539 +0x91
golang.org/x/debug/internal/gocore.(*Process).ForEachRoot(...)
        /workspace/debug/internal/gocore/object.go:191
golang.org/x/debug/internal/gocore.(*Process).doTypeHeap(0xc0002ca000)
        /workspace/debug/internal/gocore/type.go:532 +0x1f6
sync.(*Once).doSlow(0x564562?, 0xc00b28d560?)
        /usr/lib/google-golang/src/sync/once.go:78 +0xab
sync.(*Once).Do(...)
        /usr/lib/google-golang/src/sync/once.go:69
golang.org/x/debug/internal/gocore.(*Process).typeHeap(...)
        /workspace/debug/internal/gocore/type.go:403
golang.org/x/debug/internal/gocore.(*Process).Type(0xc0002ca000, 0xc000034000)
        /workspace/debug/internal/gocore/object.go:219 +0x4a
main.typeName(0xc0002ca000, 0xc000034000)
        /workspace/debug/cmd/viewcore/main.go:789 +0x9e
main.runHistogram.func1(0xc0002ca000?, 0xc000034000, 0x8?)
        /workspace/debug/cmd/viewcore/main.go:484 +0x3a
golang.org/x/debug/internal/gocore.(*Process).ForEachRootPtr.func1(0x0, 0xc00ac7f440?)
        /workspace/debug/internal/gocore/object.go:257 +0x3f
golang.org/x/debug/internal/gocore.walkRootTypePtrs(0xc0002ca000, 0xc007396480, {0xc00b28d718, 0x8, 0x8}, 0x0, 0xc00826cea0?, 0xc00b28d720)
        /workspace/debug/internal/gocore/root.go:163 +0x2ab
golang.org/x/debug/internal/gocore.(*Process).forEachRootPtr(...)
        /workspace/debug/internal/gocore/object.go:269
golang.org/x/debug/internal/gocore.(*Process).ForEachRootPtr(0xc00017e300?, 0xa6acf5?, 0x3?)
        /workspace/debug/internal/gocore/object.go:254 +0x4b
main.runHistogram(0xc00017e300?, {0xeffd80?, 0x4?, 0xa6b4df?})
        /workspace/debug/cmd/viewcore/main.go:483 +0x1fb
github.com/spf13/cobra.(*Command).execute(0xed62e0, {0xeffd80, 0x0, 0x0})
        /gopath/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:944 +0x843
github.com/spf13/cobra.(*Command).ExecuteC(0xc000187208)
        /gopath/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
        /gopath/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
main.runRoot.func2()
        /workspace/debug/cmd/viewcore/main.go:361 +0x7c
main.capturePanic(0xb32820?)
        /workspace/debug/cmd/viewcore/main.go:376 +0x51
main.runRoot(0xed5760, {0xc00012a860?, 0x4?, 0xa6b4df?})
        /workspace/debug/cmd/viewcore/main.go:358 +0x672
github.com/spf13/cobra.(*Command).execute(0xed5760, {0xc0001300a0, 0x2, 0x2})
        /gopath/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:944 +0x843
github.com/spf13/cobra.(*Command).ExecuteC(0xed5760)
        /gopath/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
        /gopath/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
main.main()
        /workspace/debug/cmd/viewcore/main.go:244 +0x132

What did you expect to see?

Expected program to parse core file gracefully

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Mar 15, 2025
@gopherbot gopherbot added this to the Unreleased milestone Mar 15, 2025
@gabyhelp gabyhelp added the BugReport Issues describing a possible bug in the Go implementation. label Mar 15, 2025
@dr2chase
Copy link
Contributor

@golang/compiler
Looks like people are using viewcore, yay.

@dr2chase dr2chase added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 15, 2025
@cherrymui
Copy link
Member

What version of viewcore are you using? Have you tried the latest version? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugReport Issues describing a possible bug in the Go implementation. compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Development

No branches or pull requests

6 participants