Skip to content

CoreCLR tests on Mono runtime : crash running reflection/DefaultInterfaceMethods/GetInterfaceMapConsumer/GetInterfaceMapConsumer.sh #34389

Closed

Description

@SamMonoRT

Crash seen when running the following CoreCLR test on the mono runtime from the dotnet\runtime repo.
Repro : Command to run individual tests : From the dotnet\runtime repo src\mono\netcore run this command or relevant one for a particular test - make run-tests-coreclr CoreClrTest="bash ../../artifacts/tests/coreclr/OSX.x64.Debug/reflection/DefaultInterfaceMethods/GetInterfaceMapConsumer/GetInterfaceMapConsumer.sh"

Crash report :

=================================================================
External Debugger Dump:
=================================================================
/Users/samarthpatel/Documents/DotNetRunTime/runtime/artifacts/tests/coreclr/OSX.x64.Debug/reflection/DefaultInterfaceMethods/GetInterfaceMapConsumer/GetInterfaceMapConsumer.sh: line 275: 87324 Abort trap: 6 $LAUNCHER $ExePath "${CLRTestExecutionArguments[@]}"

      Return code:      1
      Raw output file:      /Users/samarthpatel/Documents/DotNetRunTime/runtime/artifacts/tests/coreclr/OSX.x64.Debug/reflection/DefaultInterfaceMethods/Reports/reflection.DefaultInterfaceMethods/GetInterfaceMapConsumer/GetInterfaceMapConsumer.output.txt
      Raw output:
      BEGIN EXECUTION
      /Users/samarthpatel/Documents/DotNetRunTime/runtime/artifacts/tests/coreclr/OSX.x64.Debug/Tests/Core_Root/corerun GetInterfaceMapConsumer.dll ''
      System.RuntimeTypeHandle DefaultMethod() (IFoo`1[Fooer]) - System.RuntimeTypeHandle DefaultMethod() (IFoo`1[Fooer]) - FAIL
      Int32 OtherMethod(Int32) (IFoo`1[Fooer]) - Int32 OtherMethod(Int32) (IBar`1[Fooer]) - FAIL
      Int32 DefaultMethod(Int32) (IFoo) - Int32 DefaultMethod(Int32) (IFoo) - FAIL
      Int32 OtherMethod(Int32) (IFoo) - Int32 OtherMethod(Int32) (IBar) - FAIL
      Int32 InstanceMethod(Int32) (IFoo) - Int32 OtherMethod(Int32) (IBar`1[Fooer]) - UNEXPECTED
      Int32 StaticMethod(Int32) (IFoo) - System.RuntimeTypeHandle DefaultMethod() (IFoo`1[Fooer]) - UNEXPECTED
      
      =================================================================
      Native Crash Reporting
      =================================================================
      Got a segv while executing native code. This usually indicates
      a fatal error in the mono runtime or one of the native libraries 
      used by your application.
      =================================================================
      
      =================================================================
      Native stacktrace:
      =================================================================
      0x101a624b2 - /Users/samarthpatel/Documents/DotNetRunTime/runtime/artifacts/tests/coreclr/OSX.x64.Debug/Tests/Core_Root/libcoreclr.dylib : mono_dump_native_crash_info
      0x101a04105 - /Users/samarthpatel/Documents/DotNetRunTime/runtime/artifacts/tests/coreclr/OSX.x64.Debug/Tests/Core_Root/libcoreclr.dylib : mono_handle_native_crash
      0x101c2b387 - /Users/samarthpatel/Documents/DotNetRunTime/runtime/artifacts/tests/coreclr/OSX.x64.Debug/Tests/Core_Root/libcoreclr.dylib : altstack_handle_and_restore.cold.1
      0x101a5cdee - /Users/samarthpatel/Documents/DotNetRunTime/runtime/artifacts/tests/coreclr/OSX.x64.Debug/Tests/Core_Root/libcoreclr.dylib : altstack_handle_and_restore
      0x101b74481 - /Users/samarthpatel/Documents/DotNetRunTime/runtime/artifacts/tests/coreclr/OSX.x64.Debug/Tests/Core_Root/libcoreclr.dylib : method_object_construct
      0x101b73534 - /Users/samarthpatel/Documents/DotNetRunTime/runtime/artifacts/tests/coreclr/OSX.x64.Debug/Tests/Core_Root/libcoreclr.dylib : check_or_construct_handle
      0x101aee3cf - /Users/samarthpatel/Documents/DotNetRunTime/runtime/artifacts/tests/coreclr/OSX.x64.Debug/Tests/Core_Root/libcoreclr.dylib : ves_icall_RuntimeType_GetInterfaceMapData
      0x101afef83 - /Users/samarthpatel/Documents/DotNetRunTime/runtime/artifacts/tests/coreclr/OSX.x64.Debug/Tests/Core_Root/libcoreclr.dylib : ves_icall_RuntimeType_GetInterfaceMapData_raw
      0x101fa636f - Unknown
      
      =================================================================
      Telemetry Dumper:
      =================================================================
      Pkilling 0x123145509298176x from 0x4553166272x
      Entering thread summarizer pause from 0x4553166272x
      Finished thread summarizer pause from 0x4553166272x.
      
      Waiting for dumping threads to resume
      
      =================================================================
      Basic Fault Address Reporting
      =================================================================
      Memory around native instruction pointer (0x101b74481):0x101b74471  49 89 d4 49 89 f6 49 89 fd 41 c7 00 00 00 00 00  I..I..I..A......
      0x101b74481  48 8b 5a 18 80 3b 2e 75 26 48 8d 35 0a c8 0d 00  H.Z..;.u&H.5....
      0x101b74491  48 89 df e8 81 77 0b 00 85 c0 74 4b 48 8d 35 e5  H....w....tKH.5.
      0x101b744a1  49 0e 00 48 89 df e8 6e 77 0b 00 85 c0 74 38 48  I..H...nw....t8H
      
      =================================================================
      Managed Stacktrace:
      =================================================================
        at <unknown> <0xffffffff>
        at System.RuntimeType:GetInterfaceMapData <0x000be>
        at System.RuntimeType:GetInterfaceMap <0x0015a>
        at Program:Main <0x007e7>
        at <Module>:runtime_invoke_int <0x000a5>
      =================================================================
      Expected: 100
      Actual: 134
      END EXECUTION - FAILED
      Test Harness Exitcode is : 1
      To run the test:
      > set CORE_ROOT=/Users/samarthpatel/Documents/DotNetRunTime/runtime/artifacts/tests/coreclr/OSX.x64.Debug/Tests/Core_Root
      > /Users/samarthpatel/Documents/DotNetRunTime/runtime/artifacts/tests/coreclr/OSX.x64.Debug/reflection/DefaultInterfaceMethods/GetInterfaceMapConsumer/GetInterfaceMapConsumer.sh
      Expected: True
      Actual:   False
      Stack Trace:
        /Users/samarthpatel/Documents/DotNetRunTime/runtime/artifacts/tests/coreclr/OSX.x64.Debug/TestWrappers/reflection.DefaultInterfaceMethods/reflection.DefaultInterfaceMethods.XUnitWrapper.cs(237,0): at reflection_DefaultInterfaceMethods._GetInterfaceMapConsumer_GetInterfaceMapConsumer_._GetInterfaceMapConsumer_GetInterfaceMapConsumer_sh()
        /Users/samarthpatel/Documents/DotNetRunTime/runtime/src/mono/netcore/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs(339,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

Activity

  1. added
    runtime-mono
    on Apr 1, 2020
  2. added
    untriaged
    on Apr 1, 2020
  3. Dotnet-GitSync-Bot commented on Apr 1, 2020

    @Dotnet-GitSync-Bot
    Collaborator

    I couldn't figure out the best area label to add to this issue. Please help me learn by adding exactly one area label.

  4. CoffeeFlux commented on Apr 5, 2020

    @CoffeeFlux
    Contributor

    These tests are all failing, so fixing out GetInterfaceMap lookups in this situation will probably resolve the crash as well as the failures. The IL for InvokeProvider defines:

    .class interface public abstract auto ansi IFoo
    

    and

    .class interface public abstract auto ansi IFoo`1<T>
    

    I assume we aren't properly distinguishing between them.

  5. SamMonoRT commented on Apr 8, 2020

    @SamMonoRT
    MemberAuthor

    @CoffeeFlux - sending this your way.

  6. jpobst commented on Jun 19, 2020

    @jpobst
    Contributor

    This affects attempting to use Xamarin Android's jnimarshalmethod-gen.exe for Android API-30, because it uses the Type.GetInterfaceMap method against an interface with default methods. This Xamarin feature has been documented as "experimental" so we will still be shipping without this fix, but it will be good to get it working before targeting Android 11 is widespread.

  7. lambdageek commented on Jun 19, 2020

    @lambdageek
    Member

    I haven't tried to verify, but I bet it's this line

    MONO_HANDLE_ASSIGN (member, mono_method_get_object_handle (domain, m_class_get_vtable (klass) [i + ioffset], klass, error));

    The problem is that with DIMs you can re-abstract methods, so some vtable entries for non-abstract classes are null. And method_object_construct doesn't check for NULL before dereferencing method

  8. added this to the 5.0.0 milestone on Jun 22, 2020
  9. removed
    untriaged
    on Jun 22, 2020
  10. 2 remaining items

  11. modified the milestones: 5.0.0, 6.0.0 on Aug 3, 2020
  12. added
    area-VM-reflection-mono
    and removed on Oct 26, 2020
  13. added a commit that references this issue on May 10, 2021
    a5d548a
  14. ghost added
    in-pr
    on May 10, 2021
  15. ghost closed this as completedin #52566on Jun 3, 2021
  16. ghost added a commit that references this issue on Jun 3, 2021
    5d64814
  17. ghost removed
    in-pr
    on Jun 3, 2021
  18. ghost locked as resolved and limited conversation to collaborators on Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-VM-reflection-monoruntime-mono

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions