-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: Go should not mark os memory as executable on Windows #5494
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
Labels
Milestone
Comments
I would welcome any suggestion about implementing this. I can think of 2 ways of doing that (just ideas, didn't think it through): 1) Change compiler to output a JMP instruction in front of every Go function that can potentially be used as callback function (functions that take one or many uintptr size parameters and returns single uintptr size parameter). Have this JMP point to a special routine that does all parameter marshalling and continue to call Go function that follows JMP instruction; 2) At this moment we allow for maximum of 2000 callbacks. So create a memory page of 2000 JMP instructions (this can be done at runtime or in the linker - I haven't decided which yet). Change our existing runtime.Callbacks from linked list into array. Use address of a JMP instruction as an index into this array to decide which Go function to call. I don't like my proposals much, so, please, suggest alternatives. Thank you. Alex |
(2) is basically what we did for NaCl long ago, if I am remembering correctly. I think that's actually a fine approach, and it's likely the best we can do. The assembly would look something like: TEXT callback0(SB),7,$0 MOVL $0, AX JMP callback_common(SB) TEXT callback1(SB),7,$0 MOVL $1, AX JMP callback_common(SB) TEXT callback_common(SB),7,$0 .. whatever needs to happen, using AX |
at least my proposal doesn't require another long C file. an alternative would be that we synthesize the code for callbacks in a special allocated (and reserved) memory region in an as needed basis (one page at a time), so that at least we don't need to make the whole heap as executable and writable. to be extra safe, once we synthesize a page of calls, we can mark that page only readable and executable so we don't have writable and executable page at the same time. yet another option is we use a precompiled .syso file. |
https://golang.org/cl/10368043/ should get rid of callbacks issue, then we can reapply https://code.google.com/p/go/source/detail?r=3c2cddfbdaec again. Alex |
This issue was updated by revision 05a5de3. R=golang-dev, minux.ma, rsc, iant CC=golang-dev https://golang.org/cl/10368043 |
This issue was closed by revision 3d513fa. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: