aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/malloc.go
diff options
context:
space:
mode:
authorRoland Shoemaker <bracewell@google.com>2025-09-17 21:10:11 +0000
committerGopher Robot <gobot@golang.org>2025-09-17 17:10:14 -0700
commit77aac7bb75edc222dd7b350e8b76c20c79da5f43 (patch)
tree61b239fc3c16bb9da513cbbef484516299e778dc /src/runtime/malloc.go
parent465b85eb760bfdb114f6b6ebccf374aba3977929 (diff)
downloadgo-77aac7bb75edc222dd7b350e8b76c20c79da5f43.tar.xz
runtime: don't enable heap randomization if MSAN or ASAN is enabled
MSAN and ASAN do confusing things to the memory layout, which are likely to conflict with heap base randomization, so if they are enabled, ignore randomizedHeapBase64. We already didn't turn it on when TSAN was enabled. Change-Id: I41e59dfc33d8bb059c208a9595442571fb31eea3 Reviewed-on: https://go-review.googlesource.com/c/go/+/704856 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Roland Shoemaker <roland@golang.org>
Diffstat (limited to 'src/runtime/malloc.go')
-rw-r--r--src/runtime/malloc.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index ec5f0765ba..5b5a633d9a 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -349,7 +349,7 @@ const (
// randomizeHeapBase indicates if the heap base address should be randomized.
// See comment in mallocinit for how the randomization is performed.
- randomizeHeapBase = goexperiment.RandomizedHeapBase64 && goarch.PtrSize == 8 && !isSbrkPlatform
+ randomizeHeapBase = goexperiment.RandomizedHeapBase64 && goarch.PtrSize == 8 && !isSbrkPlatform && !raceenabled && !msanenabled && !asanenabled
// randHeapBasePrefixMask is used to extract the top byte of the randomized
// heap base address.