Don't generate wasm traps if load/store is outside reserved guard regions
Categories
(Core :: JavaScript: WebAssembly, task, P3)
Tracking
()
People
(Reporter: rhunt, Assigned: rhunt)
References
Details
(Keywords: perf-alert, sec-other, Whiteboard: [adv-main152-])
Attachments
(1 external file)
The wasm signal handler only checks if a faulting instruction is:
- in wasm code
- at an intentionally marked 'TrapSite' PC
So if we have a wasm load/store that somehow accesses memory outside of the reserved wasm memory and hits an access violation, we convert that into wasm trap. This obscures real bugs and prevents fuzzers from finding them.
We should see if we can use the effective address to filter out bad loads. One difficult part of this is that we need to somehow find the valid regions of wasm memory. I think we could use the wasm::Instance and iterate over the wasm memory objects. Wasm-GC would be harder, so probably won't start with that.
The other difficult part is getting the effective address. We have 3 cases:
- Win32 VectoredExceptionHandling - ExceptionInfo->ExceptionRecord->ExceptionInformation[1] holds the effective address
- Mach Exception Handlers - [1] request.body.code[1]
- POSIX signals - si_addr holds the address [2]
[1] https://searchfox.org/firefox-main/rev/5917a9f2af3294b27a325371c5c499e7dd9554fd/js/src/wasm/WasmSignalHandlers.cpp#617
[2] https://man7.org/linux/man-pages/man2/sigaction.2.html
| Assignee | ||
Comment 1•7 months ago
|
||
| Assignee | ||
Comment 2•7 months ago
|
||
The patch fixes this and also bug 1818639. I need to test it more, and on other platforms before requesting review.
Updated•7 months ago
|
Comment 4•6 months ago
|
||
Updated•6 months ago
|
Comment 5•6 months ago
|
||
(In reply to Sebastian Hengst [:aryx] (needinfo me if it's about an intermittent or backout) from comment #4)
Perfherder has detected a browsertime performance change from push 07dc477b4b4841f21501709ee46a3194716ec9e4.
No action is required from the author; this comment is provided for informational purposes only.
| Improvement | Test | Platform | Options | Absolute values [old vs new] | Performance Profiles |
|---|---|---|---|---|---|
| 5% | jetstream3 cdjs-Average (doc) | macosx1500-aarch64-shippable | fission webrender | 27.38 ms -> 25.94 ms |
Need Help or Information?
If you have any questions, please reach out to fbilt@mozilla.com. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.
Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Updated•1 month ago
|
Description
•