diff options
| author | Keith Randall <khr@golang.org> | 2026-02-25 07:32:42 -0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2026-02-27 14:43:53 -0800 |
| commit | f5479628d36e6cdd63c39784b58fa7241abd3295 (patch) | |
| tree | 9fa7eaa030bffe73276f30fe5337b1226b6fae5e /src/runtime | |
| parent | 5055a181560b09170a23be81612ee849e47b0a30 (diff) | |
| download | go-f5479628d36e6cdd63c39784b58fa7241abd3295.tar.xz | |
runtime: on android/arm64, don't read outside 16-byte regions
Because MTE might be enforced.
Update #59090
Update #27610
Change-Id: Idfaecbf3b7a93c5e371abcace666febfc303de9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/749062
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/string.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/runtime/string.go b/src/runtime/string.go index 15b3868cbc..7207f834a8 100644 --- a/src/runtime/string.go +++ b/src/runtime/string.go @@ -8,6 +8,7 @@ import ( "internal/abi" "internal/bytealg" "internal/goarch" + "internal/goos" "internal/runtime/math" "internal/runtime/sys" "internal/strconv" @@ -505,7 +506,9 @@ func findnull(s *byte) int { // It must be the minimum page size for any architecture Go // runs on. It's okay (just a minor performance loss) if the // actual system page size is larger than this value. - const pageSize = 4096 + // For Android, we set the page size to the MTE size, as MTE + // might be enforced. See issue 59090. + const pageSize = 4096*(1-goos.IsAndroid) + 16*goos.IsAndroid offset := 0 ptr := unsafe.Pointer(s) |
