-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Avoid using WasmOffsetConverter when Module.instantiateWasm #13425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/preamble.js
Outdated
return 'unknown-due-to-instantiateWasm'; | ||
} | ||
}; | ||
{{{ runOnMainThread("removeRunDependency('offset-converter');") }}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this effect threaded programs? IIRC we use instantiateWasm in worker.js to inject the module on pthreads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't affect them, as we send workers the offset data. But I refactored this to do the new work only on the main thread, which is clearer I think.
|
No, we need the binary. The conversion is of binary offsets to function names. (And neither the module nor the instance have a reference to the binary, for VM efficiency reasons.) |
I see, makes sense. Change looks good then! What about making |
@pfaffe That's possible, but the method already has one optional param, and I'm hoping to avoid complexity here. I'd prefer to focus on figuring out ways for users to not need instantiateWasm in the first place, too. |
Yeah I'm not super happy with that API either. We could avoid |
That's not accurate - the browser should help caching the wasm module's compiled code. Unless I'm not understanding what you mean by "cache the module"? (In general, if there was something to cache at the user level, emscripten should do it. But the policy is that users should not cache modules, and rely on the browser.) cc @billbudge |
Module.instantiateWasm is a callback the user provides, and then the user is
in change of fetching and instantiating the wasm. In that code path emscripten
never sees the wasm binary, which means we cannot create a
WasmOffsetConverter.
With this PR we will not hang on startup, and we will still detect problems, but
the sanitizer's own stack traces will mark function names as "unknown". That will
limit the santizer's usefulness, but they do still detect errors, and the browser's
own stack traces may be enough to diagnose things.
Fixes #13424
cc @pfaffe