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

cmd/link: panic: runtime error: slice bounds out of range [::1751306] with length 1048576 [1.15 backport] #43214

Closed
gopherbot opened this issue Dec 16, 2020 · 6 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link
Contributor

@thanm requested issue #41621 to be considered for backport to the next 1.15 minor release.

@gopherbot please consider this for backport to 1.15

@thanm
Copy link
Contributor

thanm commented Dec 16, 2020

Backport seems reasonable given that this problem exists in Go 1.15 and triggers a panic in the linker.

Worth noting that this problem happens primarily with extremely large packages (more than 1048576 relocations), so primarily an issue for things like machine-generated code.

@gopherbot
Copy link
Contributor Author

Change https://golang.org/cl/278673 mentions this issue: [release-branch.go1.15] cmd/internal/goobj: fix buglet in object file reader

@dmitshur
Copy link
Contributor

dmitshur commented Dec 30, 2020

Thanks for the request and rationale.

@thanm Is Go 1.14 okay, or does it need a fix for this problem too? Our backport policy is to either fix the bug in all supported Go versions, or none (if it's not very critical).

@thanm
Copy link
Contributor

thanm commented Jan 5, 2021

Sorry for the late response -- no need for a 1.14 backport here; the code in question was introduced in 1.15. Thanks.

@toothrot toothrot added the CherryPickApproved Used during the release process for point releases label Jan 7, 2021
@toothrot
Copy link
Contributor

toothrot commented Jan 7, 2021

Approved as a serious issue with no workaround.

@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Jan 7, 2021
@dmitshur dmitshur modified the milestones: Go1.15.7, Go1.15.8 Jan 19, 2021
@gopherbot
Copy link
Contributor Author

Closed by merging 58dc445 to release-branch.go1.15.

gopherbot pushed a commit that referenced this issue Feb 2, 2021
…e reader

The code in the Go object file reader was casting a pointer to mmaped
memory into a large array prior to performing a read of the
relocations section:

	return (*[1<<20]Reloc)(unsafe.Pointer(&r.b[off]))[:n:n]

For very large object files, this artificial array isn't large enough
(that is, there are more than 1048576 relocs to read), so update the
code to use a larger artifical array size.

Fixes #43214.
Updates #41621.

Change-Id: Ic047c8aef4f8a3839f2e7e3594bce652ebd6bd5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/278492
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Trust: Than McIntosh <thanm@google.com>
(cherry picked from commit f4e7a6b)
Reviewed-on: https://go-review.googlesource.com/c/go/+/278673
@golang golang locked and limited conversation to collaborators Feb 2, 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

4 participants