Closed Bug 1689503 Opened 3 years ago Closed 3 years ago

Crash in [@ js::ArrayBufferObject::addSizeOfExcludingThis]

Categories

(Core :: JavaScript Engine, defect, P1)

Unspecified
Windows 10
defect

Tracking

()

RESOLVED FIXED
87 Branch
Tracking Status
firefox-esr78 --- fixed
firefox85 --- wontfix
firefox86 --- wontfix
firefox87 --- fixed

People

(Reporter: mccr8, Assigned: mgaudet)

References

Details

(Keywords: crash)

Crash Data

Attachments

(2 files)

Maybe Fission related. (DOMFissionEnabled=1)

Crash report: https://crash-stats.mozilla.org/report/index/14901b9c-c20f-4d07-acea-d56860210127

MOZ_CRASH Reason: MOZ_CRASH(external buffers not currently supported)

Top 10 frames of crashing thread:

0 xul.dll static js::ArrayBufferObject::addSizeOfExcludingThis js/src/vm/ArrayBufferObject.cpp:1477
1 xul.dll JS::ubi::Concrete<JSObject>::size const js/src/vm/JSObject.cpp:3755
2 xul.dll js::Debugger::appendAllocationSite js/src/debugger/Debugger.cpp:2883
3 xul.dll static js::DebugAPI::slowPathOnLogAllocationSite js/src/debugger/Debugger.cpp:2856
4 xul.dll js::SavedStacks::MetadataBuilder::build const js/src/vm/SavedStacks.cpp:1899
5 xul.dll JS::Realm::setNewObjectMetadata js/src/vm/Realm.cpp:518
6 xul.dll js::AutoSetNewObjectMetadata::~AutoSetNewObjectMetadata js/src/vm/Realm.cpp:712
7 xul.dll static js::ArrayBufferObject::createForContents js/src/vm/ArrayBufferObject.cpp:1196
8 xul.dll JS::NewExternalArrayBuffer js/src/vm/ArrayBufferObject.cpp:1789
9 xul.dll mozilla::webgpu::Buffer::GetMappedRange dom/webgpu/Buffer.cpp:134

This is an odd looking crash. Low volume. Some kind of debugger API is trying to get the size of an object via the Ubi Node interface, and hitting MOZ_CRASH("external buffers not currently supported");. I see WebGPU in the stack, so maybe that's involved, too.

I don't think it's Fission-related. Very straightforward. I think the fuzzers would have found this except there doesn't seem to be a way to call JS::NewExternalArrayBuffer from any testing function. If there were, then something like this should hit it:

let g = newGlobal({newCompartment: true});
let dbg = new Debugger(g);
dbg.memory.trackingAllocationSites = true;
g.newExternalArrayBuffer(64);

Matt, would you mind fixing?

I think for accounting purposes we should not count the buffer memory. For the one in-tree use of JS::NewExternalArrayBuffer, the external ArrayBuffer does not own the buffer. Instead, it serves as a view on a buffer owned by another object; if the other buffer is freed, the ArrayBuffer is automatically detached. So it should be treated like case USER_OWNED.

I'm not sure how valuable it would be to have a newExternalArrayBuffer helper.

Flags: needinfo?(mgaudet)
Severity: -- → S3
Priority: -- → P1

In the browser, I think the steps would be:

  1. open DevTools
  2. go to the Memory pane
  3. check "Record call stacks"
  4. visit a web page that uses GPUBuffer.getMappedRange.

Thanks for investigating, Jason. I'll mark this as blocking the WebGPU meta bug, as it sounds like it is the only user of this JSAPI function.

Blocks: webgpu-mvp
Assignee: nobody → mgaudet
Status: NEW → ASSIGNED
Flags: needinfo?(mgaudet)
Pushed by mgaudet@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f20b9fd489d0
Add shell function for creating external data array buffers r=jorendorff
https://hg.mozilla.org/integration/autoland/rev/b1472558e0c3
Update ArrayBufferObject size accounting to handle external ArrayBuffers r=jorendorff
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch

Is the "wontfix" on esr78 final, or would it be a possibility to get D104412 uplifted? While it's not a huge priority (otherwise I'd have noticed it before now), it does make JS::CollectRuntimeStats crash if you have any external ArrayBuffers live, which I believe are probably used more by embedders than inside Firefox.

We can take it if it helps embedders, assuming Matthew doesn't see an issue with doing so.

(Please nominate for uplift if so)

Flags: needinfo?(mgaudet)

Comment on attachment 9201804 [details]
Bug 1689503 - Add shell function for creating external data array buffers r?jorendorff

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: Helps avoid SM embedder crashes
  • User impact if declined: SM embedders likely carry their own copies of this patch to avoid crashes.
  • Fix Landed on Version: 87
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Low risk: Changes a memory accounting path the correct a MOZ_CRASH path into a sensible path.
  • String or UUID changes made by this patch:
Flags: needinfo?(mgaudet)
Attachment #9201804 - Flags: approval-mozilla-esr78?
Attachment #9201805 - Flags: approval-mozilla-esr78?

No issue with uplifting. Because of the test, both patches with be needed (First patch is adds shell testing function, second patch fixes bug, and then adds test case using said testing function). I'll nominate for uplift.

Comment on attachment 9201804 [details]
Bug 1689503 - Add shell function for creating external data array buffers r?jorendorff

Approved for 78.9esr, thanks for the quick response.

Attachment #9201804 - Flags: approval-mozilla-esr78? → approval-mozilla-esr78+
Attachment #9201805 - Flags: approval-mozilla-esr78? → approval-mozilla-esr78+

Thanks very much!

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: