aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/abi/abiutils.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-02-28 12:18:18 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2021-03-04 19:59:23 +0000
commit77505c25d83a2130011736d6a2a915eaa3ae230a (patch)
tree2d5c6a161512e47c7ae356a36aadad6e37cdafc7 /src/cmd/compile/internal/abi/abiutils.go
parent9d88a9e2bf89068238ed02a0c960e58f547bb102 (diff)
downloadgo-77505c25d83a2130011736d6a2a915eaa3ae230a.tar.gz
go-77505c25d83a2130011736d6a2a915eaa3ae230a.zip
syscall: treat proc thread attribute lists as unsafe.Pointers
It turns out that the proc thread update function doesn't actually allocate new memory for its arguments and instead just copies the pointer values into the preallocated memory. Since we were allocating that memory as []byte, the garbage collector didn't scan it for pointers to Go allocations and freed them. We _could_ fix this by requiring that all users of this use runtime.KeepAlive for everything they pass to the update function, but that seems harder than necessary. Instead, we can just do the allocation as []unsafe.Pointer, which means the GC can operate as intended and not free these from beneath our feet. In order to ensure this remains true, we also add a test for this. Fixes #44662. Change-Id: Ib392ba8ceacacec94b11379919c8179841cba29f Reviewed-on: https://go-review.googlesource.com/c/go/+/297389 Trust: Jason A. Donenfeld <Jason@zx2c4.com> Trust: Alex Brainman <alex.brainman@gmail.com> Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/abi/abiutils.go')
0 files changed, 0 insertions, 0 deletions