Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syscall: checkptr failures relating to Dirent on darwin and freebsd #35092

Closed
mdempsky opened this issue Oct 23, 2019 · 11 comments
Closed

syscall: checkptr failures relating to Dirent on darwin and freebsd #35092

mdempsky opened this issue Oct 23, 2019 · 11 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Soon This needs to be done soon. (regressions, serious bugs, outages) Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@mdempsky
Copy link
Member

The freebsd and darwin -race builders are currently failing:

Both of these appear to be failing due to use of syscall.Dirent.

@mdempsky mdempsky added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 23, 2019
@cuonglm
Copy link
Member

cuonglm commented Oct 23, 2019

It does not happen for me under 10.15:

$ env -u GO111MODULE go tool dist test -race go_test:syscall
##### Testing packages.
ok  	syscall	3.549s

ALL TESTS PASSED (some were excluded)

@bradfitz bradfitz added Soon This needs to be done soon. (regressions, serious bugs, outages) Testing An issue that has been verified to require only test changes, not just a test failure. labels Oct 23, 2019
@bradfitz bradfitz added this to the Go1.14 milestone Oct 23, 2019
@cuonglm
Copy link
Member

cuonglm commented Oct 23, 2019

It seems that:

$ cd syscall
$ go test -race

trigger the error.

@cuonglm
Copy link
Member

cuonglm commented Oct 23, 2019

So it's not -race, but in #34972, we check with -short, so not all tests were run. With:

go test -a -gcflags=all=-d=checkptr syscall

The test is always false.

@tklauser
Copy link
Member

Same happens in golang.org/x/sys/unix on the freebsd-amd64-race builder with -d=checkptr enabled:

https://build.golang.org/log/79e02a85654067a443293a96844a33710e123c27

@mdempsky
Copy link
Member Author

I'm probably not going to have time to look into this for another week or so. If someone wants to fix this, please go for it. Otherwise, it's probably worth at least adding some //go:nocheckptr directives with TODOs referencing this issue to at least get the build passing again.

@cuonglm
Copy link
Member

cuonglm commented Oct 24, 2019

@mdempsky I'm investigating darwin one. Still not clearly understand the issue. If I add runtime.KeepAlive(buf) after this line:

var buf [2048]byte

Then the test pass. But it does fails again with -d=checkptr=2.

@gopherbot
Copy link

Change https://golang.org/cl/203077 mentions this issue: syscall: make TestGetdirentries checkptr safe

gopherbot pushed a commit that referenced this issue Oct 24, 2019
Fixes Darwin.

Updates #35092

Change-Id: I045f070c8549d00610b459e3a82cac870d9ddb54
Reviewed-on: https://go-review.googlesource.com/c/go/+/203077
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@gopherbot
Copy link

Change https://golang.org/cl/202878 mentions this issue: syscall: make convertFromDirents11 checkptr safe

@gopherbot
Copy link

Change https://golang.org/cl/202959 mentions this issue: unix: make convertFromDirents11 checkptr safe

@gopherbot
Copy link

Change https://golang.org/cl/202880 mentions this issue: syscall: correct comment in testGetdirentries

gopherbot pushed a commit that referenced this issue Oct 24, 2019
Correct comment about allocating big enough slice to copy result of
Getdirentries.

While at it, also convert from Dirent directly to slice of byte.

Updates #35092

Change-Id: I892de7953120622882e1561728e1e56b009a2351
Reviewed-on: https://go-review.googlesource.com/c/go/+/202880
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@gopherbot
Copy link

Change https://golang.org/cl/203238 mentions this issue: unix: make convertFromDirents11 checkptr safe

gopherbot pushed a commit to golang/sys that referenced this issue Oct 25, 2019
Follow CL 202878 which did the same for package syscall.

Updates golang/go#35092

Change-Id: Id53d2cde0333581c98d13b096a48f2a602b2425f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/202959
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@golang golang locked and limited conversation to collaborators Oct 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Soon This needs to be done soon. (regressions, serious bugs, outages) Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

5 participants