-
Notifications
You must be signed in to change notification settings - Fork 18k
syscall: memory corruption in *bool types generated by mksyscall_windows.go [1.13 backport] #34388
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
Comments
Change https://golang.org/cl/196417 mentions this issue: |
Given that lots of external code uses this, and that it's currently causing memory corruption, and that we need to use it for the development of x/sys itself, this seems like a pretty good thing to backport. |
That was broken forever. And all Go developers always use current tip. But it is a small change, and can be easily ported. I am fine with whatever decision is here. Leaving it to others to decide. Thank you. Alex |
Not me. And probably not a lot of people who run |
I've seen issues where folks indicate that they're still using 1.11. |
Can you open a backport issue for 1.12? |
On CL 196417, @bradfitz commented:
@zx2c4, @networkimprov: are there specific examples of developers using |
WireGuard uses it extensively. Microsoft's go-winio uses it. Basically any non-trivial Windows program requires it to get stuff done, since x/sys doesn't [try to?] cover everything. |
I use it for my development. But I always run current Go tip. Alex |
Should we be encouraging folks to expand Is there some other restructuring we should do in |
I never considered that program part of our API. I thought it was an internal detail for the Go repo's own use. If people are using it, I agree that it should live elsewhere. |
FWIW, the mksyscalls.go program has been designed to be used externally, and so people do. There's some code in there to try to figure out the calling context. Here's a file from a high profile Microsoft project: https://github.com/microsoft/go-winio/blob/master/syscall.go |
Yes, you already mentioned that Wireguard and go-winio uses it. That's not in dispute. The question is where it should live. I think it should move to x/sys/windows/mkwinsyscall and we could remove the |
That sounds like a good plan. I was playing with that last week trying to figure out how I could invoke that from a go generate directive. We'd want to use |
Yep. |
When I said "move to x/sys/windows/mkwinsyscall" I meant that would be the directory name (and thus the binary name if people go install it). The filename could be whatever. Either mkwinsyscall.go or mksyscall_windows.go if we wanted to make it easier to find for people used to the old name. But given there are like only a handful of such people, I think just naming the file mkwinsyscall.go is fine too. |
And then the go repo itself would use mksyscall.go from its internal vendored copy of x/sys/windows? So what if for 1.13.2 we do the backport for the bug fix, since people reference this already using $GOROOT. Then for 1.14 we remove mksyscall.go from its current location and have the go repo use the vendored internal copy. Meanwhile mksyscall.go then moves to x/sys/windows. |
More precisely, it could vendor a copy of |
We can add the binary to And if we go ahead and add the binary there, external users can switch to that right away, rather than waiting for—and then needing to upgrade to—Go 1.13.2. |
Right.
Just seems like expecting people to re-work their go-generate files during a point release is a bit much and we can pretty easily support this, and then go cold-turkey for 1.14. But however you want is fine with me. I'll play with the x/sys/windows commit for that. |
Change https://golang.org/cl/198637 mentions this issue: |
Change https://golang.org/cl/198541 mentions this issue: |
This allows us to modify this file and fix it more fluidly. Users can invoke it from go generate via: go run golang.org/x/sys/windows/mkwinsyscall This was taken from Go repo commit 6b85fa80. Updates golang/go#34388 Change-Id: I8dc39eed96b2499ccbde53554b3e16e6c1f6aa98 Reviewed-on: https://go-review.googlesource.com/c/sys/+/198637 Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
https://go-review.googlesource.com/c/go/+/198541 is now underway and things are moving the way suggested above. So at this point I'd recommend one of these options:
Any of these seem appealing? |
Are any of those necessary? I've only seen mention of a few affected projects — probably we should start by opening issues (or PRs) against those specific projects. What fraction of Windows system calls include |
Most Windows software is not open source, so hard to tell. |
Per the CL, seems like @ianlancetaylor disagreed with the plan here. I'll let you guys decide the future of this and will sit this one out. |
I think we should put a copy of mksyscall_windows.go in golang.org/x/sys and encourage people to start using that one. But I don't think we should remove the one from syscall. We should just deprecate it. Since people are apparently using syscall/mksyscall_windows.go, removing it will just break them for no useful purpose. |
Over the long term, I would rather we keep a single source of truth for the One alternative might be to make the existing That said, absent evidence of more external users, I don't think the increase in compatibility is worth the extra indirection. So far we've identified only two (WireGuard and |
Not breaking people unnecessarily means not breaking people unnecessarily. It's not like this program changes frequently: the last substantive change was in 2016. I see no problem with only updating the version in x/sys. If due to some issue people start running into trouble with the syscall version for a problem that is fixed in the x/sys version, we can simply tell them to start using the x/sys version. In other words, exactly what we do for the syscall package in general: the syscall package is frozen, and anybody who needs a bug fix should use the x/sys package instead. Let's extend that frozenness to mksyscall_windows.go. |
I think that's a fine policy for features, but this example was a bug-fix that did not change the supported feature set and did not manifest as a compile-time error. If we retain the file, we should also backport fixes for run-time bugs. My concern is that having a source of truth in multiple places will make it too easy to forget to backport bug-fixes, and only adding features in one place will make those backports less likely to merge cleanly over time. |
One of the major features of Go is stability. That means stability of the entire ecosystem. We don't break people unnecessarily, and this breakage is not necessary. |
What about deleting the bulk of $GOROOT/src/syscall/mksyscall_windows.go and turning it into a functioning wrapper that just calls out to |
Hah I was just implementing that. CL posted now. |
Change https://golang.org/cl/198977 mentions this issue: |
We replace the existing file with a thin wrapper around its target so that we don't break anybody's workflow. Updates #34388 Change-Id: I0d00371c483cb78f4be18fe987df33c79cd40f05 Reviewed-on: https://go-review.googlesource.com/c/go/+/198977 Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
With CL 198977 taken care of now, I've just submitted CL 199137 to take care of this actual issue, the 1.13 backport situation, and close out this issue for good. |
Change https://golang.org/cl/199137 mentions this issue: |
After I apply CL 198977, I get this warning
when I run 'go generate' command in my $GOROOT/src/syscall. We need to do something about that. Should we actually follow this warning advise, and adjust our go generate command? What is the plan? Thank you. Alex |
Change https://golang.org/cl/199277 mentions this issue: |
… make go generate use new golang.org/x/sys/windows/mkwinsyscall Updates #34388 Change-Id: I327a1c1557c47fa6c113c7a1a507a8e7355f9d1a Reviewed-on: https://go-review.googlesource.com/c/go/+/199277 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Change https://golang.org/cl/199538 mentions this issue: |
…apper to new x/sys home We replace the existing file with a thin wrapper around its target so that we don't break anybody's workflow. This combines CL 198977 and CL 199277. Fixes #34388 Change-Id: I0d00371c483cb78f4be18fe987df33c79cd40f05 Reviewed-on: https://go-review.googlesource.com/c/go/+/199538 Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Closed by merging b7b6e8e to release-branch.go1.13. |
@zx2c4 requested issue #34364 to be considered for backport to the next 1.13 minor release.
The text was updated successfully, but these errors were encountered: