From: Keith Randall Date: Tue, 2 Sep 2025 22:46:11 +0000 (-0700) Subject: [release-branch.go1.25] runtime: use one more address bit for tagged pointers X-Git-Tag: go1.25.4~6 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=bf95b767394eb5643265f44c7b98bdbb85b897ce;p=gostls13.git [release-branch.go1.25] runtime: use one more address bit for tagged pointers We use one extra bit to placate systems which simulate amd64 binaries on an arm64 host. Allocated arm64 addresses could be as high as 1<<48-1, which would be invalid if we assumed 48-bit sign-extended addresses. (Note that this does not help the other way around, simluating arm64 on amd64, but we don't have that problem at the moment.) For #69255. Fixes #75775. Change-Id: Iace17a5d41a65e34abf201d03d8b0ff6f7bf1150 Reviewed-on: https://go-review.googlesource.com/c/go/+/700515 Reviewed-by: Keith Randall Auto-Submit: Keith Randall LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Knyszek (cherry picked from commit 2a7f1d47b0650c92b47f0cd5bc3536d438e4bbbe) Reviewed-on: https://go-review.googlesource.com/c/go/+/712800 Reviewed-by: Keith Randall Reviewed-by: David Chase --- diff --git a/src/runtime/tagptr_64bit.go b/src/runtime/tagptr_64bit.go index 3d79332e2d..76733cc1d6 100644 --- a/src/runtime/tagptr_64bit.go +++ b/src/runtime/tagptr_64bit.go @@ -22,10 +22,17 @@ const ( // On AMD64, virtual addresses are 48-bit (or 57-bit) sign-extended. // Other archs are 48-bit zero-extended. // + // We use one extra bit to placate systems which simulate amd64 binaries on + // an arm64 host. Allocated arm64 addresses could be as high as 1<<48-1, + // which would be invalid if we assumed 48-bit sign-extended addresses. + // See issue 69255. + // (Note that this does not help the other way around, simluating arm64 + // on amd64, but we don't have that problem at the moment.) + // // On s390x, virtual addresses are 64-bit. There's not much we // can do about this, so we just hope that the kernel doesn't // get to really high addresses and panic if it does. - defaultAddrBits = 48 + defaultAddrBits = 48 + 1 // On AIX, 64-bit addresses are split into 36-bit segment number and 28-bit // offset in segment. Segment numbers in the range 0x0A0000000-0x0AFFFFFFF(LSA)