mirror of
https://github.com/golang/go.git
synced 2025-10-19 19:13:18 +00:00
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>
This commit is contained in:
parent
465b85eb76
commit
77aac7bb75
2 changed files with 2 additions and 3 deletions
|
@ -9,7 +9,6 @@ package runtime
|
|||
import (
|
||||
"internal/abi"
|
||||
"internal/goarch"
|
||||
"internal/goexperiment"
|
||||
"internal/goos"
|
||||
"internal/runtime/atomic"
|
||||
"internal/runtime/gc"
|
||||
|
@ -1156,7 +1155,7 @@ func CheckScavengedBitsCleared(mismatches []BitsMismatch) (n int, ok bool) {
|
|||
getg().m.mallocing--
|
||||
})
|
||||
|
||||
if goexperiment.RandomizedHeapBase64 && len(mismatches) > 0 {
|
||||
if randomizeHeapBase && len(mismatches) > 0 {
|
||||
// When goexperiment.RandomizedHeapBase64 is set we use a series of
|
||||
// padding pages to generate randomized heap base address which have
|
||||
// both the alloc and scav bits set. Because of this we expect exactly
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue