-
Notifications
You must be signed in to change notification settings - Fork 580
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
windows: fix -d=checkptr slice failures #65
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
This PR (HEAD: 8f8c737) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/sys/+/225418 to see it. Tip: You can toggle comments from me using the |
Message from Gobot Gobot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
8f8c737
to
212a4e6
Compare
This PR (HEAD: 212a4e6) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/sys/+/225418 to see it. Tip: You can toggle comments from me using the |
Message from Tobias Klauser: Patch Set 3: (2 comments) Thanks for the CL. I'd suggest to split this up into two CLs: one addressing the golang.org/x/sys/unix package and one addressing the golang.org/x/sys/windows package. Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
This PR (HEAD: 9e3e00a) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/sys/+/225418 to see it. Tip: You can toggle comments from me using the |
Message from Tobias Klauser: Patch Set 5: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Tobias Klauser: Patch Set 7: Run-TryBot+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Gobot Gobot: Patch Set 7: TryBots beginning. Status page: https://farmer.golang.org/try?commit=a8670abf Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Gobot Gobot: Patch Set 7: TryBot-Result-1 1 of 14 TryBots failed: Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test exactly your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed. Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Tobias Klauser: Patch Set 7: Alex, could you please have a look at this if you find time? Thanks! Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
This PR (HEAD: 2ff63b3) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/sys/+/225418 to see it. Tip: You can toggle comments from me using the |
Message from Alex Brainman: Patch Set 8: (7 comments) Thank you Yaroslav for working on this. Please, see some comments below. Alex Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Bryan C. Mills: Patch Set 8: (5 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Bryan C. Mills: Patch Set 8: Run-TryBot+1 TRY=windows-amd64-race Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Gobot Gobot: Patch Set 8: SlowBots beginning. Status page: https://farmer.golang.org/try?commit=4d9c8109 Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Gobot Gobot: Patch Set 8: TryBot-Result+1 SlowBots are happy.
Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Alex Brainman: Patch Set 8: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Bryan C. Mills: Patch Set 8: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Alex Brainman: Patch Set 8: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Bryan C. Mills: Patch Set 8: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
This PR (HEAD: 2215e0a) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/sys/+/225418 to see it. Tip: You can toggle comments from me using the |
Message from Bryan C. Mills: Patch Set 16: Code-Review+1 (5 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Alex Brainman: Patch Set 16: (5 comments) Sorry I am slow to review. But this CL is large. Alex Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Tobias Klauser: Patch Set 16: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Alex Brainman: Patch Set 16: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Bryan C. Mills: Patch Set 16: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
This PR (HEAD: 43e62db) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/sys/+/225418 to see it. Tip: You can toggle comments from me using the |
This PR (HEAD: 77dff96) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/sys/+/225418 to see it. Tip: You can toggle comments from me using the |
Message from Yaroslav Vorobiov: Patch Set 18: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Alex Brainman: Patch Set 18: (2 comments) Just couple more comments. Thank you very much. Alex Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Ensure passing chkptr(-gcflags=all=-d=checkptr) check introduced in go 1.14
77dff96
to
73288ad
Compare
This PR (HEAD: 73288ad) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/sys/+/225418 to see it. Tip: You can toggle comments from me using the |
Message from Alex Brainman: Patch Set 19: Run-TryBot+1 TRY=windows-386, windows-amd64, windows-amd64-race Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Gobot Gobot: Patch Set 19: SlowBots beginning. Status page: https://farmer.golang.org/try?commit=9a4b5ce9 Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
Message from Gobot Gobot: Patch Set 19: TryBot-Result+1 SlowBots are happy.
Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
This CL fixes unsafe casts to slices that are missing length or capacity. Running tests with -d=checkptr enabled may panic on casting unsafe.Pointer to a static array of large predefined length, that is most likely much bigger than the size of the actual array in memory. Checkptr check is not satisfied if slicing operator misses length and capacity arguments `(*[(1 << 30) - 1]uint16)(unsafe.Pointer(p))[:]`, or when there is no slicing at all `(*[(1 << 30) - 1]uint16)(unsafe.Pointer(p))`. To find all potential cases I used `grep -nr ")(unsafe.Pointer(" ./windows`, then filtered out safe casts when object size is always static and known at compile time. To reproduce the issue run tests with checkptr enabled `go test -a -gcflags=all=-d=checkptr ./windows/...`. Updates golang/go#34972 Fixes golang/go#38355 Change-Id: I9dd2084b4f9fb7618cdb140fb2f38b56b6d6cc04 GitHub-Last-Rev: 73288ad GitHub-Pull-Request: #65 Reviewed-on: https://go-review.googlesource.com/c/sys/+/225418 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Message from Alex Brainman: Patch Set 19: Code-Review+2 LGTM Thank you very much. Alex Please don’t reply on this GitHub thread. Visit golang.org/cl/225418. |
This PR is being closed because golang.org/cl/225418 has been merged. |
This CL fixes unsafe casts to slices that are missing length or capacity.
Running tests with -d=checkptr enabled may panic on casting unsafe.Pointer to a static array of large predefined length, that is most likely much bigger than the size of the actual array in memory. Checkptr check is not satisfied if slicing operator misses length and capacity arguments
(*[(1 << 30) - 1]uint16)(unsafe.Pointer(p))[:]
, or when there is no slicing at all(*[(1 << 30) - 1]uint16)(unsafe.Pointer(p))
.To find all potential cases I used
grep -nr ")(unsafe.Pointer(" ./windows
, then filtered out safe casts when object size is always static and known at compile time.To reproduce the issue run tests with checkptr enabled
go test -a -gcflags=all=-d=checkptr ./windows/...
.Updates golang/go#34972
Fixes golang/go#38355