Closed Bug 1939744 Opened 8 months ago Closed 8 months ago

wasm: missing `ReportOutOfMemory(cx)` call in Module::instantiateMemories

Categories

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

All
Linux
defect

Tracking

()

RESOLVED FIXED
136 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr128 --- unaffected
firefox133 --- wontfix
firefox134 --- wontfix
firefox135 --- wontfix
firefox136 --- fixed

People

(Reporter: gkw, Assigned: jseward)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression, reporter-external, testcase)

Attachments

(2 files)

Attached file debug stack
oomTest(function () {
  new WebAssembly.Instance(
    new WebAssembly.Module(wasmTextToBinary("(memory i64 0)")),
  );
});
(gdb) bt
#0  AssertExceptionResult (cx=0x7ffff6936200) at /home/i32g7900a/trees/mozilla-central/js/src/vm/Interpreter.cpp:439
#1  CallJSNative (cx=cx@entry=0x7ffff6936200, native=native@entry=0x5555587bbe10 <js::WasmInstanceObject::construct(JSContext*, unsigned int, JS::Value*)>,
    reason=reason@entry=js::CallReason::Call, args=...) at /home/i32g7900a/trees/mozilla-central/js/src/vm/Interpreter.cpp:537
#2  0x00005555572f56ad in CallJSNativeConstructor (cx=cx@entry=0x7ffff6936200,
    native=0x5555587bbe10 <js::WasmInstanceObject::construct(JSContext*, unsigned int, JS::Value*)>, args=...)
    at /home/i32g7900a/trees/mozilla-central/js/src/vm/Interpreter.cpp:550
#3  0x00005555572c5580 in InternalConstruct (cx=0x7ffff6936200, args=..., reason=js::CallReason::Call)
    at /home/i32g7900a/trees/mozilla-central/js/src/vm/Interpreter.cpp:756
#4  0x00005555572c4f6d in js::ConstructFromStack (cx=0x7ffff7a1ca60 <_IO_stdfile_2_lock>, cx@entry=0x7ffff6936200, args=..., reason=4154570531,
    reason@entry=js::CallReason::Call) at /home/i32g7900a/trees/mozilla-central/js/src/vm/Interpreter.cpp:803
#5  0x0000555557f011d9 in js::jit::DoCallFallback (cx=0x7ffff6936200, frame=0x7fffffffc2b8, stub=0x7ffff5ec9318, argc=1, vp=0x7fffffffc258, res=...)
    at /home/i32g7900a/trees/mozilla-central/js/src/jit/BaselineIC.cpp:1682
#6  0x000034a9d7eb8e0f in ?? ()
The first bad revision is:
changeset:   https://hg.mozilla.org/mozilla-central/rev/51e1654a1144
user:        Julian Seward
date:        Wed Oct 23 13:33:00 2024 +0000
summary:     Bug 1921216 - wasm speculative inlining: track multiple targets per call-ref callsite.  r=rhunt.

Run with --fuzzing-safe --no-threads --no-baseline --no-ion --cache-ir-stubs=off, compile with AR=ar sh ../configure --enable-debug --enable-debug-symbols --with-ccache --enable-nspr-build --enable-ctypes --enable-gczeal --enable-rust-simd --disable-tests, tested on m-c rev 27f9f8e7311a.

Setting s-s just in case. Julian, is bug 1921216 a likely regressor?

Flags: sec-bounty?
Flags: needinfo?(jseward)

Set release status flags based on info from the regressing bug 1921216

Group: core-security → javascript-core-security
Assignee: nobody → jseward
Severity: -- → S3
Flags: needinfo?(jseward)
Priority: -- → P3
Regressed by: wasm-multi-memory
No longer regressed by: 1921216

In Module::instantiateMemories, we append a WasmMemoryObject* to a vector
thereof, and propagate failure of the append, but we don't do
ReportOutOfMemory(cx) in case of failure.

I think this should be declassified. There's an OOM, we handle it correctly;
the only deficiency is that the OOM is not reported to the JSContext.

I agree that's not security sensitive.

Group: javascript-core-security
Summary: Assertion failure: cx->isExceptionPending() || cx->isPropagatingForcedReturn() || cx->hadUncatchableException(), at vm/Interpreter.cpp:440 → wasm: missing `ReportOutOfMemory(cx)` call in Module::instantiateMemories

In Module::instantiateMemories, we append a WasmMemoryObject* to a vector
thereof, and propagate failure of the append, but we don't do
ReportOutOfMemory(cx) in case of failure.

Pushed by jseward@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c903c46600c1 wasm: missing `ReportOutOfMemory(cx)` call in Module::instantiateMemories. r=bvisness.
Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 136 Branch
Flags: sec-bounty? → sec-bounty-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: