Skip to content

debug/buildinfo: module info not read when buildinfo section length exceeds 64KB  #61644

@c-kruse

Description

@c-kruse

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

$ go version
go version go1.20.6 linux/amd64

Does this issue reproduce with the latest release?

Y

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

linux amd64

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/christian/.cache/go-build"
GOENV="/home/christian/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/christian/go/pkg/mod"
GONOPROXY="github.com/sensu/*"
GONOSUMDB="github.com/sensu/*"
GOOS="linux"
GOPATH="/home/christian/go"
GOPRIVATE="github.com/sensu/*"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.6"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1935503120=/tmp/go-build -gno-record-gcc-switches"

What did you do?

When running go version -m on the latest release of the sumologic open telemetry collector distro.

ex:

$ wget -q https://github.com/SumoLogic/sumologic-otel-collector/releases/download/v0.81.0-sumo-0/otelcol-sumo-0.81.0-sumo-0-linux_amd64
$ go version -m otelcol-sumo-0.81.0-sumo-0-linux_amd64
otelcol-sumo-0.81.0-sumo-0-linux_amd64: go1.20.5

What did you expect to see?

I had expected to see module information as I did for the previous release. E.g.

otelcol-sumo-0.80.0-sumo-0-linux_amd64: go1.20.5
        path    github.com/SumoLogic/sumologic-otel-collector
        mod     github.com/SumoLogic/sumologic-otel-collector   (devel)
        dep     bitbucket.org/atlassian/go-asap/v2      v2.6.0  h1:KiLw3IgbzFLqNxCrVZoKUDJKMxUGoOd+NEOYXGEBhJ0=
        dep     cloud.google.com/go     v0.110.2
        =>      cloud.google.com/go     v0.110.2        h1:sdFPBr6xG9/wkBbfhmUz/JmZC7X6LavQgcrVINrKiVA=
...
        build   -buildmode=exe
        build   -compiler=gc
        build   -tags=netgo
        build   -trimpath=true
        build   CGO_ENABLED=0
        build   GOARCH=amd64
        build   GOOS=linux
        build   GOAMD64=v1
        build   vcs=git
        build   vcs.revision=727558f5fb91fd22e6a5d15f7e488b1bc7789c44
        build   vcs.time=2023-06-30T10:30:38Z
        build   vcs.modified=false

What did you see instead?

A condensed buildinfo summary with only the go build version.
otelcol-sumo-0.81.0-sumo-0-linux_amd64: go1.20.5

Apparent Root Cause

Digging into the suspect binary it appears that the module info expected is embedded in the .go.buildinfo section. It looks to me like there could be an oversight here - where we read the first 64KB of the section, then give up when the encoded module info blob length exceeds the bounds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions