From: Cuong Manh Le Date: Sat, 22 Aug 2020 11:21:14 +0000 (+0700) Subject: runtime: add test for StorepNoWB param leaking X-Git-Tag: go1.16beta1~1244 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=aa49a0b37249fc1d4a7963b6f1119983eaae9f97;p=gostls13.git runtime: add test for StorepNoWB param leaking CL 249962 added wasm StorepNoWB implementation in assembly, it's now like all other architectures. This CL adds a general test that the second param of StorepNoWB must be force to escape. Fixes #40975 Change-Id: I1eccc7e50a3ec742a1912d65f25b15f9f5ad9241 Reviewed-on: https://go-review.googlesource.com/c/go/+/249761 Run-TryBot: Cuong Manh Le TryBot-Result: Gobot Gobot Reviewed-by: Matthew Dempsky --- diff --git a/src/runtime/internal/atomic/atomic_test.go b/src/runtime/internal/atomic/atomic_test.go index 0c1125c558..b0a8fa0610 100644 --- a/src/runtime/internal/atomic/atomic_test.go +++ b/src/runtime/internal/atomic/atomic_test.go @@ -220,3 +220,13 @@ func TestBitwiseContended(t *testing.T) { } } } + +func TestStorepNoWB(t *testing.T) { + var p [2]*int + for i := range p { + atomic.StorepNoWB(unsafe.Pointer(&p[i]), unsafe.Pointer(new(int))) + } + if p[0] == p[1] { + t.Error("Bad escape analysis of StorepNoWB") + } +}