Closed Bug 1742576 Opened 2 years ago Closed 2 years ago

Crash [@ js::wasm::Instance::structNew(js::wasm::Instance*, void*)]

Categories

(Core :: JavaScript: WebAssembly, defect, P2)

x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox94 --- unaffected
firefox95 --- unaffected
firefox96 --- fixed

People

(Reporter: decoder, Assigned: rhunt)

Details

(Keywords: crash, regression, testcase, Whiteboard: [bugmon:update,bisect])

Crash Data

Attachments

(4 files)

The following testcase crashes on mozilla-central revision 20211123-71332992f78f (debug build, run with --fuzzing-safe --ion-offthread-compile=off --wasm-function-references --wasm-gc):

function processWat(c) {
    binary = wasmTextToBinary(c)
    d = new WebAssembly.Module(binary)
    return new WebAssembly.Instance(d)
}
gczeal(14,10)
let { createA } = processWat(`
  (module (type $a (struct))
    (global $e (rtt $a) rtt.canon $a)
    (func
      (export "createA")
      (result eqref)
      global.get $e
      struct.new_with_rtt $a
    ))
`).exports;
createA();

Backtrace:

received signal SIGSEGV, Segmentation fault.
#0  0x0000555557ce2e8a in js::wasm::Instance::structNew(js::wasm::Instance*, void*) ()
#1  0x0000254410abb613 in ?? ()
[...]
#10 0x0000000000000000 in ?? ()
rax	0x33a828900000	56797328048128
rbx	0x33a828975000	56797328527360
rcx	0x7fffffffbe01	140737488338433
rdx	0x1	1
rsi	0x33a828975078	56797328527480
rdi	0x7ffff6047200	140737320874496
rbp	0x7fffffffb950	140737488337232
rsp	0x7fffffffb920	140737488337184
r8	0xffffd55555908c78	-46912492237704
r9	0xffffd55555908c68	-46912492237720
r10	0x7fffffffbad0	140737488337616
r11	0x7ffff6071670	140737321047664
r12	0x7fffffffb9d8	140737488337368
r13	0x7ffff4a8a0a8	140737298079912
r14	0x7ffff6071670	140737321047664
r15	0x0	0
rip	0x555557ce2e8a <js::wasm::Instance::structNew(js::wasm::Instance*, void*)+122>
=> 0x555557ce2e8a <_ZN2js4wasm8Instance9structNewEPS1_Pv+122>:	cmpq   $0x0,0x8(%rbx)
   0x555557ce2e8f <_ZN2js4wasm8Instance9structNewEPS1_Pv+127>:	je     0x555557ce2ee2 <_ZN2js4wasm8Instance9structNewEPS1_Pv+210>

This requires wasm struct types to be enabled, which is pref'ed off right now.

Attached file Testcase
Assignee: nobody → rhunt
Status: NEW → ASSIGNED
Priority: -- → P2

Bugmon Analysis
Unable to reproduce bug 1742576 using build mozilla-central 20211123094249-71332992f78f. Without a baseline, bugmon is unable to analyze this bug.
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.

Keywords: bugmon

This line needs an assertion for why we can skip a barrier.

Currently ValType::isReference checks if the type is a wasm ref type. This
does not include rtt types, as those are just plain value types. However
both ref types and rtt types are represented at runtime as references.

Some checks using isReference want to detect ref-types, while some want
to check for the runtime representation. This commit splits isReference
into isRef and isRefRepr for detecting these two different conditions.
Code is updated to use the appropriate condition.

Depends on D132085

This is not security sensitive as the issue is only in wasm-GC code which is disabled by default.

Group: javascript-core-security → core-security-release
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch

:rhunt, since this bug contains a bisection range, could you fill (if possible) the regressed_by field?
For more information, please visit auto_nag documentation.

Flags: needinfo?(rhunt)
Flags: needinfo?(rhunt)
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: