-
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
[mono] Crash in common_call_trampoline due to inconsistent rgctx mode #57664
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
…mode * Assume MRGCTX mode if mini_method_is_default_method is true * Fixes #57664
…mode * Assume MRGCTX mode if mini_method_is_default_method is true * Fixes #57664
Tagging subscribers to this area: Issue DetailsDescriptionWhen running the
Configuration.NET 6 Preview7 re-built for the linux-s390x target (using the mono runtime by default), running natively. Regression?Yes, I haven't seen this crash with the Preview6 build (or earlier). Other informationThe
Note that in this particular instance, the pointer returned by The reason why the second branch is chosen is that However, looking at the code that sets up the rgctx register, e.g. in
This is exactly what happens in the current case: the method in question is marked as "default method". Changing the above code in I'll submit a PR implementing this change shortly.
|
* Assume MRGCTX mode if mini_method_is_default_method is true * Fixes dotnet/runtime#57664 * Backport of https://github.com/dotnet/runtime/pull/57665`
Description
When running the
Microsoft.CodeAnalysis.CSharp.UnitTests.Symbols.DefaultInterfaceImplementationTests.VarianceSafety_15
test case out of the roslyn unit test suite, mono crashes with:Configuration
.NET 6 Preview7 re-built for the linux-s390x target (using the mono runtime by default), running natively.
Regression?
Yes, I haven't seen this crash with the Preview6 build (or earlier).
Other information
The
klass
variable is set by this code:Note that in this particular instance, the pointer returned by
mono_arch_find_static_call_vtable (regs, code)
is actually aMonoMethodRuntimeGenericContext
, not aMonoVTable
. But the code above branches into the second "if" block instead of the first, and therefore reads a clobbered pointer fromvtable->klass
.The reason why the second branch is chosen is that
mono_method_get_context (m)->method_inst
isnullptr
at this point.However, looking at the code that sets up the rgctx register, e.g. in
mini_get_rgctx_access_for_method
orcheck_method_sharing
, we see that the MRGCTX access method is used even in cases wheremethod_inst
is null, if the method is a "default method":This is exactly what happens in the current case: the method in question is marked as "default method". Changing the above code in
common_call_trampoline
to expect a MGRTX access in that case as well fixes the crash (and makes the roslyn test case pass).I'll submit a PR implementing this change shortly.
The text was updated successfully, but these errors were encountered: