Closed Bug 1482365 Opened 6 years ago Closed 6 years ago

Crashing testcase in compiled code with anyref

Categories

(Core :: JavaScript: WebAssembly, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: bbouvier, Assigned: bbouvier)

References

Details

Attachments

(1 file)

On x64:

exports = wasmEvalText(`(module
    (global (mut anyref) (ref.null anyref))
    (func (export "f")
        get_global 0
        ref.null anyref
        set_global 0
        set_global 0
    )
)`).exports;

exports.f();
Attached patch fix.patchSplinter Review
Assignee: nobody → bbouvier
Status: NEW → ASSIGNED
Attachment #8999145 - Flags: review?(lhansen)
Comment on attachment 8999145 [details] [diff] [review]
fix.patch

Review of attachment 8999145 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/wasm/WasmBaselineCompile.cpp
@@ +5670,5 @@
>      void emitPostBarrier(const Maybe<RegPtr>& object, RegPtr otherScratch, RegPtr valueAddr, RegPtr setValue) {
>          Label skipBarrier;
>  
> +        // One of the branch (in case we need the C++ call) will cause a sync,
> +        // so ensure the stack is sync'd before, so as the join is sync'd too.

oh my god, me can't speak English.

branch => branches
so as => so that
Comment on attachment 8999145 [details] [diff] [review]
fix.patch

Review of attachment 8999145 [details] [diff] [review]:
-----------------------------------------------------------------

OK.  This footgun is super annoying, I'm thinking of maybe requiring some AutoThing to be passed to emitInstanceCall to at least flag it.  "AutoDidYouRememberToSyncAlongAllBranches", maybe.
Attachment #8999145 - Flags: review?(lhansen) → review+
Pushed by bbouvier@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/e574b6c899c1
Sync stack before branching in wasm baseline compiler's emitSetGlobal; r=lth
https://hg.mozilla.org/mozilla-central/rev/e574b6c899c1
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: