-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Fix false-positive assertion in CheckRegDisplaySP due to stale cached stack limit #126740
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5687,7 +5687,14 @@ void CheckRegDisplaySP (REGDISPLAY *pRD) | |||||||||||||||||||||
| if (pRD->SP && pRD->_pThread) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| #ifndef NO_FIXED_STACK_LIMIT | ||||||||||||||||||||||
| // Use GetStackLowerBound() instead of GetCachedStackLimit() — on Linux the stack grows on demand | ||||||||||||||||||||||
| // and the cached limit can be stale if the stack has grown past the initially committed boundary. | ||||||||||||||||||||||
| // GetStackLowerBound() is only available in non-DAC builds. | ||||||||||||||||||||||
| #ifndef DACCESS_COMPILE | ||||||||||||||||||||||
| _ASSERTE(pRD->_pThread->IsExecutingOnAltStack() || PTR_VOID(pRD->SP) >= pRD->_pThread->GetStackLowerBound()); | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PAL is caching the cache limits as well: runtime/src/coreclr/pal/src/thread/thread.cpp Lines 2396 to 2405 in 6adf63b
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we will need to pass a bool flag all the way to the PAL to fetch non-cached stack limits. Also, we make sure to use the cached stack limits most of the time to make this check cheap. |
||||||||||||||||||||||
| #else | ||||||||||||||||||||||
| _ASSERTE(pRD->_pThread->IsExecutingOnAltStack() || PTR_VOID(pRD->SP) >= pRD->_pThread->GetCachedStackLimit()); | ||||||||||||||||||||||
| #endif // DACCESS_COMPILE | ||||||||||||||||||||||
| #endif // NO_FIXED_STACK_LIMIT | ||||||||||||||||||||||
| _ASSERTE(pRD->_pThread->IsExecutingOnAltStack() || PTR_VOID(pRD->SP) < pRD->_pThread->GetCachedStackBase()); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
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.
NO_FIXED_STACK_LIMITis working around the same problem, just for Musl. If we find a better way to fix this, we should deleteNO_FIXED_STACK_LIMIT.