Skip to content

runtime/pprof: shows invalid instruction addresses #70609

@alexanius

Description

@alexanius

Go version

go version devel go1.24-caee788a48 Thu Nov 28 02:59:28 2024 +0000 linux/arm64

Output of go env in your module/workspace:

AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/amarkin/.cache/go-build'
GODEBUG=''
GOENV='/home/amarkin/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2308839239=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/home/amarkin/test/bench/go1/go.mod'
GOMODCACHE='/home/amarkin/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/amarkin/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/amarkin/repo/go_trunk'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/amarkin/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/amarkin/repo/go_trunk/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='devel go1.24-caee788a48 Thu Nov 28 02:59:28 2024 +0000'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

go test -c -o go1.go.out

./go1.go.out -test.bench=. -test.cpuprofile=t.pgo -test.count=5

go tool pprof -raw -addresses t.pgo | grep "0x2ab6.[^0-9a-f]"
  1429: 0x2ab64 M=1 runtime.gcBgMarkWorker.func2 /home/amarkin/repo/go_trunk/src/runtime/mgc.go:1496:0 s=1483
  5624: 0x2ab63 M=1 runtime.gcBgMarkWorker.func2 /home/amarkin/repo/go_trunk/src/runtime/mgc.go:1495:0 s=1483

go tool objdump go1.go.out | grep "0x2ab6.[^0-9a-f]"
  mgc.go:1495           0x2ab60                 94008e48                CALL runtime.casGToWaitingForGC(SB)
  mgc.go:1496           0x2ab64                 f9401be3                MOVD 48(RSP), R3
  mgc.go:1496           0x2ab68                 3980007b                MOVB (R3), R27
  mgc.go:1496           0x2ab6c                 f9491c64                MOVD 4664(R3), R4

What did you see happen?

We see, that the pprof shows an instruction with an address 0x2ab63, that actually cannot be in the arm binary. Additional check with objdump shows, that this binary does not have instruction with such address. In large applications the number of such incorrect instructions makes almost impossible performance analysis of particular instructions.

The image shows the output of more complicated application with this problem
image

What did you expect to see?

I expect to see correct instructions in the pprof tool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions