-
Notifications
You must be signed in to change notification settings - Fork 5k
throw an exception instead of infinite loop in sort_mark_list
#115492
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
Conversation
sort_mark_list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses a critical infinite loop issue observed in sort_mark_list due to heap corruption by introducing an exception mechanism when an invalid (zero) region limit is encountered.
- Adds a check for a zero region limit and terminates using FATAL_GC_ERROR() instead of entering an infinite loop.
- Updates the core garbage collection routine to improve production diagnostics when encountering freed regions.
Comments suppressed due to low confidence (1)
src/coreclr/gc/gc.cpp:10798
- Consider verifying that FATAL_GC_ERROR() provides sufficient diagnostic context for production debugging, potentially by enhancing the error message or logging detailed information.
if (region_limit == 0)
Tagging subscribers to this area: @dotnet/gc |
f1d09c4
to
059365a
Compare
// simply throwing an exception. | ||
if (region_limit == 0) | ||
{ | ||
FATAL_GC_ERROR(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we log something here to mention that its probably a heap corruption?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we chatted offline.
/backport to release/8.0-staging |
/backport to release/9.0-staging |
Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/15006087166 |
Started backporting to release/9.0-staging: https://github.com/dotnet/runtime/actions/runs/15006088865 |
we had a customer who observed an infinite loop in
sort_mark_list
due to heap corruption - the object that got marked was in a region that was already freed soregion_limit
is 0. we detect this and throw an exception which is easier for prod diag than having to deal with an infinite loop.