Description
Go version
1.21.5
Output of go env
in your module/workspace:
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\db\AppData\Local\go-build
set GOENV=C:\Users\db\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=c:\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=c:\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go\1.21.5\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=c:\go\1.21.5\go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.21.5
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\src\datadog-windows-procmon\go.mod
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\db\AppData\Local\Temp\go-build3031818741=/tmp/go-build -gno-record-gcc-switches
What did you do?
Submitted #65365
But the fix that was submitted creates different problems, including when race
is not enabled.
What did you see happen?
Opening a new issue because it's not clear if follow up comments after an issue is closed are seen.
I submitted issue #65365
However, the fix creates additional problems.
the fix supplies the optional parameter lpNumberOfBytesRead
even when race
is not set, and when the caller provided null.
However, the documentation explicitly says don't do that:
Use NULL for this parameter if this is an asynchronous operation to avoid potentially erroneous results.
So, as a result of the fix, the library now introduces indeterminant behavior into calling code, even when race is not enabled.
What did you expect to see?
A fix that doesn't break additional code.
Suggest the conditional become
func ReadFile(fd Handle, p []byte, done *uint32, overlapped *Overlapped) error {
err := readFile(fd, p, done, overlapped)
if raceenabled && done {
if *done > 0 {
raceWriteRange(unsafe.Pointer(&p[0]), int(*done))
}
}
return err
}
Or similar, since the value of lpNumberOfBytesRead
is not valid in the case where an overlapped operation has been initiated.