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: index out of range in scavenger page lookup on GOAMD64=3 due to Len8 codegen issue #52681

Closed
mknyszek opened this issue May 3, 2022 · 9 comments
Labels
NeedsInvestigation release-blocker Soon
Milestone

Comments

@mknyszek
Copy link
Contributor

@mknyszek mknyszek commented May 3, 2022

Example failure: https://build.golang.org/log/c367b3a210d28381bd2aa0bc2741b1492a6e4a7f

The candidate chunk discovered from the new scavenger index doesn't refer to a region of memory the page allocator thinks is mapped. No reproducer yet, but working on it.

@mknyszek mknyszek added NeedsInvestigation release-blocker Soon labels May 3, 2022
@mknyszek mknyszek added this to the Go1.19 milestone May 3, 2022
@mknyszek mknyszek self-assigned this May 3, 2022
@mknyszek
Copy link
Contributor Author

@mknyszek mknyszek commented May 3, 2022

This failure occurred a second time in a row on linux-amd64-goamd64v3. Looks like that's what's necessary to reproduce.

@mknyszek
Copy link
Contributor Author

@mknyszek mknyszek commented May 3, 2022

@mknyszek
Copy link
Contributor Author

@mknyszek mknyszek commented May 3, 2022

Confirmed. I can reproduce locally by just doing:

GOAMD64=v3 ./make.bash

@mknyszek
Copy link
Contributor Author

@mknyszek mknyszek commented May 3, 2022

I can also reproduce the issue in the scavenger tests. If I build the toolchain without GOAMD64=v3, and then run:

GOAMD64=v3 ~go test -run="Scavenge" -count=1 runtime

it fails.

@randall77
Copy link
Contributor

@randall77 randall77 commented May 3, 2022

Looking at the amd64 v3 rules, I think I found a bug. Does the scavenger use math/bits.Len16 or math/bits.Len8?

@randall77
Copy link
Contributor

@randall77 randall77 commented May 3, 2022

Ah yes, looks like it uses sys.LeadingZeros8 which probably uses the same builtin as Len8. The bug is the rule in cmd/compile/internal/ssa/gen/AMD64.rules:108, it's not right for 16/8 bits.

@Jorropo
Copy link
Contributor

@Jorropo Jorropo commented May 3, 2022

I have the same problem, I have bisect it to 91f8630.

@mknyszek mknyszek changed the title runtime: index out of range in scavenger page lookup runtime: index out of range in scavenger page lookup on GOAMD64=3 due to Len8 codegen issue May 3, 2022
@mknyszek
Copy link
Contributor Author

@mknyszek mknyszek commented May 3, 2022

@cherrymui came to the same conclusion, that the codegen rules aren't right, specifically if the high bits of the register that's being used are not zero.

@gopherbot
Copy link

@gopherbot gopherbot commented May 3, 2022

Change https://go.dev/cl/403815 mentions this issue: cmd/compile: fix bit length intrinsic for 16/8 bits on GOAMD64=v3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation release-blocker Soon
Projects
None yet
Development

No branches or pull requests

4 participants