diff options
| author | Joel Sing <joel@sing.id.au> | 2025-07-25 20:41:51 +1000 |
|---|---|---|
| committer | Joel Sing <joel@sing.id.au> | 2025-08-29 23:57:12 -0700 |
| commit | 8bcda6c79d40f49363cd04cdaf5bd7909de8f94f (patch) | |
| tree | 08b2fd4a0d36b177841a1df1348fb3235a3a1894 /src/runtime/malloc.go | |
| parent | 8377adafc548a0d9dab831477923d25ce4b10710 (diff) | |
| download | go-8bcda6c79d40f49363cd04cdaf5bd7909de8f94f.tar.xz | |
runtime/race: add race detector support for linux/riscv64
This enables support for the race detector on linux/riscv64.
Fixes #64345
Cq-Include-Trybots: luci.golang.try:gotip-linux-riscv64
Change-Id: I98962827e91455404858549b0f9691ee438f104b
Reviewed-on: https://go-review.googlesource.com/c/go/+/690497
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Diffstat (limited to 'src/runtime/malloc.go')
| -rw-r--r-- | src/runtime/malloc.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index 29e41147f0..ec5f0765ba 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -588,11 +588,20 @@ func mallocinit() { // possible to use RISCV_HWPROBE_KEY_HIGHEST_VIRT_ADDRESS at some // point in the future - for now use the system stack address. vmaSize = sys.Len64(uint64(getg().m.g0.stack.hi)) + 1 + if raceenabled && vmaSize != 39 && vmaSize != 48 { + println("vma size = ", vmaSize) + throw("riscv64 vma size is unknown and race mode is enabled") + } } for i := 0x7f; i >= 0; i-- { var p uintptr switch { + case raceenabled && GOARCH == "riscv64" && vmaSize == 39: + p = uintptr(i)<<28 | uintptrMask&(0x0013<<28) + if p >= uintptrMask&0x000f00000000 { + continue + } case raceenabled: // The TSAN runtime requires the heap // to be in the range [0x00c000000000, |
