]> Cypherpunks.ru repositories - gostls13.git/commit
syscall: use runtime.KeepAlive for ProcThreadAttributeList arguments
authorJason A. Donenfeld <Jason@zx2c4.com>
Wed, 10 Mar 2021 14:21:56 +0000 (07:21 -0700)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 11 Mar 2021 13:49:01 +0000 (13:49 +0000)
commitb8e9ec856c2b2d717ab14e85f43e00b532c4370a
tree33d887277cfc615d0f5d2568c2ba0b97d5239c3b
parent9ece63f0647ec34cc729ad71a87254193014dcca
syscall: use runtime.KeepAlive for ProcThreadAttributeList arguments

It turns out that if you write Go pointers to Go memory, the Go compiler
must be involved so that it generates various calls to the GC in the
process. Letting Windows write Go pointers to Go memory violated this.
So, we replace that with just a boring call to runtime.KeepAlive. That's
not a great API, but this is all internal code anyway. We fix it up
more elegantly for external consumption in x/sys/windows with CL 300369.

Fixes #44900.

Change-Id: Id6599a793af9c4815f6c9387b00796923f32cb97
Reviewed-on: https://go-review.googlesource.com/c/go/+/300349
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/syscall/exec_windows.go
src/syscall/syscall_windows.go
src/syscall/syscall_windows_test.go
src/syscall/types_windows.go