mirror of
https://github.com/golang/go.git
synced 2026-04-02 01:10:27 +09:00
internal/bytealg: on android/arm64, don't read outside 16-byte regions
CL 749062 attempted this, but handled only the case of reading past the end. This CL handles the case of reading before the beginning. Update #59090 Change-Id: Ia21166a9a3fb20ac9003c192589a3d92304c9ee4 Reviewed-on: https://go-review.googlesource.com/c/go/+/751020 Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
@@ -35,7 +35,8 @@ TEXT ·IndexByteString<ABIInternal>(SB),NOSPLIT,$0-32
|
||||
|
||||
CBZ R1, fail
|
||||
#ifdef GOOS_android
|
||||
ADD R0, R1, R20 // R20 = end of data
|
||||
ADD R0, R1, R20 // R20 = end of data
|
||||
BIC $0xf, R0, R21 // R21 = earliest we can read
|
||||
#endif
|
||||
MOVD R0, R11
|
||||
// Magic constant 0x40100401 allows us to identify
|
||||
@@ -57,7 +58,10 @@ TEXT ·IndexByteString<ABIInternal>(SB),NOSPLIT,$0-32
|
||||
#ifdef GOOS_android
|
||||
// Android requires us to not read outside an aligned 16-byte
|
||||
// region because MTE might be enforced.
|
||||
VLD1.P (R3), [V1.B16]
|
||||
CMP R21, R3
|
||||
BLO 2(PC)
|
||||
VLD1 (R3), [V1.B16]
|
||||
ADD $0x10, R3
|
||||
CMP R3, R20
|
||||
BLS 2(PC)
|
||||
VLD1 (R3), [V2.B16]
|
||||
@@ -85,7 +89,10 @@ TEXT ·IndexByteString<ABIInternal>(SB),NOSPLIT,$0-32
|
||||
|
||||
loop:
|
||||
#ifdef GOOS_android
|
||||
VLD1.P (R3), [V1.B16]
|
||||
CMP R21, R3
|
||||
BLO 2(PC)
|
||||
VLD1 (R3), [V1.B16]
|
||||
ADD $0x10, R3
|
||||
CMP R3, R20
|
||||
BLS 2(PC)
|
||||
VLD1 (R3), [V2.B16]
|
||||
|
||||
Reference in New Issue
Block a user