Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: mallocs cause "base outside usable address space" panic when running on iOS 14 [1.17 backport] #48116

Closed
gopherbot opened this issue Sep 1, 2021 · 3 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link

@mknyszek requested issue #46860 to be considered for backport to the next 1.17 minor release.

@gopherbot Please open backport issues for 1.16 and 1.17.

I think so. This failure doesn't seem to have a reasonable workaround (use less memory?) and otherwise means iOS >=14 Go apps can just break.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Sep 1, 2021
@gopherbot gopherbot added this to the Go1.17.1 milestone Sep 1, 2021
@thanm thanm modified the milestones: Go1.17.1, Go1.17.2 Sep 9, 2021
@mknyszek mknyszek modified the milestones: Go1.17.2, Go1.17.3 Oct 7, 2021
@thanm thanm modified the milestones: Go1.17.3, Go1.17.4 Nov 4, 2021
@heschi heschi modified the milestones: Go1.17.4, Go1.17.5 Dec 2, 2021
@gopherbot
Copy link
Author

Change https://golang.org/cl/369737 mentions this issue: [release-branch.go1.17] runtime: set iOS addr space to 40 bits with incremental pagealloc

@mknyszek
Copy link
Contributor

mknyszek commented Dec 7, 2021

Hey release team! :) Please feel free to submit this one once it's approved.

@toothrot toothrot modified the milestones: Go1.17.5, Go1.17.6 Dec 9, 2021
@cherrymui cherrymui added CherryPickApproved Used during the release process for point releases and removed CherryPickCandidate Used during the release process for point releases labels Dec 15, 2021
@gopherbot
Copy link
Author

Closed by merging 1242f43 to release-branch.go1.17.

gopherbot pushed a commit that referenced this issue Dec 22, 2021
…ncremental pagealloc

In iOS <14, the address space is strictly limited to 8 GiB, or 33 bits.
As a result, the page allocator also assumes all heap memory lives in
this region. This is especially necessary because the page allocator has
a PROT_NONE mapping proportional to the size of the usable address
space, so this keeps that mapping very small.

However starting with iOS 14, this restriction is relaxed, and mmap may
start returning addresses outside of the <14 range. Today this means
that in iOS 14 and later, users experience an error in the page
allocator when a heap arena is mapped outside of the old range.

This change increases the ios/arm64 heapAddrBits to 40 while
simultaneously making ios/arm64 use the 64-bit pagealloc implementation
(with reservations and incremental mapping) to accommodate both iOS
versions <14 and 14+.

Once iOS <14 is deprecated, we can remove these exceptions and treat
ios/arm64 like any other arm64 platform.

This change also makes the BaseChunkIdx expression a little bit easier
to read, while we're here.

For #46860.
Fixes #48116.

Change-Id: I13865f799777739109585f14f1cc49d6d57e096b
Reviewed-on: https://go-review.googlesource.com/c/go/+/344401
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
(cherry picked from commit af368da0b137116faba81ca249a8d964297e6e45)
Reviewed-on: https://go-review.googlesource.com/c/go/+/369737
@golang golang locked and limited conversation to collaborators Dec 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

6 participants