Skip to content

[Wasm][AOT] Memory corruption with Assertion at metadata/loader.c:1805, condition not met #51207

Closed

Description

@jeromelaban

Description

The runtime fails for some memory corruption that only happens with a specific memory layout, when building with -O=gsharedvt:

   1: 1208124 [0x2a8708352d89] [dotnet.js:1] [bytecode=0x2a870833dddd offset=127](this=0x2a87082030d1 <JSGlobal Object>#2#,58822,27488944,4,0,0)
    2: _emscripten_asm_const_int [0x2a870823bdf9] [dotnet.js:1] [bytecode=0x2a870833db55 offset=33](this=0x2a87082030d1 <JSGlobal Object>#2#,1208124,6590072,6590048)
    3: WasmToJsFrame [pc: 0x3a7870028838]
    4: WASM [0187dfce], function #9214 ('wasm_trace_logger'), pc=0x3a787073f782 (+0xe2), pos=2130717 (+78)
    5: WASM [0187dfce], function #14756 ('eglib_log_adapter'), pc=0x3a78704bf2fb (+0xdb), pos=2851513 (+33)
    6: WASM [0187dfce], function #11151 ('monoeg_g_logstr'), pc=0x3a78706ab521 (+0xe1), pos=2278609 (+45)
    7: WASM [0187dfce], function #5337 ('monoeg_g_logv_nofree'), pc=0x3a7870aa0fcb (+0xcb), pos=1080122 (+60)
    8: WASM [0187dfce], function #644 ('monoeg_assertion_message'), pc=0x3a7870d9e5c6 (+0x66), pos=115663 (+32)
    9: WASM [0187dfce], function #307 ('mono_assertion_message'), pc=0x3a7870dbf5bc (+0x7c), pos=75033 (+38)
   10: WASM [0187dfce], function #149 ('mono_assertion_message_disabled'), pc=0x3a7870dcfeb6 (+0x36), pos=57346 (+8)
   11: WASM [0187dfce], function #11456 ('mono_method_signature_checked_slow'), pc=0x3a78706888e8 (+0x688), pos=2317594 (+619)
   12: WASM [0187dfce], function #927 ('mono_method_signature_checked'), pc=0x3a7870d8035c (+0x5c), pos=146806 (+26)
   13: WASM [0187dfce], function #11455 ('mono_method_signature_internal_slow'), pc=0x3a7870688d1f (+0x5f), pos=2316919 (+26)
   14: WASM [0187dfce], function #199 ('mono_method_signature_internal'), pc=0x3a7870dcad6c (+0x4c), pos=62769 (+17)
   15: WASM [0187dfce], function #5933 ('instantiate_info'), pc=0x3a7870a51233 (+0x1033), pos=1184911 (+1260)
   16: WASM [0187dfce], function #7014 ('fill_runtime_generic_context'), pc=0x3a78709cfef5 (+0x575), pos=1361773 (+550)
   17: WASM [0187dfce], function #5765 ('mono_class_fill_runtime_generic_context'), pc=0x3a7870a69824 (+0x144), pos=1145086 (+106)
   18: WASM [0187dfce], function #5684 ('mono_fill_class_rgctx'), pc=0x3a7870a77be0 (+0x60), pos=1127766 (+28)
   19: WASM [0187dfce], function #144 ('aot_wrapper_icall_mono_fill_class_rgctx'), pc=0x3a7870dd03c9 (+0x69), pos=56910 (+26)
   20: WASM [0187dfce], function #17889 ('corlib_System_Collections_Generic_EnumComparer_1_T_GSHAREDVT_Com'), pc=0x3a787021b339 (+0x1d9), pos=3566288 (+153)
   21: WASM [0187dfce], function #19260 ('System_Linq_System_Linq_EnumerableSorter_2_TElement_GSHAREDVT_TK'), pc=0x3a787004d533 (+0x613), pos=4049649 (+430)
   22: WASM [0187dfce], function #19068 ('System_Linq_wrapper_delegate_invoke_System_Comparison_1_int_invo'), pc=0x3a78700952f1 (+0x311), pos=3976210 (+238)
   23: WASM [0187dfce], function #19275 ('System_Linq_System_Collections_Generic_ArraySortHelper_1_T_INT_S'), pc=0x3a787003fc40 (+0x300), pos=4063874 (+231)
   24: WASM [0187dfce], function #19279 ('System_Linq_System_Collections_Generic_ArraySortHelper_1_T_INT_I'), pc=0x3a787003d886 (+0x9e6), pos=4066192 (+746)
   25: WASM [0187dfce], function #19278 ('System_Linq_System_Collections_Generic_ArraySortHelper_1_T_INT_I'), pc=0x3a787003e3da (+0x27a), pos=4065432 (+172)

In only happens with this specific branch jeromelaban@38234d5 which is based on b7a1648.

It only happens if the SampleCategory is used in various locations. Additionally, the value of the SamplePageAttribute changes the issue.

Configuration

b7a1648

Regression?

Unsure.

Other information

Activity

  1. ghost added
    untriaged
    on Apr 14, 2021
  2. added
    arch-wasm
    on Apr 14, 2021
  3. removed
    untriaged
    on Apr 14, 2021
  4. added this to the 6.0.0 milestone on Apr 14, 2021
  5. jeromelaban commented on May 10, 2021

    @jeromelaban
    ContributorAuthor

    This issue was fixed recently, cannot repro anymore.

  6. ghost locked as resolved and limited conversation to collaborators on Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arch-wasmarea-VM-meta-mono

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions