8000 x/sys/windows: improper fix to previous report · Issue #65378 · golang/go · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
x/sys/windows: improper fix to previous report #65378
Closed
@derekwbrown

Description

@derekwbrown

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixPendingIssues that have a fix which has not yet been reviewed or submitted.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.OS-Windowscompiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0