Closed Bug 1817782 Opened 3 years ago Closed 3 years ago

Kotlin example crashes with Wasm GC

Categories

(Core :: JavaScript: WebAssembly, defect)

Firefox 112
defect

Tracking

()

RESOLVED FIXED
112 Branch
Tracking Status
firefox112 --- fixed

People

(Reporter: bashorov, Assigned: rhunt)

References

Details

Attachments

(3 files)

Attached file dbmonster.zip

Steps to reproduce:

  1. Unzip an attached zip
  2. Start a server to serve files from the dir, like python -m http.server
  3. Open in the Firefox Nightly 112.0a1 (2023-02-20) (64-bit)

Actual results:

Got "Gah. Your tab just crashed."

Expected results:

It works and shows something like http://webreflection.github.io/dbmonster/

The Bugbug bot thinks this bug should belong to the 'Firefox::Tabbed Browser' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Tabbed Browser

There is at least one issue here where we're performing a cast on a non-WasmGcObject which is causing a crash. I have a fix for that, but it uncovered another issue I'm looking into.

Assignee: nobody → rhunt
Summary: The tab is crashed → Kotlin example crashes with Wasm GC

The casting instructions currently assume that the input anyref is
just a WasmGcObject (either struct or array). However any JS Value
can become an anyref through extern.internalize. These values do
not have a typedef field and must checked for while casting.

This adds extra bloat to our casting instructions that we should
find a way to remove. Two options:

  1. Move the typedef from the object to the shape. This would
    add an extra indirection to casting though.
  2. Box non-WasmGcObject's in a WasmStructObject when extern.
    internalize is called.

Values that are used for a branch in baseline cannot be allocated
in the integer result registers as those will be used for transmitting
results to the next block.

There are two tweaks in br_on_cast needed:

  1. Stop pushing the object to the value stack but still using it in the
    branch code, as that violates the baseline invariants which assume that
    any register on the value stack can be sync'ed and then used for a
    different purpose.
  2. Ensure we don't allocate any registers to the result registers while
    we're setting up the branch.

Depends on D170708

Component: Tabbed Browser → JavaScript: WebAssembly
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Ever confirmed: true
Pushed by rhunt@eqrion.net: https://hg.mozilla.org/integration/autoland/rev/880728840fdd wasm: Test that we're only casting WasmGcObject. r=jseward https://hg.mozilla.org/integration/autoland/rev/6457eabafda2 wasm: Fix register allocation of br_on_cast in baseline. r=jseward https://hg.mozilla.org/integration/autoland/rev/b2905862fca3 apply code formatting via Lando

It might be that the backout was caused by bug 1819351 [the command-line-parsing bug]
not having landed before this one? Just guessing.

Ah, the test uses a SIMD type and that's not supported on ARM32.

Flags: needinfo?(rhunt)
Pushed by rhunt@eqrion.net: https://hg.mozilla.org/integration/autoland/rev/6e74a9817cbf wasm: Test that we're only casting WasmGcObject. r=jseward https://hg.mozilla.org/integration/autoland/rev/d3d9e99c352a wasm: Fix register allocation of br_on_cast in baseline. r=jseward
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch
See Also: → 1809647
Blocks: 1809647
See Also: 1809647
Regressions: CVE-2024-2606
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: