-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: SIGBUS in initItab (write to readonly ITab.Fun) on unchecked type assertion with generics #65962
Comments
While step-debugging, I saw the segmentation fault occurring at this line (which can be seen in above stack trace) Line 240 in f292080
|
The value of the indirect store register x2 is a readonly symbol:
|
The runtime is trying to (re-)initialize an itab that lives in read-only memory. It can only happen when initializing an itab that represents the "type does not implement interface" condition, which in turn can only happen in certain generics scenarios. Simpler repro:
In particular, generics is used just to load the offending itab into read-only memory. Once it is there, no generics is needed to trigger the bug. |
Change https://go.dev/cl/567615 mentions this issue: |
Go version
from go1.18 to gotip(go1.23-ccbc725f)
Output of
go env
in your module/workspace:What did you do?
This came up during an internal code review on a convoluted dynamodb unmarshaler implementation, the crash could be striped down to this:
https://go.dev/play/p/buw65E2QFzU
The crash only occurs if the
v.(T)
is present, even though the condition evaluates to false (shown by not reaching the unreachable panic). Checking any of the 2 assertions also prevents the crash.What did you see happen?
What did you expect to see?
We expected to recover from a common type assertion panic, as is the case without the unreachable if branch.
The text was updated successfully, but these errors were encountered: