From f5479628d36e6cdd63c39784b58fa7241abd3295 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Wed, 25 Feb 2026 07:32:42 -0800 Subject: 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 Auto-Submit: Keith Randall LUCI-TryBot-Result: Go LUCI Reviewed-by: Keith Randall --- src/runtime/string.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/runtime') 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) -- cgit v1.3-6-g1900