-
Notifications
You must be signed in to change notification settings - Fork 4.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
Fix for issue 70385 (stack overflow in the CoreCLR runtime during SVM validation) #71135
Conversation
|
||
interface IDerived<T> : IBase<T> | ||
{ | ||
public static void IBase<T>.Method() |
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.
I think the public
in this line is redundant and causing compilation to fail.
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.
Thanks for your feedback, I have removed the public modifier from both interfaces in the 2nd commit. Please note that the C# code is actually not used for building the test - that's why it has the 'template' extension - because we don't yet have a Roslyn capable of compiling this code, the actual test source code is written in IL.
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.
This change adds the possibility that we may attempt to utilize a MethodDesc that is not fully loaded within the Jit interface and within the generic dictionary resolution logic in genericdict.cpp. I would like to see code in MethodTable::TryResolveConstraintMethodApprox
which explicitly forces the level to CLASS_LOADED
.
Oh, also you need to make sure that the appropriate level is loaded in |
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.
Looks good.
The library failure is known, Carlos is working on the fix, #71038, merging in. |
The issue is caused by the fact that in the presence of recursive generics
verification that all SVMs are implemented ends up loading base types
with the full (CLASS_LOADED) level; if the base type is generic and contains
the type being verified as a type parameter, it causes infinite recursion.
I have adjusted two places around the SVM resolution to only require
CLASS_LOAD_EXACTPARENTS to prevent this. I have created a regression
test for the issue and I verified locally that it crashes with stack overflow
without my fix and passes with it.
Thanks
Tomas
Fixes: #70385