Closed Bug 1534902 Opened 5 years ago Closed 5 years ago

Assertion failure: !JS_IsDeadWrapper(origTarget) (We don't want a dead proxy in the wrapper map), at js/src/proxy/CrossCompartmentWrapper.cpp:549

Categories

(Core :: JavaScript Engine, defect, P1)

x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox-esr60 --- unaffected
firefox66 --- wontfix
firefox67 --- wontfix
firefox68 --- fixed

People

(Reporter: gkw, Assigned: jandem)

References

Details

(4 keywords, Whiteboard: [jsbugmon:])

Attachments

(2 files)

The following testcase crashes on mozilla-central revision 9067457d7dcf (build with --enable-debug, run with --fuzzing-safe --no-threads --no-baseline --no-ion --more-compartments):

// Adapted from randomly chosen test: js/src/jit-test/tests/realms/nuking.js
evalcx("var x = newGlobal({ sameCompartmentAs: newGlobal({ newCompartment: true }) });" +
       'x.evaluate("(" + function () { nukeAllCCWs(); } + ")()"); x;',
    newGlobal()
);
// jsfunfuzz-generated
recomputeWrappers();

Backtrace:

#0 js::RemapWrapper (cx=0x7f0d3ea17000, wobjArg=<optimized out>, newTargetArg=<optimized out>) at js/src/proxy/CrossCompartmentWrapper.cpp:548
#1 0x00005611229e4d41 in js::RecomputeWrappers (cx=0x7f0d3ea17000, sourceFilter=..., targetFilter=warning: RTTI symbol not found for class 'RecomputeWrappers(JSContext*, unsigned int, JS::Value*)::SingleOrAllCompartments'
...) at js/src/proxy/CrossCompartmentWrapper.cpp:676
#2 0x0000561122335478 in RecomputeWrappers (cx=0x7f0d3ea17000, argc=<optimized out>, vp=<optimized out>) at js/src/shell/js.cpp:6286
#3 0x00005611223d4285 in CallJSNative (cx=0x7f0d3ea17000, native=0x5611223352d0 <RecomputeWrappers(JSContext*, unsigned int, JS::Value*)>, args=...) at js/src/vm/Interpreter.cpp:442
/snip

For detailed crash information, see attachment.

Setting s-s as a start as this involves compartments.

autobisectjs shows this is probably related to the following changeset:

The first bad revision is:
changeset: https://hg.mozilla.org/mozilla-central/rev/343c194c1a08
user: Jan de Mooij
date: Wed Sep 19 11:42:45 2018 +0200
summary: Bug 1492406 - Add a recomputeWrappers function to the JS shell for js::RecomputeWrappers. r=jonco

Jan, is bug 1492406 a likely regressor?

Blocks: 1492406
Flags: needinfo?(jdemooij)

Is ObjectValue() on a dead wrapper going to be anything questionable?

Whiteboard: [jsbugmon:update] → [jsbugmon:]
JSBugMon: Cannot process bug: Unable to automatically reproduce, please track manually.

Is this something web content could even do? New compartment (iframe?) and then nuke wrappers?

Keywords: sec-moderate

This should be safe and it actually can't happen in the browser, because XPConnect's PreWrap callback refuses to create a CCW for dead wrappers:

https://searchfox.org/mozilla-central/rev/3d469329a42644b41e66944d8da22d78d8c0f5ec/js/xpconnect/wrappers/WrapperFactory.cpp#181-183

Moving that check into the JS engine fixes this and it has been on my list for a while to get consistent behavior everywhere.

Assignee: nobody → jdemooij
Status: NEW → ASSIGNED
Flags: needinfo?(jdemooij)
Keywords: sec-moderate
Group: javascript-core-security
Blocks: 1406146

This ensures the JS shell and browser behave the same way and it's nice for fuzzing.

Priority: -- → P1
Pushed by jdemooij@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/116b9cd070f2
Move more of XPConnect's PreWrap code into the JS engine. r=kmag
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: