aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/malloc_test.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2021-04-28 23:07:38 -0700
committerKeith Randall <khr@golang.org>2021-04-29 17:39:31 +0000
commit2c05ba4ae08317c6d0ad7418d5ecb0f971275d69 (patch)
treeceac14def7aae473996adbbc0207127b127259f9 /src/runtime/malloc_test.go
parent32dbaac572f9aed4fbaa6aa359bdc821fa02e9d4 (diff)
downloadgo-2c05ba4ae08317c6d0ad7418d5ecb0f971275d69.tar.xz
runtime: top align tinyallocs in race mode
Top align allocations in tinyalloc buckets when in race mode. This will make checkptr checks more reliable, because any code that modifies a pointer past the end of the object will trigger a checkptr error. No test, because we need -race for this to actually kick in. We could add it to the race detector tests, but the race detector tests are all geared towards race detector reports, not checkptr reports. Mucking with parsing reports is more than a test is worth. Fixes #38872 Change-Id: Ie56f0fbd1a9385539f6631fd1ac40c3de5600154 Reviewed-on: https://go-review.googlesource.com/c/go/+/315029 Trust: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/runtime/malloc_test.go')
-rw-r--r--src/runtime/malloc_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/runtime/malloc_test.go b/src/runtime/malloc_test.go
index 4ba94d0494..e028554b23 100644
--- a/src/runtime/malloc_test.go
+++ b/src/runtime/malloc_test.go
@@ -154,6 +154,9 @@ func TestStringConcatenationAllocs(t *testing.T) {
}
func TestTinyAlloc(t *testing.T) {
+ if runtime.Raceenabled {
+ t.Skip("tinyalloc suppressed when running in race mode")
+ }
const N = 16
var v [N]unsafe.Pointer
for i := range v {
@@ -182,6 +185,9 @@ type obj12 struct {
}
func TestTinyAllocIssue37262(t *testing.T) {
+ if runtime.Raceenabled {
+ t.Skip("tinyalloc suppressed when running in race mode")
+ }
// Try to cause an alignment access fault
// by atomically accessing the first 64-bit
// value of a tiny-allocated object.