]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.9] cmd/compile: fix mapassign_fast* routines for pointer keys
authorKeith Randall <keithr@alum.mit.edu>
Tue, 21 Nov 2017 15:14:11 +0000 (07:14 -0800)
committerAndrew Bonventre <andybons@golang.org>
Mon, 22 Jan 2018 20:25:13 +0000 (20:25 +0000)
commitedd3537817d257f35668a6c88f266ad76546fbd2
tree695a590a799f55ad7a62e5afe1a24ddd93ca612f
parent0a72be280e92e15f5f7f0b02a162732b5d717294
[release-branch.go1.9] cmd/compile: fix mapassign_fast* routines for pointer keys

The signature of the mapassign_fast* routines need to distinguish
the pointerness of their key argument.  If the affected routines
suspend part way through, the object pointed to by the key might
get garbage collected because the key is typed as a uint{32,64}.

This is not a problem for mapaccess or mapdelete because the key
in those situations do not live beyond the call involved.  If the
object referenced by the key is garbage collected prematurely, the
code still works fine.  Even if that object is subsequently reallocated,
it can't be written to the map in time to affect the lookup/delete.

Fixes #22781

Change-Id: I0bbbc5e9883d5ce702faf4e655348be1191ee439
Reviewed-on: https://go-review.googlesource.com/79018
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Reviewed-on: https://go-review.googlesource.com/88635
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/builtin.go
src/cmd/compile/internal/gc/builtin/runtime.go
src/cmd/compile/internal/gc/walk.go
src/runtime/hashmap_fast.go
test/fixedbugs/issue22781.go [new file with mode: 0644]