Stream: git-wasmtime

Topic: wasmtime / Issue #1431 Out of bounds memory access not co...


view this post on Zulip Wasmtime GitHub notifications bot (Mar 28 2020 at 23:16):

havarnov opened Issue #1431:

I've added two tests for out of bounds memory access to WasmTime.Net. See: https://github.com/havarnov/wasmtime/commit/1b199cf63ed218094271020c34c89c2aea347dc3.

The problem is that one of the test ("ItThrowsOnOutOfBoundsMemoryAccess") is __not__ consistently passing on my machine. Some times it's passing and sometimes the dotnet runtime crashes.

version
os macOS Catalina
cargo cargo 1.42.0 (86334295e 2020-01-31)
rustc rustc 1.42.0 (b8cedc004 2020-03-09)
commit sha 08e5484cdb158b7795587ff7ad0cb04beef6dcd3

view this post on Zulip Wasmtime GitHub notifications bot (Mar 28 2020 at 23:16):

havarnov labeled Issue #1431:

I've added two tests for out of bounds memory access to WasmTime.Net. See: https://github.com/havarnov/wasmtime/commit/1b199cf63ed218094271020c34c89c2aea347dc3.

The problem is that one of the test ("ItThrowsOnOutOfBoundsMemoryAccess") is __not__ consistently passing on my machine. Some times it's passing and sometimes the dotnet runtime crashes.

version
os macOS Catalina
cargo cargo 1.42.0 (86334295e 2020-01-31)
rustc rustc 1.42.0 (b8cedc004 2020-03-09)
commit sha 08e5484cdb158b7795587ff7ad0cb04beef6dcd3

view this post on Zulip Wasmtime GitHub notifications bot (Mar 28 2020 at 23:27):

havarnov commented on Issue #1431:

Here's the full "Problem Report" from macOS:

Process:               dotnet [93220]
Path:                  /usr/local/share/dotnet/dotnet
Identifier:            dotnet
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        dotnet [93219]
Responsible:           Terminal [33844]
User ID:               501

Date/Time:             2020-03-29 00:25:25.461 +0100
OS Version:            Mac OS X 10.15.3 (19D76)
Report Version:        12
Bridge OS Version:     3.0 (14Y908)
Anonymous UUID:        3B4958C5-558D-E815-DF8E-FEE76D437CA5

Sleep/Wake UUID:       52F01052-1AE1-48B2-8278-1EE38E1A0CF4

Time Awake Since Boot: 510000 seconds
Time Since Wake:       6800 seconds

System Integrity Protection: enabled

Crashed Thread:        20

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000002
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [93220]

VM Regions Near 0x2:
-->
    __TEXT                 0000000105324000-0000000105331000 [   52K] r-x/rwx SM=COW  /usr/local/share/dotnet/dotnet

Thread 0:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff7017dce6 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff7023f185 _pthread_cond_wait + 701
2   libcoreclr.dylib                0x0000000105447dfb CorUnix::CPalSynchronizationManager::ThreadNativeWait(CorUnix::_ThreadNativeWaitData*, unsigned int, CorUnix::ThreadWakeupReason*, unsigned int*) + 347
3   libcoreclr.dylib                0x0000000105447a90 CorUnix::CPalSynchronizationManager::BlockThread(CorUnix::CPalThread*, unsigned int, bool, bool, CorUnix::ThreadWakeupReason*, unsigned int*) + 464
4   libcoreclr.dylib                0x000000010544c47c CorUnix::InternalWaitForMultipleObjectsEx(CorUnix::CPalThread*, unsigned int, void* const*, int, unsigned int, int, int) + 2028
5   libcoreclr.dylib                0x000000010544c762 WaitForMultipleObjectsEx + 82
6   libcoreclr.dylib                0x00000001055d76cb Thread::DoAppropriateWaitWorker(int, void**, int, unsigned int, WaitMode) + 1243
7   libcoreclr.dylib                0x00000001055d23c0 Thread::DoAppropriateWait(int, void**, int, unsigned int, WaitMode, PendingSync*) + 48
8   libcoreclr.dylib                0x0000000105706560 CLREventBase::WaitEx(unsigned int, WaitMode, PendingSync*) + 64
9   libcoreclr.dylib                0x00000001055d85e0 Thread::Block(int, PendingSync*) + 32
10  libcoreclr.dylib                0x00000001055d00a0 SyncBlock::Wait(int, int) + 544
11  libcoreclr.dylib                0x00000001058325b0 ObjectNative::WaitTimeout(bool, int, Object*) + 192
12  ???                             0x000000010bd80854 0 + 4493674580
13  ???                             0x000000010bd95100 0 + 4493758720
14  ???                             0x000000010bd94fa4 0 + 4493758372
15  ???                             0x000000010bd94d17 0 + 4493757719
16  ???                             0x000000010bd94c32 0 + 4493757490
17  ???                             0x000000010c266e3c 0 + 4498812476
18  ???                             0x000000010c2603e5 0 + 4498785253
19  libcoreclr.dylib                0x00000001057cdc3b CallDescrWorkerInternal + 124
20  libcoreclr.dylib                0x000000010561a029 MethodDescCallSite::CallTargetWorker(unsigned long const*, unsigned long*, int) + 1657
21  libcoreclr.dylib                0x00000001054e1ef6 RunMain(MethodDesc*, short, int*, PtrArray**) + 726
22  libcoreclr.dylib                0x00000001054e2268 Assembly::ExecuteMainMethod(PtrArray**, int) + 408
23  libcoreclr.dylib                0x0000000105522678 CorHost2::ExecuteAssembly(unsigned int, char16_t const*, int, char16_t const**, unsigned int*) + 504
24  libcoreclr.dylib                0x000000010545a052 coreclr_execute_assembly + 226
25  libhostpolicy.dylib             0x00000001053b35d7 0x1053a2000 + 71127
26  libhostpolicy.dylib             0x00000001053b4438 0x1053a2000 + 74808
27  libhostfxr.dylib                0x0000000105370a9f 0x105347000 + 170655
28  libhostfxr.dylib                0x000000010536fd92 0x105347000 + 167314
29  libhostfxr.dylib                0x000000010536bd9a 0x105347000 + 150938
30  dotnet                          0x000000010532e55f 0x105324000 + 42335
31  dotnet                          0x000000010532e7df 0x105324000 + 42975
32  libdyld.dylib                   0x00007fff7003a7fd start + 1

Thread 1:
0   libsystem_kernel.dylib          0x00007fff7017b25a mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff7017b5d0 mach_msg + 60
2   libcoreclr.dylib                0x0000000105456b18 MachMessage::Receive(unsigned int) + 72
3   libcoreclr.dylib                0x0000000105455a5e SEHExceptionThread(void*) + 94
4   libsystem_pthread.dylib         0x00007fff7023ee65 _pthread_start + 148
5   libsystem_pthread.dylib         0x00007fff7023a83b thread_start + 15

Thread 2:
0   libsystem_kernel.dylib          0x00007fff7017fbce kevent + 10
1   libcoreclr.dylib                0x000000010544a320 CorUnix::CPalSynchronizationManager::ReadBytesFromProcessPipe(int, unsigned char*, int) + 448
2   libcoreclr.dylib                0x0000000105449993 CorUnix::CPalSynchronizationManager::WorkerThread(void*) + 131
3   libcoreclr.dylib                0x0000000105453384 CorUnix::CPalThread::ThreadEntry(void*) + 436
4   libsystem_pthread.dylib         0x00007fff7023ee65 _pthread_start + 148
5   libsystem_pthread.dylib         0x00007fff7023a83b thread_start + 15

Thread 3:
0   libsystem_kernel.dylib          0x00007fff7017bb02 __open + 10
1   libcoreclr.dylib                0x00000001054ca97f TwoWayPipe::WaitForConnection() + 31
2   libcoreclr.dylib                0x00000001054c1c57 DbgTransportSession::TransportWorker() + 167
3   libcoreclr.dylib                0x00000001054c06b9 DbgTransportSession::TransportWorkerStatic(void*) + 9
4   libcoreclr.dylib                0x0000000105453384 CorUnix::CPalThread::ThreadEntry(void*) + 436
5   libsystem_pthread.dylib         0x00007fff7023ee65 _pthread_start + 148
6   libsystem_pthread.dylib         0x00007fff7023a83b thread_start + 15

Thread 4:
0   libsystem_kernel.dylib          0x00007fff7017dce6 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff7023f185 _pthread_cond_wait + 701
2   libcoreclr.dylib                0x0000000105447dfb CorUnix::CPalSynchronizationManager::ThreadNativeWait(CorUnix::_ThreadNativeWaitData*, unsigned int, CorUnix::ThreadWakeupReason*, unsigned int*) + 347
3   libcoreclr.dylib                0x0000000105447a90 CorUnix::CPalSynchronizationManager::BlockThread(CorUnix::CPalThread*, unsigned int, bool, bool, CorUnix::ThreadWakeupReason*, unsigned int*) + 464
4   libcoreclr.dylib                0x000000010544c47c CorUnix::InternalWaitForMultipleObjectsEx(CorUnix::CPalThread*, unsigned int, void* const*, int, unsigned int, int, int) + 2028
5   libcoreclr.dylib                0x000000010544c762 WaitForMultipleObjectsEx + 82
6   libcoreclr.dylib                0x00000001054be948 DebuggerRCThread::MainLoop() + 248
7   libcoreclr.dylib                0x00000001054be7ec DebuggerRCThread::ThreadProc() + 284
8   libcoreclr.dylib                0x00000001054be503 DebuggerRCThread::ThreadProcStatic(void*) + 131
9   libcoreclr.dylib                0x0000000105453384 CorUnix::CPalThread::ThreadEntry(void*) + 436
10  libsystem_pthread.dylib         0x00007fff7023ee65 _pthread_start + 148
11  libsystem_pthread.dylib         0x00007fff7023a83b thread_start + 15

Thread 5:
0   libsystem_kernel.dylib          0x00007fff7017dce6 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff7023f185 _pthread_cond_wait + 701
2   libcoreclr.dylib                0x0000000105447dde CorUnix::CPalSynchronizationManager::ThreadNativeWait(CorUnix::_ThreadNativeWaitData*, unsigned int, CorUnix::ThreadWakeupReason*, unsigned int*) + 318
3   libcoreclr.dylib                0x0000000105447a90 CorUnix::CPalSynchronizationManager::BlockThread(CorUnix::CPalThread*, unsigned int, bool, bool, CorUnix::ThreadWakeupReason*, unsigned int*) + 464
4   libcoreclr.dylib                0x000000010544c47c CorUnix::InternalWaitForMultipleObjectsEx(CorUnix::CPalThread*, unsigned int, void* const*, int, unsigned int, int, int) + 2028
5   libcoreclr.dylib                0x000000010544c69d WaitForSingleObjectEx + 77
6   libcoreclr.dylib                0x00000001057065e9 CLREventBase::WaitEx(unsigned int, WaitMode, PendingSync*) + 201
7   libcoreclr.dylib                0x000000010566ccbf FinalizerThread::WaitForFinalizerEvent(CLREvent*) + 31
8   libcoreclr.dylib                0x000000010566ce22 FinalizerThread::FinalizerThreadWorker(void*) + 98
9   libcoreclr.dylib                0x00000001055dafa3 ManagedThreadBase_DispatchOuter(ManagedThreadCallState*) + 323
10  libcoreclr.dylib                0x00000001055db5f0 ManagedThreadBase::FinalizerBase(void (*)(void*)) + 32
11  libcoreclr.dylib                0x000000010566d0f8 FinalizerThread::FinalizerThreadStart(void*) + 504
12  libcoreclr.dylib                0x0000000105453384 CorUnix::CPalThread::ThreadEntry(void*) + 436
13  libsystem_pthread.dylib         0x00007fff7023ee65 _pthread_start + 148
14  libsystem_pthread.dylib         0x00007fff7023a83b thread_start + 15

Thread 6:
0   libsystem_kernel.dylib          0x00007fff7018187e __accept + 10
1   libcoreclr.dylib                0x00000001054ca6de IpcStream::DiagnosticsIpc::Accept(void (*)(char const*, unsigned int)) const + 62
2   libcoreclr.dylib                0x0000000105647d20 DiagnosticsServerThread(void*) + 288
3   libcoreclr.dylib                0x0000
[message truncated]

view this post on Zulip Wasmtime GitHub notifications bot (Mar 28 2020 at 23:28):

havarnov edited Issue #1431:

I've added two tests for out of bounds memory access to WasmTime.Net. See: https://github.com/havarnov/wasmtime/commit/1b199cf63ed218094271020c34c89c2aea347dc3.

The problem is that one of the test ("ItThrowsOnOutOfBoundsMemoryAccess") is __not__ consistently passing on my machine. Some times it's passing, sometimes the dotnet runtime crashes and sometimes the process hangs.

version
os macOS Catalina
cargo cargo 1.42.0 (86334295e 2020-01-31)
rustc rustc 1.42.0 (b8cedc004 2020-03-09)
commit sha 08e5484cdb158b7795587ff7ad0cb04beef6dcd3

view this post on Zulip Wasmtime GitHub notifications bot (Mar 30 2020 at 15:05):

alexcrichton edited a comment on Issue #1431:

Here's the full "Problem Report" from macOS:

<details>

Process:               dotnet [93220]
Path:                  /usr/local/share/dotnet/dotnet
Identifier:            dotnet
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        dotnet [93219]
Responsible:           Terminal [33844]
User ID:               501

Date/Time:             2020-03-29 00:25:25.461 +0100
OS Version:            Mac OS X 10.15.3 (19D76)
Report Version:        12
Bridge OS Version:     3.0 (14Y908)
Anonymous UUID:        3B4958C5-558D-E815-DF8E-FEE76D437CA5

Sleep/Wake UUID:       52F01052-1AE1-48B2-8278-1EE38E1A0CF4

Time Awake Since Boot: 510000 seconds
Time Since Wake:       6800 seconds

System Integrity Protection: enabled

Crashed Thread:        20

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000002
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [93220]

VM Regions Near 0x2:
-->
    __TEXT                 0000000105324000-0000000105331000 [   52K] r-x/rwx SM=COW  /usr/local/share/dotnet/dotnet

Thread 0:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff7017dce6 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff7023f185 _pthread_cond_wait + 701
2   libcoreclr.dylib                0x0000000105447dfb CorUnix::CPalSynchronizationManager::ThreadNativeWait(CorUnix::_ThreadNativeWaitData*, unsigned int, CorUnix::ThreadWakeupReason*, unsigned int*) + 347
3   libcoreclr.dylib                0x0000000105447a90 CorUnix::CPalSynchronizationManager::BlockThread(CorUnix::CPalThread*, unsigned int, bool, bool, CorUnix::ThreadWakeupReason*, unsigned int*) + 464
4   libcoreclr.dylib                0x000000010544c47c CorUnix::InternalWaitForMultipleObjectsEx(CorUnix::CPalThread*, unsigned int, void* const*, int, unsigned int, int, int) + 2028
5   libcoreclr.dylib                0x000000010544c762 WaitForMultipleObjectsEx + 82
6   libcoreclr.dylib                0x00000001055d76cb Thread::DoAppropriateWaitWorker(int, void**, int, unsigned int, WaitMode) + 1243
7   libcoreclr.dylib                0x00000001055d23c0 Thread::DoAppropriateWait(int, void**, int, unsigned int, WaitMode, PendingSync*) + 48
8   libcoreclr.dylib                0x0000000105706560 CLREventBase::WaitEx(unsigned int, WaitMode, PendingSync*) + 64
9   libcoreclr.dylib                0x00000001055d85e0 Thread::Block(int, PendingSync*) + 32
10  libcoreclr.dylib                0x00000001055d00a0 SyncBlock::Wait(int, int) + 544
11  libcoreclr.dylib                0x00000001058325b0 ObjectNative::WaitTimeout(bool, int, Object*) + 192
12  ???                             0x000000010bd80854 0 + 4493674580
13  ???                             0x000000010bd95100 0 + 4493758720
14  ???                             0x000000010bd94fa4 0 + 4493758372
15  ???                             0x000000010bd94d17 0 + 4493757719
16  ???                             0x000000010bd94c32 0 + 4493757490
17  ???                             0x000000010c266e3c 0 + 4498812476
18  ???                             0x000000010c2603e5 0 + 4498785253
19  libcoreclr.dylib                0x00000001057cdc3b CallDescrWorkerInternal + 124
20  libcoreclr.dylib                0x000000010561a029 MethodDescCallSite::CallTargetWorker(unsigned long const*, unsigned long*, int) + 1657
21  libcoreclr.dylib                0x00000001054e1ef6 RunMain(MethodDesc*, short, int*, PtrArray**) + 726
22  libcoreclr.dylib                0x00000001054e2268 Assembly::ExecuteMainMethod(PtrArray**, int) + 408
23  libcoreclr.dylib                0x0000000105522678 CorHost2::ExecuteAssembly(unsigned int, char16_t const*, int, char16_t const**, unsigned int*) + 504
24  libcoreclr.dylib                0x000000010545a052 coreclr_execute_assembly + 226
25  libhostpolicy.dylib             0x00000001053b35d7 0x1053a2000 + 71127
26  libhostpolicy.dylib             0x00000001053b4438 0x1053a2000 + 74808
27  libhostfxr.dylib                0x0000000105370a9f 0x105347000 + 170655
28  libhostfxr.dylib                0x000000010536fd92 0x105347000 + 167314
29  libhostfxr.dylib                0x000000010536bd9a 0x105347000 + 150938
30  dotnet                          0x000000010532e55f 0x105324000 + 42335
31  dotnet                          0x000000010532e7df 0x105324000 + 42975
32  libdyld.dylib                   0x00007fff7003a7fd start + 1

Thread 1:
0   libsystem_kernel.dylib          0x00007fff7017b25a mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff7017b5d0 mach_msg + 60
2   libcoreclr.dylib                0x0000000105456b18 MachMessage::Receive(unsigned int) + 72
3   libcoreclr.dylib                0x0000000105455a5e SEHExceptionThread(void*) + 94
4   libsystem_pthread.dylib         0x00007fff7023ee65 _pthread_start + 148
5   libsystem_pthread.dylib         0x00007fff7023a83b thread_start + 15

Thread 2:
0   libsystem_kernel.dylib          0x00007fff7017fbce kevent + 10
1   libcoreclr.dylib                0x000000010544a320 CorUnix::CPalSynchronizationManager::ReadBytesFromProcessPipe(int, unsigned char*, int) + 448
2   libcoreclr.dylib                0x0000000105449993 CorUnix::CPalSynchronizationManager::WorkerThread(void*) + 131
3   libcoreclr.dylib                0x0000000105453384 CorUnix::CPalThread::ThreadEntry(void*) + 436
4   libsystem_pthread.dylib         0x00007fff7023ee65 _pthread_start + 148
5   libsystem_pthread.dylib         0x00007fff7023a83b thread_start + 15

Thread 3:
0   libsystem_kernel.dylib          0x00007fff7017bb02 __open + 10
1   libcoreclr.dylib                0x00000001054ca97f TwoWayPipe::WaitForConnection() + 31
2   libcoreclr.dylib                0x00000001054c1c57 DbgTransportSession::TransportWorker() + 167
3   libcoreclr.dylib                0x00000001054c06b9 DbgTransportSession::TransportWorkerStatic(void*) + 9
4   libcoreclr.dylib                0x0000000105453384 CorUnix::CPalThread::ThreadEntry(void*) + 436
5   libsystem_pthread.dylib         0x00007fff7023ee65 _pthread_start + 148
6   libsystem_pthread.dylib         0x00007fff7023a83b thread_start + 15

Thread 4:
0   libsystem_kernel.dylib          0x00007fff7017dce6 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff7023f185 _pthread_cond_wait + 701
2   libcoreclr.dylib                0x0000000105447dfb CorUnix::CPalSynchronizationManager::ThreadNativeWait(CorUnix::_ThreadNativeWaitData*, unsigned int, CorUnix::ThreadWakeupReason*, unsigned int*) + 347
3   libcoreclr.dylib                0x0000000105447a90 CorUnix::CPalSynchronizationManager::BlockThread(CorUnix::CPalThread*, unsigned int, bool, bool, CorUnix::ThreadWakeupReason*, unsigned int*) + 464
4   libcoreclr.dylib                0x000000010544c47c CorUnix::InternalWaitForMultipleObjectsEx(CorUnix::CPalThread*, unsigned int, void* const*, int, unsigned int, int, int) + 2028
5   libcoreclr.dylib                0x000000010544c762 WaitForMultipleObjectsEx + 82
6   libcoreclr.dylib                0x00000001054be948 DebuggerRCThread::MainLoop() + 248
7   libcoreclr.dylib                0x00000001054be7ec DebuggerRCThread::ThreadProc() + 284
8   libcoreclr.dylib                0x00000001054be503 DebuggerRCThread::ThreadProcStatic(void*) + 131
9   libcoreclr.dylib                0x0000000105453384 CorUnix::CPalThread::ThreadEntry(void*) + 436
10  libsystem_pthread.dylib         0x00007fff7023ee65 _pthread_start + 148
11  libsystem_pthread.dylib         0x00007fff7023a83b thread_start + 15

Thread 5:
0   libsystem_kernel.dylib          0x00007fff7017dce6 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff7023f185 _pthread_cond_wait + 701
2   libcoreclr.dylib                0x0000000105447dde CorUnix::CPalSynchronizationManager::ThreadNativeWait(CorUnix::_ThreadNativeWaitData*, unsigned int, CorUnix::ThreadWakeupReason*, unsigned int*) + 318
3   libcoreclr.dylib                0x0000000105447a90 CorUnix::CPalSynchronizationManager::BlockThread(CorUnix::CPalThread*, unsigned int, bool, bool, CorUnix::ThreadWakeupReason*, unsigned int*) + 464
4   libcoreclr.dylib                0x000000010544c47c CorUnix::InternalWaitForMultipleObjectsEx(CorUnix::CPalThread*, unsigned int, void* const*, int, unsigned int, int, int) + 2028
5   libcoreclr.dylib                0x000000010544c69d WaitForSingleObjectEx + 77
6   libcoreclr.dylib                0x00000001057065e9 CLREventBase::WaitEx(unsigned int, WaitMode, PendingSync*) + 201
7   libcoreclr.dylib                0x000000010566ccbf FinalizerThread::WaitForFinalizerEvent(CLREvent*) + 31
8   libcoreclr.dylib                0x000000010566ce22 FinalizerThread::FinalizerThreadWorker(void*) + 98
9   libcoreclr.dylib                0x00000001055dafa3 ManagedThreadBase_DispatchOuter(ManagedThreadCallState*) + 323
10  libcoreclr.dylib                0x00000001055db5f0 ManagedThreadBase::FinalizerBase(void (*)(void*)) + 32
11  libcoreclr.dylib                0x000000010566d0f8 FinalizerThread::FinalizerThreadStart(void*) + 504
12  libcoreclr.dylib                0x0000000105453384 CorUnix::CPalThread::ThreadEntry(void*) + 436
13  libsystem_pthread.dylib         0x00007fff7023ee65 _pthread_start + 148
14  libsystem_pthread.dylib         0x00007fff7023a83b thread_start + 15

Thread 6:
0   libsystem_kernel.dylib          0x00007fff7018187e __accept + 10
1   libcoreclr.dylib                0x00000001054ca6de IpcStream::DiagnosticsIpc::Accept(void (*)(char const*, unsigned int)) const + 62
2   libcoreclr.dylib                0x0000000105647d20 DiagnosticsServerThread(void*) + 288
3   libcoreclr.dy
[message truncated]

view this post on Zulip Wasmtime GitHub notifications bot (Mar 30 2020 at 15:06):

alexcrichton commented on Issue #1431:

Thanks for the report!

Given your crash logs it says thread 20 crashed which has a stack trace of:

0   libwasmtime.dylib               0x0000000108cdb1a9 __rbt_macho_add_symtab + 1353
1   libwasmtime.dylib               0x0000000108cda230 __rbt_macho_add + 1920
2   libwasmtime.dylib               0x0000000108cd9921 __rbt_backtrace_initialize + 337
3   libwasmtime.dylib               0x0000000108cd8fdf fileline_initialize + 735
4   libwasmtime.dylib               0x0000000108cd90dd __rbt_backtrace_syminfo + 45
5   libwasmtime.dylib               0x0000000108cc4fcf backtrace::symbolize::libbacktrace::resolve::h719e8a9f1adb8fe1 + 159 (libbacktrace.rs:469)
6   libwasmtime.dylib               0x0000000108cc85a8 backtrace::symbolize::resolve_frame_unsynchronized::h7ca357de7ff98157 + 56 (mod.rs:178)
7   libwasmtime.dylib               0x0000000108cc83e0 backtrace::symbolize::resolve_frame::h75c5abc2a861fa2d + 80 (mod.rs:105)
8   libwasmtime.dylib               0x0000000108cc0c2c backtrace::capture::Backtrace::resolve::he887e05906dda0c3 + 348 (capture.rs:219)
9   libwasmtime.dylib               0x0000000108cc077c backtrace::capture::Backtrace::new::hde48dbbe07c85c38 + 60 (capture.rs:129)
10  libwasmtime.dylib               0x0000000108c6e4d0 wasmtime_runtime::traphandlers::Trap::wasm::hc86ae73cea48b813 + 64 (traphandlers.rs:363)
11  libwasmtime.dylib               0x0000000108c8bfa2 wasmtime_runtime::instance::initialize_memories::hffd4acb5f389bdf5 + 514 (instance.rs:1326)
12  libwasmtime.dylib               0x0000000108c89801 wasmtime_runtime::instance::InstanceHandle::new::h7769a621032ef434 + 6369 (instance.rs:978)
13  libwasmtime.dylib               0x00000001089ee425 wasmtime_jit::instantiate::CompiledModule::instantiate::h2f2ec277d7cd7968 + 1237 (instantiate.rs:216)
14  libwasmtime.dylib               0x00000001088d3286 wasmtime::instance::instantiate::hde8bac425f17f01c + 150 (instance.rs:29)
15  libwasmtime.dylib               0x00000001088d363a wasmtime::instance::Instance::new::hfb0a2766f04e3a70 + 586 (instance.rs:127)
16  libwasmtime.dylib               0x00000001088d11ee wasmtime::linker::Linker::instantiate::h4aa0fd178eec2ddd + 2878 (linker.rs:395)
17  libwasmtime.dylib               0x0000000108659214 wasmtime_linker_instantiate + 132 (linker.rs:85)

which looks like this is running into https://github.com/bytecodealliance/wasmtime/issues/1295 as an issue which is in turn slated to be fixed by https://github.com/bytecodealliance/wasmtime/pull/1315

view this post on Zulip Wasmtime GitHub notifications bot (Mar 30 2020 at 16:46):

havarnov commented on Issue #1431:

NP, happy to help! Good that it's allready is on track to be fixed.

A couple of things:

  1. Would you'ld like me to create a PR, so these tests are part of the Wasmtime.Net test suite?
  2. Could you help me to understand how the memory stuf works? If I have the set bot max & min number of pages to 2 as in:
var memory = new Memory(Store, 2, 2);

And I have a wasm module as follows:

(module
  (import "" "mem" (memory $m 1 1))
)

Is there any way to grow the memory to 2 pages? I've tried to understand the spec, but haven't figured out how to use the memory.grow instruction.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 30 2020 at 16:52):

bjorn3 commented on Issue #1431:

In the wasm module you defined the maximum size to be 1 page. This means that you can't grow it to 2 pages. If you use (memory $m 1) instead, there is no limit on the memory size other than the standard limit of 4GB.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 30 2020 at 16:52):

bjorn3 edited a comment on Issue #1431:

In the wasm module you defined the maximum size to be 1 page. This means that you can't grow it to 2 pages. If you use (memory $m 1) instead, there is no limit on the size the memory can grow to other than the standard limit of 4GB.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 30 2020 at 17:12):

havarnov commented on Issue #1431:

@bjorn3 if you use (memory $m 1) I guess you can't grow it more than what the host has defined? And how exactly do I use memory.grow?

view this post on Zulip Wasmtime GitHub notifications bot (Mar 30 2020 at 17:37):

bjorn3 commented on Issue #1431:

I believe you can use memory.grow by first pushing a 32bit integer representing the new size in pages to the stack and the calling memory.grow.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2020 at 21:36):

alexcrichton commented on Issue #1431:

Ok I think this should be fixed with https://github.com/bytecodealliance/wasmtime/pull/1315 now

view this post on Zulip Wasmtime GitHub notifications bot (Apr 03 2020 at 21:36):

alexcrichton closed Issue #1431:

I've added two tests for out of bounds memory access to WasmTime.Net. See: https://github.com/havarnov/wasmtime/commit/1b199cf63ed218094271020c34c89c2aea347dc3.

The problem is that one of the test ("ItThrowsOnOutOfBoundsMemoryAccess") is __not__ consistently passing on my machine. Some times it's passing, sometimes the dotnet runtime crashes and sometimes the process hangs.

version
os macOS Catalina
cargo cargo 1.42.0 (86334295e 2020-01-31)
rustc rustc 1.42.0 (b8cedc004 2020-03-09)
commit sha 08e5484cdb158b7795587ff7ad0cb04beef6dcd3

view this post on Zulip Wasmtime GitHub notifications bot (Apr 04 2020 at 20:25):

havarnov commented on Issue #1431:

Still getting the same error after merging in master. Atleast for me it seems like it's the same stack trace (in thread 1 this time).

<details>
Process: dotnet [56275]
Path: /usr/local/share/dotnet/dotnet
Identifier: dotnet
Version: 0
Code Type: X86-64 (Native)
Parent Process: mono-sgen [54559]
Responsible: rider [53391]
User ID: 501

Date/Time: 2020-04-04 22:18:49.598 +0200
OS Version: Mac OS X 10.15.3 (19D76)
Report Version: 12
Bridge OS Version: 3.0 (14Y908)
Anonymous UUID: 3B4958C5-558D-E815-DF8E-FEE76D437CA5

Sleep/Wake UUID: 20124844-BA37-4C58-8ED2-83ADCDC394D1

Time Awake Since Boot: 680000 seconds
Time Since Wake: 750 seconds

System Integrity Protection: enabled

Crashed Thread: 1

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Application Specific Information:
abort() called

Thread 0:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff7017dce6 __psynch_cvwait + 10
1 libsystem_pthread.dylib 0x00007fff7023f185 _pthread_cond_wait + 701
2 libcoreclr.dylib 0x000000010ce59dfb CorUnix::CPalSynchronizationManager::ThreadNativeWait(CorUnix::_ThreadNativeWaitData, unsigned int, CorUnix::ThreadWakeupReason, unsigned int*) + 347
3 libcoreclr.dylib 0x000000010ce59a90 CorUnix::CPalSynchronizationManager::BlockThread(CorUnix::CPalThread, unsigned int, bool, bool, CorUnix::ThreadWakeupReason, unsigned int*) + 464
4 libcoreclr.dylib 0x000000010ce5e47c CorUnix::InternalWaitForMultipleObjectsEx(CorUnix::CPalThread, unsigned int, void const*, int, unsigned int, int, int) + 2028
5 libcoreclr.dylib 0x000000010ce5e762 WaitForMultipleObjectsEx + 82
6 libcoreclr.dylib 0x000000010cfe96cb Thread::DoAppropriateWaitWorker(int, void**, int, unsigned int, WaitMode) + 1243
7 libcoreclr.dylib 0x000000010cfe43c0 Thread::DoAppropriateWait(int, void*, int, unsigned int, WaitMode, PendingSync) + 48
8 libcoreclr.dylib 0x000000010d118560 CLREventBase::WaitEx(unsigned int, WaitMode, PendingSync*) + 64
9 libcoreclr.dylib 0x000000010cfea5e0 Thread::Block(int, PendingSync*) + 32
10 libcoreclr.dylib 0x000000010cfe20a0 SyncBlock::Wait(int, int) + 544
11 libcoreclr.dylib 0x000000010d2445b0 ObjectNative::WaitTimeout(bool, int, Object*) + 192
12 ??? 0x000000011b770854 0 + 4755753044
13 ??? 0x000000011b785100 0 + 4755837184
14 ??? 0x000000011b784fa4 0 + 4755836836
15 ??? 0x000000011b784d17 0 + 4755836183
16 ??? 0x000000011b784c32 0 + 4755835954
17 ??? 0x000000011bc56e3c 0 + 4760890940
18 ??? 0x000000011bc503e5 0 + 4760863717
19 libcoreclr.dylib 0x000000010d1dfc3b CallDescrWorkerInternal + 124
20 libcoreclr.dylib 0x000000010d02c029 MethodDescCallSite::CallTargetWorker(unsigned long const, unsigned long, int) + 1657
21 libcoreclr.dylib 0x000000010cef3ef6 RunMain(MethodDesc, short, int, PtrArray**) + 726
22 libcoreclr.dylib 0x000000010cef4268 Assembly::ExecuteMainMethod(PtrArray**, int) + 408
23 libcoreclr.dylib 0x000000010cf34678 CorHost2::ExecuteAssembly(unsigned int, char16_t const, int, char16_t const, unsigned int) + 504
24 libcoreclr.dylib 0x000000010ce6c052 coreclr_execute_assembly + 226
25 libhostpolicy.dylib 0x000000010cdc55d7 0x10cdb4000 + 71127
26 libhostpolicy.dylib 0x000000010cdc6438 0x10cdb4000 + 74808
27 libhostfxr.dylib 0x000000010cd82a9f 0x10cd59000 + 170655
28 libhostfxr.dylib 0x000000010cd81d92 0x10cd59000 + 167314
29 libhostfxr.dylib 0x000000010cd7dd9a 0x10cd59000 + 150938
30 dotnet 0x000000010cd4055f 0x10cd36000 + 42335
31 dotnet 0x000000010cd407df 0x10cd36000 + 42975
32 libdyld.dylib 0x00007fff7003a7fd start + 1

Thread 1 Crashed:
0 libsystem_kernel.dylib 0x00007fff701817fa __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff7023ebc1 pthread_kill + 432
2 libsystem_c.dylib 0x00007fff70108a1c abort + 120
3 libcoreclr.dylib 0x000000010ce6815c SEHExceptionThread(void*) + 1884
4 libsystem_pthread.dylib 0x00007fff7023ee65 _pthread_start + 148
5 libsystem_pthread.dylib 0x00007fff7023a83b thread_start + 15

Thread 2:
0 libsystem_kernel.dylib 0x00007fff7017fbce kevent + 10
1 libcoreclr.dylib 0x000000010ce5c320 CorUnix::CPalSynchronizationManager::ReadBytesFromProcessPipe(int, unsigned char*, int) + 448
2 libcoreclr.dylib 0x000000010ce5b993 CorUnix::CPalSynchronizationManager::WorkerThread(void*) + 131
3 libcoreclr.dylib 0x000000010ce65384 CorUnix::CPalThread::ThreadEntry(void*) + 436
4 libsystem_pthread.dylib 0x00007fff7023ee65 _pthread_start + 148
5 libsystem_pthread.dylib 0x00007fff7023a83b thread_start + 15

Thread 3:
0 libsystem_kernel.dylib 0x00007fff7017bb02 __open + 10
1 libcoreclr.dylib 0x000000010cedc97f TwoWayPipe::WaitForConnection() + 31
2 libcoreclr.dylib 0x000000010ced3c57 DbgTransportSession::TransportWorker() + 167
3 libcoreclr.dylib 0x000000010ced26b9 DbgTransportSession::TransportWorkerStatic(void*) + 9
4 libcoreclr.dylib 0x000000010ce65384 CorUnix::CPalThread::ThreadEntry(void*) + 436
5 libsystem_pthread.dylib 0x00007fff7023ee65 _pthread_start + 148
6 libsystem_pthread.dylib 0x00007fff7023a83b thread_start + 15

Thread 4:
0 libsystem_kernel.dylib 0x00007fff7017dce6 __psynch_cvwait + 10
1 libsystem_pthread.dylib 0x00007fff7023f185 _pthread_cond_wait + 701
2 libcoreclr.dylib 0x000000010ce59dfb CorUnix::CPalSynchronizationManager::ThreadNativeWait(CorUnix::_ThreadNativeWaitData, unsigned int, CorUnix::ThreadWakeupReason, unsigned int*) + 347
3 libcoreclr.dylib 0x000000010ce59a90 CorUnix::CPalSynchronizationManager::BlockThread(CorUnix::CPalThread, unsigned int, bool, bool, CorUnix::ThreadWakeupReason, unsigned int*) + 464
4 libcoreclr.dylib 0x000000010ce5e47c CorUnix::InternalWaitForMultipleObjectsEx(CorUnix::CPalThread, unsigned int, void const*, int, unsigned int, int, int) + 2028
5 libcoreclr.dylib 0x000000010ce5e762 WaitForMultipleObjectsEx + 82
6 libcoreclr.dylib 0x000000010ced0948 DebuggerRCThread::MainLoop() + 248
7 libcoreclr.dylib 0x000000010ced07ec DebuggerRCThread::ThreadProc() + 284
8 libcoreclr.dylib 0x000000010ced0503 DebuggerRCThread::ThreadProcStatic(void*) + 131
9 libcoreclr.dylib 0x000000010ce65384 CorUnix::CPalThread::ThreadEntry(void*) + 436
10 libsystem_pthread.dylib 0x00007fff7023ee65 _pthread_start + 148
11 libsystem_pthread.dylib 0x00007fff7023a83b thread_start + 15

Thread 5:
0 libsystem_kernel.dylib 0x00007fff7017dce6 __psynch_cvwait + 10
1 libsystem_pthread.dylib 0x00007fff7023f185 _pthread_cond_wait + 701
2 libcoreclr.dylib 0x000000010ce59dde CorUnix::CPalSynchronizationManager::ThreadNativeWait(CorUnix::_ThreadNativeWaitData, unsigned int, CorUnix::ThreadWakeupReason, unsigned int*) + 318
3 libcoreclr.dylib 0x000000010ce59a90 CorUnix::CPalSynchronizationManager::BlockThread(CorUnix::CPalThread, unsigned int, bool, bool, CorUnix::ThreadWakeupReason, unsigned int*) + 464
4 libcoreclr.dylib 0x000000010ce5e47c CorUnix::InternalWaitForMultipleObjectsEx(CorUnix::CPalThread, unsigned int, void const*, int, unsigned int, int, int) + 2028
5 libcoreclr.dylib 0x000000010ce5e69d WaitForSingleObjectEx + 77
6 libcoreclr.dylib 0x000000010d1185e9 CLREventBase::WaitEx(unsigned int, WaitMode, PendingSync*) + 201
7 libcoreclr.dylib 0x000000010d07ecbf FinalizerThread::WaitForFinalizerEvent(CLREvent*) + 31
8 libcoreclr.dylib 0x000000010d07ee22 FinalizerThread::FinalizerThreadWorker(void*) + 98
9 libcoreclr.dylib 0x000000010cfecfa3 ManagedThreadBase_DispatchOuter(ManagedThreadCallState*) + 323
10 libcoreclr.dylib 0x000000010cfed5f0 ManagedThreadBase::FinalizerBase(void ()(void)) + 32
11 libcoreclr.dylib 0x000000010d07f0f8 FinalizerThread::FinalizerThreadStart(void*) + 504
12 libcoreclr.dylib 0x000000010ce65384 CorUnix::CPalThread::ThreadEntry(void*) + 436
13 libsystem_pthread.dylib 0x00007fff7023ee65 _pthread_start + 148
14 libsystem_pthread.dylib 0x00007fff7023a83b thread_start + 15

Thread 6:
0 libsystem_kernel.dylib 0x00007fff7018187e __accept + 10
1 libcoreclr.dylib 0x000000010cedc6de IpcStream::DiagnosticsIpc::Accept(void ()(char const, unsigned int)) const + 62
2 libcoreclr.dylib 0x000000010d059d20 DiagnosticsServerThread(void*) + 288
3 libcoreclr.dylib 0x000000010ce65384 CorUnix::CPalThread::ThreadEntry(void*) + 436
4 libsystem_pthread.dylib 0x00007fff7023ee65 _pthread_start + 148
5 libsystem_pthread.dylib
[message truncated]

view this post on Zulip Wasmtime GitHub notifications bot (Apr 06 2020 at 14:49):

alexcrichton edited a comment on Issue #1431:

Still getting the same error after merging in master. Atleast for me it seems like it's the same stack trace (in thread 1 this time).

<details>

Process:               dotnet [56275]
Path:                  /usr/local/share/dotnet/dotnet
Identifier:            dotnet
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        mono-sgen [54559]
Responsible:           rider [53391]
User ID:               501

Date/Time:             2020-04-04 22:18:49.598 +0200
OS Version:            Mac OS X 10.15.3 (19D76)
Report Version:        12
Bridge OS Version:     3.0 (14Y908)
Anonymous UUID:        3B4958C5-558D-E815-DF8E-FEE76D437CA5

Sleep/Wake UUID:       20124844-BA37-4C58-8ED2-83ADCDC394D1

Time Awake Since Boot: 680000 seconds
Time Since Wake:       750 seconds

System Integrity Protection: enabled

Crashed Thread:        1

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
abort() called

Thread 0:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff7017dce6 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff7023f185 _pthread_cond_wait + 701
2   libcoreclr.dylib                0x000000010ce59dfb CorUnix::CPalSynchronizationManager::ThreadNativeWait(CorUnix::_ThreadNativeWaitData*, unsigned int, CorUnix::ThreadWakeupReason*, unsigned int*) + 347
3   libcoreclr.dylib                0x000000010ce59a90 CorUnix::CPalSynchronizationManager::BlockThread(CorUnix::CPalThread*, unsigned int, bool, bool, CorUnix::ThreadWakeupReason*, unsigned int*) + 464
4   libcoreclr.dylib                0x000000010ce5e47c CorUnix::InternalWaitForMultipleObjectsEx(CorUnix::CPalThread*, unsigned int, void* const*, int, unsigned int, int, int) + 2028
5   libcoreclr.dylib                0x000000010ce5e762 WaitForMultipleObjectsEx + 82
6   libcoreclr.dylib                0x000000010cfe96cb Thread::DoAppropriateWaitWorker(int, void**, int, unsigned int, WaitMode) + 1243
7   libcoreclr.dylib                0x000000010cfe43c0 Thread::DoAppropriateWait(int, void**, int, unsigned int, WaitMode, PendingSync*) + 48
8   libcoreclr.dylib                0x000000010d118560 CLREventBase::WaitEx(unsigned int, WaitMode, PendingSync*) + 64
9   libcoreclr.dylib                0x000000010cfea5e0 Thread::Block(int, PendingSync*) + 32
10  libcoreclr.dylib                0x000000010cfe20a0 SyncBlock::Wait(int, int) + 544
11  libcoreclr.dylib                0x000000010d2445b0 ObjectNative::WaitTimeout(bool, int, Object*) + 192
12  ???                             0x000000011b770854 0 + 4755753044
13  ???                             0x000000011b785100 0 + 4755837184
14  ???                             0x000000011b784fa4 0 + 4755836836
15  ???                             0x000000011b784d17 0 + 4755836183
16  ???                             0x000000011b784c32 0 + 4755835954
17  ???                             0x000000011bc56e3c 0 + 4760890940
18  ???                             0x000000011bc503e5 0 + 4760863717
19  libcoreclr.dylib                0x000000010d1dfc3b CallDescrWorkerInternal + 124
20  libcoreclr.dylib                0x000000010d02c029 MethodDescCallSite::CallTargetWorker(unsigned long const*, unsigned long*, int) + 1657
21  libcoreclr.dylib                0x000000010cef3ef6 RunMain(MethodDesc*, short, int*, PtrArray**) + 726
22  libcoreclr.dylib                0x000000010cef4268 Assembly::ExecuteMainMethod(PtrArray**, int) + 408
23  libcoreclr.dylib                0x000000010cf34678 CorHost2::ExecuteAssembly(unsigned int, char16_t const*, int, char16_t const**, unsigned int*) + 504
24  libcoreclr.dylib                0x000000010ce6c052 coreclr_execute_assembly + 226
25  libhostpolicy.dylib             0x000000010cdc55d7 0x10cdb4000 + 71127
26  libhostpolicy.dylib             0x000000010cdc6438 0x10cdb4000 + 74808
27  libhostfxr.dylib                0x000000010cd82a9f 0x10cd59000 + 170655
28  libhostfxr.dylib                0x000000010cd81d92 0x10cd59000 + 167314
29  libhostfxr.dylib                0x000000010cd7dd9a 0x10cd59000 + 150938
30  dotnet                          0x000000010cd4055f 0x10cd36000 + 42335
31  dotnet                          0x000000010cd407df 0x10cd36000 + 42975
32  libdyld.dylib                   0x00007fff7003a7fd start + 1

Thread 1 Crashed:
0   libsystem_kernel.dylib          0x00007fff701817fa __pthread_kill + 10
1   libsystem_pthread.dylib         0x00007fff7023ebc1 pthread_kill + 432
2   libsystem_c.dylib               0x00007fff70108a1c abort + 120
3   libcoreclr.dylib                0x000000010ce6815c SEHExceptionThread(void*) + 1884
4   libsystem_pthread.dylib         0x00007fff7023ee65 _pthread_start + 148
5   libsystem_pthread.dylib         0x00007fff7023a83b thread_start + 15

Thread 2:
0   libsystem_kernel.dylib          0x00007fff7017fbce kevent + 10
1   libcoreclr.dylib                0x000000010ce5c320 CorUnix::CPalSynchronizationManager::ReadBytesFromProcessPipe(int, unsigned char*, int) + 448
2   libcoreclr.dylib                0x000000010ce5b993 CorUnix::CPalSynchronizationManager::WorkerThread(void*) + 131
3   libcoreclr.dylib                0x000000010ce65384 CorUnix::CPalThread::ThreadEntry(void*) + 436
4   libsystem_pthread.dylib         0x00007fff7023ee65 _pthread_start + 148
5   libsystem_pthread.dylib         0x00007fff7023a83b thread_start + 15

Thread 3:
0   libsystem_kernel.dylib          0x00007fff7017bb02 __open + 10
1   libcoreclr.dylib                0x000000010cedc97f TwoWayPipe::WaitForConnection() + 31
2   libcoreclr.dylib                0x000000010ced3c57 DbgTransportSession::TransportWorker() + 167
3   libcoreclr.dylib                0x000000010ced26b9 DbgTransportSession::TransportWorkerStatic(void*) + 9
4   libcoreclr.dylib                0x000000010ce65384 CorUnix::CPalThread::ThreadEntry(void*) + 436
5   libsystem_pthread.dylib         0x00007fff7023ee65 _pthread_start + 148
6   libsystem_pthread.dylib         0x00007fff7023a83b thread_start + 15

Thread 4:
0   libsystem_kernel.dylib          0x00007fff7017dce6 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff7023f185 _pthread_cond_wait + 701
2   libcoreclr.dylib                0x000000010ce59dfb CorUnix::CPalSynchronizationManager::ThreadNativeWait(CorUnix::_ThreadNativeWaitData*, unsigned int, CorUnix::ThreadWakeupReason*, unsigned int*) + 347
3   libcoreclr.dylib                0x000000010ce59a90 CorUnix::CPalSynchronizationManager::BlockThread(CorUnix::CPalThread*, unsigned int, bool, bool, CorUnix::ThreadWakeupReason*, unsigned int*) + 464
4   libcoreclr.dylib                0x000000010ce5e47c CorUnix::InternalWaitForMultipleObjectsEx(CorUnix::CPalThread*, unsigned int, void* const*, int, unsigned int, int, int) + 2028
5   libcoreclr.dylib                0x000000010ce5e762 WaitForMultipleObjectsEx + 82
6   libcoreclr.dylib                0x000000010ced0948 DebuggerRCThread::MainLoop() + 248
7   libcoreclr.dylib                0x000000010ced07ec DebuggerRCThread::ThreadProc() + 284
8   libcoreclr.dylib                0x000000010ced0503 DebuggerRCThread::ThreadProcStatic(void*) + 131
9   libcoreclr.dylib                0x000000010ce65384 CorUnix::CPalThread::ThreadEntry(void*) + 436
10  libsystem_pthread.dylib         0x00007fff7023ee65 _pthread_start + 148
11  libsystem_pthread.dylib         0x00007fff7023a83b thread_start + 15

Thread 5:
0   libsystem_kernel.dylib          0x00007fff7017dce6 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff7023f185 _pthread_cond_wait + 701
2   libcoreclr.dylib                0x000000010ce59dde CorUnix::CPalSynchronizationManager::ThreadNativeWait(CorUnix::_ThreadNativeWaitData*, unsigned int, CorUnix::ThreadWakeupReason*, unsigned int*) + 318
3   libcoreclr.dylib                0x000000010ce59a90 CorUnix::CPalSynchronizationManager::BlockThread(CorUnix::CPalThread*, unsigned int, bool, bool, CorUnix::ThreadWakeupReason*, unsigned int*) + 464
4   libcoreclr.dylib                0x000000010ce5e47c CorUnix::InternalWaitForMultipleObjectsEx(CorUnix::CPalThread*, unsigned int, void* const*, int, unsigned int, int, int) + 2028
5   libcoreclr.dylib                0x000000010ce5e69d WaitForSingleObjectEx + 77
6   libcoreclr.dylib                0x000000010d1185e9 CLREventBase::WaitEx(unsigned int, WaitMode, PendingSync*) + 201
7   libcoreclr.dylib                0x000000010d07ecbf FinalizerThread::WaitForFinalizerEvent(CLREvent*) + 31
8   libcoreclr.dylib                0x000000010d07ee22 FinalizerThread::FinalizerThreadWorker(void*) + 98
9   libcoreclr.dylib                0x000000010cfecfa3 ManagedThreadBase_DispatchOuter(ManagedThreadCallState*) + 323
10  libcoreclr.dylib                0x000000010cfed5f0 ManagedThreadBase::FinalizerBase(void (*)(void*)) + 32
11  libcoreclr.dylib                0x000000010d07f0f8 FinalizerThread::FinalizerThreadStart(void*) + 504
12  libcoreclr.dylib                0x000000010ce65384 CorUnix::CPalThread::ThreadEntry(void*) + 436
13  libsystem_pthread.dylib         0x00007fff7023ee65 _pthread_start + 148
14  libsystem_pthread.dylib         0x00007fff7023a83b thread_start + 15

Thread 6:
0   libsystem_kernel.dylib          0x00007fff7018187e __accept + 10
1   libcoreclr.dylib                0x000000010cedc6de IpcStream::DiagnosticsIpc::Accept(void (*)(char const*, unsigned int)) const + 62
2   libcoreclr.dylib                0x000000010d059d20 DiagnosticsServerThread(void*) + 288
3   libcoreclr.dylib                0x000000010ce65384 CorUnix::CPalThread::ThreadEntry(void*) + 436
4   libsystem_pthread.dylib         0x00007fff7023ee65 _pthread_start + 148
5   libsystem
[message truncated]

view this post on Zulip Wasmtime GitHub notifications bot (Apr 06 2020 at 14:50):

alexcrichton commented on Issue #1431:

@havarnov that says that thread 1 crashed with a stack tha tlooks like:

Thread 1 Crashed:
0   libsystem_kernel.dylib          0x00007fff701817fa __pthread_kill + 10
1   libsystem_pthread.dylib         0x00007fff7023ebc1 pthread_kill + 432
2   libsystem_c.dylib               0x00007fff70108a1c abort + 120
3   libcoreclr.dylib                0x000000010ce6815c SEHExceptionThread(void*) + 1884
4   libsystem_pthread.dylib         0x00007fff7023ee65 _pthread_start + 148
5   libsystem_pthread.dylib         0x00007fff7023a83b thread_start + 15

are you sure that's related to segfaults? That looks like the application explicitly killed itself?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 08 2020 at 06:23):

havarnov commented on Issue #1431:

Now I'm both confused and unsure about what a commented 2 days ago. Seems like a posted the wrong stack trace?

Anyways, I'm sure the test is failing/passign inconsistently. Here's a new stack trace after running dotnet test on https://github.com/havarnov/wasmtime/commit/30e0655493c67cadf4099029e38fa726f896ea19.

<details>

Thread 18:
0   libsystem_kernel.dylib          0x00007fff7017d4c2 __psynch_mutexwait + 10
1   libsystem_pthread.dylib         0x00007fff7023c62a _pthread_mutex_firstfit_lock_wait + 96
2   libsystem_pthread.dylib         0x00007fff7023a5e5 _pthread_mutex_firstfit_lock_slow + 222
3   libwasmtime.dylib               0x000000010fc16b35 std::sys::unix::mutex::Mutex::lock::h1dbae44fb498794c + 37 (mutex.rs:57)
4   libwasmtime.dylib               0x000000010fc166a8 std::sys_common::mutex::Mutex::raw_lock::h0320f6f2d66d3b9a + 24 (mutex.rs:42)
5   libwasmtime.dylib               0x000000010fc0f8c6 std::sync::mutex::Mutex$LT$T$GT$::lock::h3ff867185c94d556 + 38 (mutex.rs:219)
6   libwasmtime.dylib               0x000000010fc1759c backtrace::lock::lock::h8fc4afef87bf4cdd + 108
7   libwasmtime.dylib               0x000000010fc190a9 backtrace::backtrace::trace::h2c442a445ec5d23c + 25 (mod.rs:52)
8   libwasmtime.dylib               0x000000010fc0ad67 backtrace::capture::Backtrace::create::h6478de780a3e1ffe + 103 (capture.rs:164)
9   libwasmtime.dylib               0x000000010fc0aceb backtrace::capture::Backtrace::new_unresolved::h6faba8f13d41d24f + 27
10  libwasmtime.dylib               0x000000010f53fbb5 wasmtime::trap::Trap::new::h1a9eabfc567a0830 + 85 (trap.rs:32)
11  libwasmtime.dylib               0x000000010f5a8cd5 wasm_trap_new + 357 (trap.rs:43)
12  ???                             0x00000001200ffd7d 0 + 4832886141
13  ???                             0x00000001200ff9c4 0 + 4832885188
14  ???                             0x00000001200ff516 0 + 4832883990
15  libcoreclr.dylib                0x000000010c6eaca9 UMThunkStub + 273
16  libwasmtime.dylib               0x000000010f58d7fd wasmtime::func::wasm_func_new::_$u7b$$u7b$closure$u7d$$u7d$::h04b26d3696b68533 + 45 (func.rs:113)
17  libwasmtime.dylib               0x000000010f58d38d wasmtime::func::create_function::_$u7b$$u7b$closure$u7d$$u7d$::habe73ec684983f10 + 461 (func.rs:90)
18  libwasmtime.dylib               0x000000010f5af954 wasmtime::func::Func::new::_$u7b$$u7b$closure$u7d$$u7d$::heef410f7add1b585 + 948 (func.rs:246)
19  libwasmtime.dylib               0x000000010f7c0420 _$LT$alloc..boxed..Box$LT$F$GT$$u20$as$u20$core..ops..function..Fn$LT$A$GT$$GT$::call::h99249d428e1cf153 + 48 (boxed.rs:1029)
20  libwasmtime.dylib               0x000000010f7ba438 wasmtime::trampoline::func::stub_fn::call_stub::h3340fb5f082687a0 + 184 (func.rs:79)
21  libwasmtime.dylib               0x000000010f7d5cc1 wasmtime::trampoline::func::stub_fn::_$u7b$$u7b$closure$u7d$$u7d$::h5226b3d450958191 + 49 (func.rs:50)
22  libwasmtime.dylib               0x000000010f7ab91d core::ops::function::FnOnce::call_once::h39eca28141925286 + 13
23  libwasmtime.dylib               0x000000010f798ae8 _$LT$std..panic..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$$LP$$RP$$GT$$GT$::call_once::hac4b47668d95477a + 40 (panic.rs:318)
24  libwasmtime.dylib               0x000000010f80638d std::panicking::try::do_call::h6e790f5863cd1626 + 77 (panicking.rs:305)
25  libwasmtime.dylib               0x00000001103e340b __rust_maybe_catch_panic + 27 (lib.rs:94)
26  libwasmtime.dylib               0x000000010f80627b std::panicking::try::he4c645adab2154a6 + 187 (panicking.rs:281)
27  libwasmtime.dylib               0x000000010f798b2f std::panic::catch_unwind::ha8510c644ad9f868 + 47
28  libwasmtime.dylib               0x000000010f7ba206 wasmtime::trampoline::func::stub_fn::hadd0620c40df928e + 118 (func.rs:49)
29  ???                             0x000000011198301d 0 + 4590153757
30  ???                             0x00000001119630ee 0 + 4590022894
31  ???                             0x00000001119632e4 0 + 4590023396
32  libwasmtime.dylib               0x000000010f7e68fa wasmtime::func::Func::call::_$u7b$$u7b$closure$u7d$$u7d$::hf0de02914dcebcf0 + 106 (func.rs:537)
33  libwasmtime.dylib               0x000000010f7be618 wasmtime_runtime::traphandlers::catch_traps::call_closure::ha8fe22ead980de5c + 24 (traphandlers.rs:397)
34  libwasmtime.dylib               0x000000010fc071b6 RegisterSetjmp + 118 (helpers.c:13)
35  libwasmtime.dylib               0x000000010f7be88d wasmtime_runtime::traphandlers::catch_traps::_$u7b$$u7b$closure$u7d$$u7d$::hd670f25e8930dd8e + 61 (traphandlers.rs:385)
36  libwasmtime.dylib               0x000000010f7bf678 wasmtime_runtime::traphandlers::CallThreadState::with::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::he43f22d21542f808 + 40 (traphandlers.rs:434)
37  libwasmtime.dylib               0x000000010f7fffa9 wasmtime_runtime::traphandlers::tls::set::_$u7b$$u7b$closure$u7d$$u7d$::h33448bea1c38356f + 89 (traphandlers.rs:592)
38  libwasmtime.dylib               0x000000010f7d20dd std::thread::local::LocalKey$LT$T$GT$::try_with::h5afbe2ebf53cd09f + 253 (local.rs:262)
39  libwasmtime.dylib               0x000000010f7d1e60 std::thread::local::LocalKey$LT$T$GT$::with::had9e0ec9e0efdafb + 48 (local.rs:239)
40  libwasmtime.dylib               0x000000010f7fff3c wasmtime_runtime::traphandlers::tls::set::h05ba0b7054f32ba0 + 60 (traphandlers.rs:590)
41  libwasmtime.dylib               0x000000010f7be9d3 wasmtime_runtime::traphandlers::CallThreadState::with::_$u7b$$u7b$closure$u7d$$u7d$::hd71ca41e35a2e24b + 195 (traphandlers.rs:434)
42  libwasmtime.dylib               0x000000010f8000fa wasmtime_runtime::traphandlers::tls::with::_$u7b$$u7b$closure$u7d$$u7d$::h7d32ba2acb06c7fe + 170 (traphandlers.rs:601)
43  libwasmtime.dylib               0x000000010f7d1f9b std::thread::local::LocalKey$LT$T$GT$::try_with::h527a0121f2d2ff09 + 251 (local.rs:262)
44  libwasmtime.dylib               0x000000010f7d1df7 std::thread::local::LocalKey$LT$T$GT$::with::h9ea0df510202099a + 55
45  libwasmtime.dylib               0x000000010f80003b wasmtime_runtime::traphandlers::tls::with::h50577ff01f6a129e + 59
46  libwasmtime.dylib               0x000000010f7be8d3 wasmtime_runtime::traphandlers::CallThreadState::with::h9708523a0125e9dd + 51 (traphandlers.rs:432)
47  libwasmtime.dylib               0x000000010f7be809 wasmtime_runtime::traphandlers::catch_traps::h03f0d10c4a1eecaa + 489 (traphandlers.rs:384)
48  libwasmtime.dylib               0x000000010f805259 wasmtime::func::Func::call::hf98f9e53dcf28bd1 + 1161 (func.rs:530)
49  libwasmtime.dylib               0x000000010f58d964 wasmtime::func::wasm_func_call::_$u7b$$u7b$closure$u7d$$u7d$::h35e240458febc54e + 84
50  libwasmtime.dylib               0x000000010f5411f0 core::ops::function::FnOnce::call_once::h6eac9b799daddc95 + 32 (function.rs:232)
51  libwasmtime.dylib               0x000000010f534934 _$LT$std..panic..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$$LP$$RP$$GT$$GT$::call_once::hbe2a7711d183cc27 + 36
52  libwasmtime.dylib               0x000000010f55b8be std::panicking::try::do_call::h0a237ef0c1d957b0 + 62 (panicking.rs:305)
53  libwasmtime.dylib               0x00000001103e340b __rust_maybe_catch_panic + 27 (lib.rs:94)
54  libwasmtime.dylib               0x000000010f55b78c std::panicking::try::h9e9a49438d44ff4b + 188 (panicking.rs:281)
55  libwasmtime.dylib               0x000000010f534964 std::panic::catch_unwind::habc0197a0168034f + 36
56  libwasmtime.dylib               0x000000010f59ca4d wasm_func_call + 477 (func.rs:178)
57  ???                             0x00000001200ff23b 0 + 4832883259
58  ???                             0x00000001200fee0b 0 + 4832882187
59  ???                             0x00000001200fea42 0 + 4832881218
60  ???                             0x000000011ce137ae 0 + 4779489198
61  ???                             0x000000011bd463eb 0 + 4761871339
62  ???                             0x00000001200fd6d2 0 + 4832876242
63  ???                             0x00000001200f8c50 0 + 4832857168
64  ???                             0x00000001200f8bc4 0 + 4832857028
65  ???                             0x00000001200f88a4 0 + 4832856228
66  ???                             0x00000001200fc81a 0 + 4832872474
67  libcoreclr.dylib                0x000000010c6e9c3b CallDescrWorkerInternal + 124
68  libcoreclr.dylib                0x000000010c5352a8 CallDescrWorkerWithHandler(CallDescrData*, int) + 104
69  libcoreclr.dylib                0x000000010c5f96df CallDescrWorkerReflectionWrapper(CallDescrData*, Frame*) + 127
70  libcoreclr.dylib                0x000000010c5fa667 RuntimeMethodHandle::InvokeMethod(Object*, PtrArray*, SignatureNative*, bool, bool) + 3143

</details>

view this post on Zulip Wasmtime GitHub notifications bot (Apr 08 2020 at 06:23):

havarnov edited a comment on Issue #1431:

Now I'm both confused and unsure about what a commented 2 days ago. Seems like a posted the wrong stack trace?

Anyways, I'm sure the test is failing/passing inconsistently. Here's a new stack trace after running dotnet test on https://github.com/havarnov/wasmtime/commit/30e0655493c67cadf4099029e38fa726f896ea19.

<details>

Thread 18:
0   libsystem_kernel.dylib          0x00007fff7017d4c2 __psynch_mutexwait + 10
1   libsystem_pthread.dylib         0x00007fff7023c62a _pthread_mutex_firstfit_lock_wait + 96
2   libsystem_pthread.dylib         0x00007fff7023a5e5 _pthread_mutex_firstfit_lock_slow + 222
3   libwasmtime.dylib               0x000000010fc16b35 std::sys::unix::mutex::Mutex::lock::h1dbae44fb498794c + 37 (mutex.rs:57)
4   libwasmtime.dylib               0x000000010fc166a8 std::sys_common::mutex::Mutex::raw_lock::h0320f6f2d66d3b9a + 24 (mutex.rs:42)
5   libwasmtime.dylib               0x000000010fc0f8c6 std::sync::mutex::Mutex$LT$T$GT$::lock::h3ff867185c94d556 + 38 (mutex.rs:219)
6   libwasmtime.dylib               0x000000010fc1759c backtrace::lock::lock::h8fc4afef87bf4cdd + 108
7   libwasmtime.dylib               0x000000010fc190a9 backtrace::backtrace::trace::h2c442a445ec5d23c + 25 (mod.rs:52)
8   libwasmtime.dylib               0x000000010fc0ad67 backtrace::capture::Backtrace::create::h6478de780a3e1ffe + 103 (capture.rs:164)
9   libwasmtime.dylib               0x000000010fc0aceb backtrace::capture::Backtrace::new_unresolved::h6faba8f13d41d24f + 27
10  libwasmtime.dylib               0x000000010f53fbb5 wasmtime::trap::Trap::new::h1a9eabfc567a0830 + 85 (trap.rs:32)
11  libwasmtime.dylib               0x000000010f5a8cd5 wasm_trap_new + 357 (trap.rs:43)
12  ???                             0x00000001200ffd7d 0 + 4832886141
13  ???                             0x00000001200ff9c4 0 + 4832885188
14  ???                             0x00000001200ff516 0 + 4832883990
15  libcoreclr.dylib                0x000000010c6eaca9 UMThunkStub + 273
16  libwasmtime.dylib               0x000000010f58d7fd wasmtime::func::wasm_func_new::_$u7b$$u7b$closure$u7d$$u7d$::h04b26d3696b68533 + 45 (func.rs:113)
17  libwasmtime.dylib               0x000000010f58d38d wasmtime::func::create_function::_$u7b$$u7b$closure$u7d$$u7d$::habe73ec684983f10 + 461 (func.rs:90)
18  libwasmtime.dylib               0x000000010f5af954 wasmtime::func::Func::new::_$u7b$$u7b$closure$u7d$$u7d$::heef410f7add1b585 + 948 (func.rs:246)
19  libwasmtime.dylib               0x000000010f7c0420 _$LT$alloc..boxed..Box$LT$F$GT$$u20$as$u20$core..ops..function..Fn$LT$A$GT$$GT$::call::h99249d428e1cf153 + 48 (boxed.rs:1029)
20  libwasmtime.dylib               0x000000010f7ba438 wasmtime::trampoline::func::stub_fn::call_stub::h3340fb5f082687a0 + 184 (func.rs:79)
21  libwasmtime.dylib               0x000000010f7d5cc1 wasmtime::trampoline::func::stub_fn::_$u7b$$u7b$closure$u7d$$u7d$::h5226b3d450958191 + 49 (func.rs:50)
22  libwasmtime.dylib               0x000000010f7ab91d core::ops::function::FnOnce::call_once::h39eca28141925286 + 13
23  libwasmtime.dylib               0x000000010f798ae8 _$LT$std..panic..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$$LP$$RP$$GT$$GT$::call_once::hac4b47668d95477a + 40 (panic.rs:318)
24  libwasmtime.dylib               0x000000010f80638d std::panicking::try::do_call::h6e790f5863cd1626 + 77 (panicking.rs:305)
25  libwasmtime.dylib               0x00000001103e340b __rust_maybe_catch_panic + 27 (lib.rs:94)
26  libwasmtime.dylib               0x000000010f80627b std::panicking::try::he4c645adab2154a6 + 187 (panicking.rs:281)
27  libwasmtime.dylib               0x000000010f798b2f std::panic::catch_unwind::ha8510c644ad9f868 + 47
28  libwasmtime.dylib               0x000000010f7ba206 wasmtime::trampoline::func::stub_fn::hadd0620c40df928e + 118 (func.rs:49)
29  ???                             0x000000011198301d 0 + 4590153757
30  ???                             0x00000001119630ee 0 + 4590022894
31  ???                             0x00000001119632e4 0 + 4590023396
32  libwasmtime.dylib               0x000000010f7e68fa wasmtime::func::Func::call::_$u7b$$u7b$closure$u7d$$u7d$::hf0de02914dcebcf0 + 106 (func.rs:537)
33  libwasmtime.dylib               0x000000010f7be618 wasmtime_runtime::traphandlers::catch_traps::call_closure::ha8fe22ead980de5c + 24 (traphandlers.rs:397)
34  libwasmtime.dylib               0x000000010fc071b6 RegisterSetjmp + 118 (helpers.c:13)
35  libwasmtime.dylib               0x000000010f7be88d wasmtime_runtime::traphandlers::catch_traps::_$u7b$$u7b$closure$u7d$$u7d$::hd670f25e8930dd8e + 61 (traphandlers.rs:385)
36  libwasmtime.dylib               0x000000010f7bf678 wasmtime_runtime::traphandlers::CallThreadState::with::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::he43f22d21542f808 + 40 (traphandlers.rs:434)
37  libwasmtime.dylib               0x000000010f7fffa9 wasmtime_runtime::traphandlers::tls::set::_$u7b$$u7b$closure$u7d$$u7d$::h33448bea1c38356f + 89 (traphandlers.rs:592)
38  libwasmtime.dylib               0x000000010f7d20dd std::thread::local::LocalKey$LT$T$GT$::try_with::h5afbe2ebf53cd09f + 253 (local.rs:262)
39  libwasmtime.dylib               0x000000010f7d1e60 std::thread::local::LocalKey$LT$T$GT$::with::had9e0ec9e0efdafb + 48 (local.rs:239)
40  libwasmtime.dylib               0x000000010f7fff3c wasmtime_runtime::traphandlers::tls::set::h05ba0b7054f32ba0 + 60 (traphandlers.rs:590)
41  libwasmtime.dylib               0x000000010f7be9d3 wasmtime_runtime::traphandlers::CallThreadState::with::_$u7b$$u7b$closure$u7d$$u7d$::hd71ca41e35a2e24b + 195 (traphandlers.rs:434)
42  libwasmtime.dylib               0x000000010f8000fa wasmtime_runtime::traphandlers::tls::with::_$u7b$$u7b$closure$u7d$$u7d$::h7d32ba2acb06c7fe + 170 (traphandlers.rs:601)
43  libwasmtime.dylib               0x000000010f7d1f9b std::thread::local::LocalKey$LT$T$GT$::try_with::h527a0121f2d2ff09 + 251 (local.rs:262)
44  libwasmtime.dylib               0x000000010f7d1df7 std::thread::local::LocalKey$LT$T$GT$::with::h9ea0df510202099a + 55
45  libwasmtime.dylib               0x000000010f80003b wasmtime_runtime::traphandlers::tls::with::h50577ff01f6a129e + 59
46  libwasmtime.dylib               0x000000010f7be8d3 wasmtime_runtime::traphandlers::CallThreadState::with::h9708523a0125e9dd + 51 (traphandlers.rs:432)
47  libwasmtime.dylib               0x000000010f7be809 wasmtime_runtime::traphandlers::catch_traps::h03f0d10c4a1eecaa + 489 (traphandlers.rs:384)
48  libwasmtime.dylib               0x000000010f805259 wasmtime::func::Func::call::hf98f9e53dcf28bd1 + 1161 (func.rs:530)
49  libwasmtime.dylib               0x000000010f58d964 wasmtime::func::wasm_func_call::_$u7b$$u7b$closure$u7d$$u7d$::h35e240458febc54e + 84
50  libwasmtime.dylib               0x000000010f5411f0 core::ops::function::FnOnce::call_once::h6eac9b799daddc95 + 32 (function.rs:232)
51  libwasmtime.dylib               0x000000010f534934 _$LT$std..panic..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$$LP$$RP$$GT$$GT$::call_once::hbe2a7711d183cc27 + 36
52  libwasmtime.dylib               0x000000010f55b8be std::panicking::try::do_call::h0a237ef0c1d957b0 + 62 (panicking.rs:305)
53  libwasmtime.dylib               0x00000001103e340b __rust_maybe_catch_panic + 27 (lib.rs:94)
54  libwasmtime.dylib               0x000000010f55b78c std::panicking::try::h9e9a49438d44ff4b + 188 (panicking.rs:281)
55  libwasmtime.dylib               0x000000010f534964 std::panic::catch_unwind::habc0197a0168034f + 36
56  libwasmtime.dylib               0x000000010f59ca4d wasm_func_call + 477 (func.rs:178)
57  ???                             0x00000001200ff23b 0 + 4832883259
58  ???                             0x00000001200fee0b 0 + 4832882187
59  ???                             0x00000001200fea42 0 + 4832881218
60  ???                             0x000000011ce137ae 0 + 4779489198
61  ???                             0x000000011bd463eb 0 + 4761871339
62  ???                             0x00000001200fd6d2 0 + 4832876242
63  ???                             0x00000001200f8c50 0 + 4832857168
64  ???                             0x00000001200f8bc4 0 + 4832857028
65  ???                             0x00000001200f88a4 0 + 4832856228
66  ???                             0x00000001200fc81a 0 + 4832872474
67  libcoreclr.dylib                0x000000010c6e9c3b CallDescrWorkerInternal + 124
68  libcoreclr.dylib                0x000000010c5352a8 CallDescrWorkerWithHandler(CallDescrData*, int) + 104
69  libcoreclr.dylib                0x000000010c5f96df CallDescrWorkerReflectionWrapper(CallDescrData*, Frame*) + 127
70  libcoreclr.dylib                0x000000010c5fa667 RuntimeMethodHandle::InvokeMethod(Object*, PtrArray*, SignatureNative*, bool, bool) + 3143

</details>

view this post on Zulip Wasmtime GitHub notifications bot (Apr 08 2020 at 07:09):

alexcrichton commented on Issue #1431:

Hm that also looks pretty normal, are you sure that was the thread which crashed?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 08 2020 at 17:55):

havarnov commented on Issue #1431:

I don't know how I manage to mess this up every time :/

I run dotnet test --filter ItThrowsOnOutOfBoundsMemoryAccess.

It has three different outcomes:

  1. test pass
  2. test process hangs
  3. test process crashes (with the provided report)

Crashed thread stack trace:
<details>

Thread 18 Crashed:
0   libwasmtime.dylib               0x0000000113b856b9 __rbt_macho_add_symtab + 1353
1   libwasmtime.dylib               0x0000000113b84740 __rbt_macho_add + 1920
2   libwasmtime.dylib               0x0000000113b83e31 __rbt_backtrace_initialize + 337
3   libwasmtime.dylib               0x0000000113b834ef fileline_initialize + 735
4   libwasmtime.dylib               0x0000000113b835ed __rbt_backtrace_syminfo + 45
5   libwasmtime.dylib               0x0000000113b6f4df backtrace::symbolize::libbacktrace::resolve::h719e8a9f1adb8fe1 + 159 (libbacktrace.rs:469)
6   libwasmtime.dylib               0x0000000113b72ab8 backtrace::symbolize::resolve_frame_unsynchronized::h7ca357de7ff98157 + 56 (mod.rs:178)
7   libwasmtime.dylib               0x0000000113b728f0 backtrace::symbolize::resolve_frame::h75c5abc2a861fa2d + 80 (mod.rs:105)
8   libwasmtime.dylib               0x0000000113b6b13c backtrace::capture::Backtrace::resolve::he887e05906dda0c3 + 348 (capture.rs:219)
9   libwasmtime.dylib               0x0000000113b6ac8c backtrace::capture::Backtrace::new::hde48dbbe07c85c38 + 60 (capture.rs:129)
10  libwasmtime.dylib               0x0000000113b3cfd0 wasmtime_runtime::traphandlers::Trap::wasm::h1cad6bcb8cc876a1 + 64 (traphandlers.rs:360)
11  libwasmtime.dylib               0x0000000113b55532 wasmtime_runtime::instance::initialize_memories::hd1e791bdc211efcb + 514 (instance.rs:1326)
12  libwasmtime.dylib               0x0000000113b52d91 wasmtime_runtime::instance::InstanceHandle::new::h7ed6837db8af70f4 + 6369 (instance.rs:978)
13  libwasmtime.dylib               0x00000001138b2895 wasmtime_jit::instantiate::CompiledModule::instantiate::h4ab8e22914e45208 + 1237 (instantiate.rs:216)
14  libwasmtime.dylib               0x00000001136feed6 wasmtime::instance::instantiate::hf4f7fd3334ac0a8b + 150 (instance.rs:29)
15  libwasmtime.dylib               0x00000001136ff296 wasmtime::instance::Instance::new::h724eb3a5b0218b1a + 598 (instance.rs:128)
16  libwasmtime.dylib               0x00000001136f755e wasmtime::linker::Linker::instantiate::h55a563d6e112071b + 2878 (linker.rs:395)
17  libwasmtime.dylib               0x00000001134ff6c4 wasmtime_linker_instantiate + 132 (linker.rs:85)
18  ???                             0x000000011be0093e 0 + 4762634558
19  ???                             0x000000011be003b2 0 + 4762633138
20  ???                             0x000000011be002ef 0 + 4762632943
21  ???                             0x000000011be00143 0 + 4762632515
22  ???                             0x000000011be00070 0 + 4762632304
23  ???                             0x000000011bdfffe4 0 + 4762632164
24  ???                             0x000000011bdff3f4 0 + 4762629108
25  ???                             0x000000011bdfdcc3 0 + 4762623171
26  libcoreclr.dylib                0x0000000110429c3b CallDescrWorkerInternal + 124
27  libcoreclr.dylib                0x00000001102752a8 CallDescrWorkerWithHandler(CallDescrData*, int) + 104
28  libcoreclr.dylib                0x00000001103396df CallDescrWorkerReflectionWrapper(CallDescrData*, Frame*) + 127
29  libcoreclr.dylib                0x000000011033a667 RuntimeMethodHandle::InvokeMethod(Object*, PtrArray*, SignatureNative*, bool, bool) + 3143
30  ???                             0x0000000116a6750a 0 + 4674974986
31  ???                             0x0000000116a618a9 0 + 4674951337
32  ???                             0x000000011bdfdb89 0 + 4762622857
33  ???                             0x000000011bdfd799 0 + 4762621849
34  ???                             0x000000011bdfcd46 0 + 4762619206
35  ???                             0x000000011bdfcc65 0 + 4762618981
36  ???                             0x000000011bdfcbe0 0 + 4762618848
37  ???                             0x000000011bdfc999 0 + 4762618265
38  ???                             0x000000011bdfc863 0 + 4762617955
39  ???                             0x000000011bdfc7bb 0 + 4762617787
40  ???                             0x000000011bdfc76c 0 + 4762617708
41  ???                             0x000000011bdfc6d5 0 + 4762617557
42  ???                             0x000000011bdfc47d 0 + 4762616957
43  ???                             0x000000011bdfc363 0 + 4762616675
44  ???                             0x000000011bdfc2bb 0 + 4762616507
45  ???                             0x000000011bdfc26c 0 + 4762616428
46  ???                             0x000000011bdfbd16 0 + 4762615062
47  ???                             0x000000011bdfb5e6 0 + 4762613222
48  ???                             0x000000011bdfb505 0 + 4762612997
49  ???                             0x000000011bdfb480 0 + 4762612864
50  ???                             0x000000011bdfb292 0 + 4762612370
51  ???                             0x000000011bdf9c39 0 + 4762606649
52  ???                             0x000000011bdf9356 0 + 4762604374
53  ???                             0x000000011bdf9275 0 + 4762604149
54  ???                             0x000000011bdf91f0 0 + 4762604016
55  ???                             0x000000011bdf8f85 0 + 4762603397
56  ???                             0x000000011bdf8e53 0 + 4762603091
57  ???                             0x000000011bdf8dab 0 + 4762602923
58  ???                             0x000000011bdf8d1c 0 + 4762602780
59  ???                             0x000000011bdf8c5e 0 + 4762602590
60  ???                             0x000000011bdf85ae 0 + 4762600878
61  ???                             0x000000011bdf82a5 0 + 4762600101
62  ???                             0x000000011bdf8103 0 + 4762599683
63  ???                             0x000000011bdf805f 0 + 4762599519
64  ???                             0x000000011bdf8000 0 + 4762599424
65  ???                             0x000000011bdf7b5a 0 + 4762598234
66  ???                             0x000000011bdf781e 0 + 4762597406
67  ???                             0x000000011bdf7506 0 + 4762596614
68  ???                             0x000000011bdf7425 0 + 4762596389
69  ???                             0x000000011bdf7368 0 + 4762596200
70  ???                             0x000000011bdf6b02 0 + 4762594050
71  ???                             0x000000011bdf6276 0 + 4762591862
72  ???                             0x000000011bdf6195 0 + 4762591637
73  ???                             0x000000011bdf60fa 0 + 4762591482
74  ???                             0x000000011bdf49d1 0 + 4762585553
75  ???                             0x000000011bdf404c 0 + 4762583116
76  ???                             0x000000011bdf3d16 0 + 4762582294
77  ???                             0x000000011bdf3c35 0 + 4762582069
78  ???                             0x000000011bdf3b9a 0 + 4762581914
79  ???                             0x000000011bdf3783 0 + 4762580867
80  ???                             0x000000011bdf3636 0 + 4762580534
81  ???                             0x000000011bdf327a 0 + 4762579578
82  ???                             0x000000011bdf2c66 0 + 4762578022
83  ???                             0x000000011bdf2b85 0 + 4762577797
84  ???                             0x000000011bdf2aea 0 + 4762577642
85  ???                             0x000000011bdf244d 0 + 4762575949
86  ???                             0x000000011bdf21e6 0 + 4762575334
87  ???                             0x000000011bdf2105 0 + 4762575109
88  ???                             0x000000011bdf206a 0 + 4762574954
89  ???                             0x000000011bdf1c2e 0 + 4762573870
90  ???                             0x000000011bdf028c 0 + 4762567308
91  ???                             0x000000011bdefec6 0 + 4762566342
92  ???                             0x000000011bdefde5 0 + 4762566117
93  ???                             0x000000011bdefd4a 0 + 4762565962
94  ???                             0x000000011bde90ef 0 + 4762538223
95  ???                             0x000000011bde8976 0 + 4762536310
96  ???                             0x000000011bde8895 0 + 4762536085
97  ???                             0x000000011bde87fa 0 + 4762535930
98  ???                             0x000000011bde82c7 0 + 4762534599
99  ???                             0x000000011bde7c4b 0 + 4762532939
100 ???                             0x000000011bde78f6 0 + 4762532086
101 ???                             0x000000011bde7815 0 + 4762531861
102 ???                             0x000000011bde737a 0 + 4762530682
103 ???                             0x000000011bde5ba0 0 + 4762524576
104 ???                             0x000000011bde5836 0 + 4762523702
105 ???                             0x000000011bde5755 0 + 4762523477
106 ???                             0x000000011bde52ba 0 + 4762522298
107 ???                             0x000000011bde4dfc 0 + 4762521084
108 ???                             0x000000011bde4d10 0 + 4762520848
109 ???                             0x00000001169ed4f1 0 + 4674475249
110 ???                             0x00000001169fa1e2 0 + 4674527714
111 ???                             0x00000001169deba1 0 + 4674415521
112 ???                             0x00000001169f4642 0 + 4674504258
113 ???                             0x00000001169f43de 0 + 4674503646
114 ???                             0x0000000116a00c19 0 + 4674554905
115 ???                             0x000000011bde4be3 0 + 4762520547
116 ???                             0x00000001169deba1 0 + 4674415521
117 ???                             0x000000011bde4b62 0 + 4762520418
118 ???                             0x000000011bde1faa 0 + 4762509226
119 ???
[message truncated]

view this post on Zulip Wasmtime GitHub notifications bot (Apr 08 2020 at 19:33):

alexcrichton commented on Issue #1431:

@havarnov ok that definitely looks like a bug! I don't think it's the same issue as before though because it doesn't look like there's any wasm code on the stack. This may perhaps mean there's a bug in the backtrace crate or we're generating invalid debuginfo or something like that.

Would it be possible to reduce this to a small thing that can be reproduced locally?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 09 2020 at 05:22):

havarnov commented on Issue #1431:

@alexcrichton not sure what you mean about a "small thing"? Isn't the test I provided ok for testing? Or were you thinking of a small console application?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 10 2020 at 18:29):

alexcrichton commented on Issue #1431:

Hm so ideally we could get a reproduction with just the Rust API. Failing that a reproduction with just the C API would be great. Failing that a reproduction with a small example in the dotnet API would be great too. The dotnet extension has moved around a bit and it looks like the test mentioned here has either been renamed or no longer exists. Would it be possible to help reduce this to something standalone which can be reproduced today?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 11 2020 at 09:53):

havarnov commented on Issue #1431:

@alexcrichton I'll look into reproducing this bug in rust or the c api. The test I refered to was one I created in my fork of this repo, https://github.com/havarnov/wasmtime/tree/outofboundsmemoryaccess. That's why I asked if you wanted a PR with the new test.

I'll come back when I have something more to show, or I need more help. Ok?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 11 2020 at 20:45):

havarnov commented on Issue #1431:

@alexcrichton I need some help on this one. I'm trying to reproduce this by using the wasmtime api directly as follows, which to the best of my knowledge mimics the test I've written from the dotnet side.

#[test]
fn outofbounds_memory() -> Result<()> {
    let store = Store::default();
    let mut linker = Linker::new(&store);
    let ty = MemoryType::new(Limits::new(1, Some(1)));
    let memory = Memory::new(&store, ty);
    let linker = linker.define("", "mem", memory).expect("Should be able to define memory item.");

    let wat = r#"
        (module
            (import "" "mem" (memory $m 1 2))
            (data (i32.const 65535) "\01")
            (data (i32.const 65536) "\02")
        )
    "#;

    let module = Module::new(&store, wat)?;
    let trap= linker.instantiate(&module)
        .err()
        .unwrap()
        .downcast::<Trap>()
        .unwrap();
    assert_eq!(
        trap.message(),
        "wasm trap: out of bounds memory access, source location: @-"
    );

    Ok(())
}

As you can see I'm expecting this to be "trapped" with the "out of bounds memory access" message. This is after all what I'm seeing from the dotnet side of things when the test _does_ pass. But what I'm getting is a linker error from linker.instantiate:

Failed to link module

Caused by:
    Link error: memory out of bounds: data segment does not fit

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2020 at 14:42):

alexcrichton commented on Issue #1431:

I believe that's the expected error from that test. I don't really know much about C# testing, but you've got two tests defined in that file, is it possible that they're sharing access to the same linker by accident?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2020 at 18:27):

peterhuene commented on Issue #1431:

The ClearDefinitions call should instantiate a new linker between the different test executions, I believe (iirc my xUnit semantics correctly, at least).

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2020 at 18:28):

peterhuene edited a comment on Issue #1431:

The ClearDefinitions call should instantiate a new linker between the different test executions, I believe (iirc xUnit semantics correctly, at least).

Although, reusing the definitions seems like the probable cause of the failure.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2020 at 18:28):

peterhuene edited a comment on Issue #1431:

The ClearDefinitions call should instantiate a new linker between the different test executions, I believe (iirc xUnit semantics correctly, at least).

Although, reusing the definitions seems like the probable cause of the failure. I can look into this.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 13 2020 at 19:08):

peterhuene commented on Issue #1431:

I'm not able to reproduce the failure of either of those two tests (both pass as-is).

I verified that ClearDefinitions is called for each test run, so a linker should not be shared between the runs.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2020 at 17:38):

havarnov commented on Issue #1431:

@peterhuene interesting that it does fail on your machine. Just so there's no misunderstandings, it's the test name ItThrowsOnOutOfBoundsMemoryAccess that's inconsistently passes.

I will try to get the "wasm trap: out of bounds memory access, source location: @-" trap message from my rust test aswell, and see if that's working consistently.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2020 at 18:26):

havarnov commented on Issue #1431:

I think I have pinpointed this a bit more. The ModuleFixture in the dotnet test builds the Host as follows:

        public ModuleFixture()
        {
            Host = new HostBuilder()
                .WithMultiValue(true)
                .WithReferenceTypes(true)
                .Build();

            Module = Host.LoadModuleText(Path.Combine("Modules", ModuleFileName));
        }

If I comment out .WithReferenceTypes(true) the test now fails consistently with the following error message:

Error Message:
   Expected exception message to match the equivalent of
"wasm trap: out of bounds memory access, source location: @-", but
"Failed to link module

Caused by:
    Link error: memory out of bounds: data segment does not fit" does not.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2020 at 18:28):

havarnov edited a comment on Issue #1431:

I think I have pinpointed this a bit more. The ModuleFixture in the dotnet test builds the Host as follows:

        public ModuleFixture()
        {
            Host = new HostBuilder()
                .WithMultiValue(true)
                .WithReferenceTypes(true)
                .Build();

            Module = Host.LoadModuleText(Path.Combine("Modules", ModuleFileName));
        }

EDIT: but to investigate this further I need some help from you guys; @alexcrichton @peterhuene

If I comment out .WithReferenceTypes(true) the test now fails consistently with the following error message:

Error Message:
   Expected exception message to match the equivalent of
"wasm trap: out of bounds memory access, source location: @-", but
"Failed to link module

Caused by:
    Link error: memory out of bounds: data segment does not fit" does not.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2020 at 21:01):

peterhuene commented on Issue #1431:

@havarnov that's correct, the ItThrowsOnOutOfBoundsMemoryAccess test consistently passes for me. I reran the tests 100 times and they all succeeded.

My steps to reproduce:

  1. git clone git@github.com:bytecodealliance/wasmtime-dotnet.git
  2. cd wasmtime-dotnet
  3. I created tests/OutOfBoundsMemoryAccessTests.cs with the contents of this file.
  4. I created tests/Modules/OutOfBoundsMemoryAccess.wat with the contents of this file.
  5. dotnet test in a loop 100 times, breaking if failure.

All test runs were successful.

I'll see if I can reproduce it with your older wasmtime-based branch.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2020 at 21:04):

peterhuene commented on Issue #1431:

However, I was able to reproduce the link error if support for reference types is disabled.

   Expected a <Wasmtime.TrapException> to be thrown, but found <Wasmtime.WasmtimeException>: "
"Wasmtime.WasmtimeException with message "Failed to link module

Caused by:
    Link error: memory out of bounds: data segment does not fit

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2020 at 21:06):

peterhuene commented on Issue #1431:

It appears to be a link-time error without reference types enabled by design.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 14 2020 at 21:10):

peterhuene edited a comment on Issue #1431:

It appears to be a link-time error without reference types enabled by design.

This is because the reference types feature implicitly enables the bulk-memory feature. Without it, you'll get the linker error.


Last updated: Dec 23 2024 at 12:05 UTC