Skip to content

[dev.fuzz] cmd/go: hangs in "gathering baseline coverage" #46633

@klauspost

Description

@klauspost

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

λ gotip version
go version devel go1.17-5542c10fbf Fri Jun 4 03:07:33 2021 +0000 windows/amd64

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

go env Output
λ gotip env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=d:\temp\gocache
set GOENV=C:\Users\klaus\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=e:\gopath\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=e:\gopath
set GOPRIVATE=
set GOPROXY=https://goproxy.io
set GOROOT=C:\Users\klaus\sdk\gotip
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Users\klaus\sdk\gotip\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=devel go1.17-5542c10fbf Fri Jun 4 03:07:33 2021 +0000
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=d:\temp\wintemp\go-build1674875180=/tmp/go-build -gno-record-gcc-switches

What did you do?

Run fuzz test:

func FuzzMinimize(f *testing.F) {
	f.Add([]byte{4: 0})
	f.Fuzz(func(t *testing.T, data []byte) {
		if len(data) < 4 {
			return
		}
		if bits.OnesCount32(binary.LittleEndian.Uint32(data)) >= 28 {
			t.Fatal("err")
		}
	})
}

First output generates crash. Generates file in GOCACHE: 7777bc1fe491b6e2c55af04cf305ec8b045058c3c61be9eaae8be7fb0859e4c3.gz

(gzipped for github)

λ gotip test -fuzz=FuzzMinimize -test.run=None                                                                                   
found a crash, minimizing...                                                                                                     
fuzzing, elapsed: 1.2s, execs: 7 (6/sec), workers: 32, interesting: 1                                                            
--- FAIL: FuzzMinimize (1.17s)                                                                                                   
        --- FAIL: FuzzMinimize (0.00s)                                                                                           
            fuzz_test.go:227: err                                                                                                
                                                                                                                                 
    Crash written to testdata\corpus\FuzzMinimize\1770021c52f7a4641b23ff7c71ebe5fce49215cf4935a3d737487b5e598662d6               
    To re-run:                                                                                                                   
    go test github.com/klauspost/compress/zstd -run=FuzzMinimize/1770021c52f7a4641b23ff7c71ebe5fce49215cf4935a3d737487b5e598662d6
FAIL                                                                                                                             
exit status 1                                                                                                                    
FAIL    github.com/klauspost/compress/zstd      1.236s                                                                           

Restarting the fuzzer appears stuck:

λ gotip test -fuzz=FuzzMinimize -test.run=None
gathering baseline coverage, elapsed: 3.0s, workers: 32, left: 1
gathering baseline coverage, elapsed: 6.0s, workers: 32, left: 1
gathering baseline coverage, elapsed: 9.0s, workers: 32, left: 1
...
gathering baseline coverage, elapsed: 657.0s, workers: 32, left: 1
...

What did you expect to see?

Fuzzer would exit or progress.

What did you see instead?

Fuzzer stuck in "gathering baseline coverage" forever.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.fuzzIssues related to native fuzzing support

    Type

    No type

    Projects

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions