Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAccess violation when backtracing a JS error on the Hololens 2 #27045
Comments
|
I have not been able to reproduce this in a desktop UWP build yet. I realize this was mentioned, but I like to verify that the easiest setup doesn't work. |
|
The next useful step here is probably to do a build with |
|
I have reproduced this on device with a debugmozjs build. |
|
The backtrace I see ends up in the guts of the mozilla::Variant type, which is the underlying type of JS::StackCapture which is passed to JS::CaptureCurrentStack (called from https://github.com/servo/rust-mozjs/blob/28248e1d6658e92dd5ecb0866e53a97f043b9b38/src/rust.rs#L1337). Since the C++ API uses rvalue references, I suspect there's some surprising FFI miscompilation for arm64 going on. |
|
Confirmed - when I move the call to JS::CaptureCurrentStack into the C++ glue so we don't need to pass an rvalue reference from Rust code, the crash disappears. |
|
Disassembly calling from c++:
disassembly calling from rust:
|
|
Oh, JS_CaptureStack_AllFrames is already a C++ glue function, so here's that disassembly as well. That means that we're returning a mozilla::Variant by value to Rust code right now, then passing it by rvalue reference to C++:
|
Details
With this patch applied, it appears that there is some sort of crash that occurs on Windows ARM64 devices when an exception triggers the
js_backtracebuild feature. (Hololens 2)It happens as the result of attempting to get a JS stacktrace via the
capture_stackmacro.The actual crash is an access violation due attempting to write to
NULL. The code is specified in mozjs here. I believe it is likely that this crash is actually caused by a failed assertion, but there were no debug logs indicating such so I am unaware as to what the assertion may be.The stack trace indicates that
mozjs::js::SavedStacks::insertFrames()is the culprit, and some tracing seems to indicate that this assertion is failing. Maybe some program counter is not getting set or maybe there's some race condition? I'm not sure but it seems like an issue with mozjs.I tried builds on MacOS, the Hololens 2 emulator, and Hololens 2, but it only crashed on the Hololens 2. This may be an indication of an issue specific to ARM64.
Reproduction steps:
C:\Python27\python.exe mach build -d --uwp --win-arm64 --features js_backtraceDefaultUrl.hto"http://yeticgi.casualos.com/?story=test1&pagePortal=home".DEVELOPERS.mdif you do.SavedStacks.cpp.Extra details:
Error message:
Unfortunately, this is the extent of the error message that was written to the debug log.
The full debug log is available below.
Stack Trace:
This is the full stack trace that was available in Visual Studio at the time that the exception was created.
Full log