Closed
Bug 623863
Opened 14 years ago
Closed 14 years ago
Assertion failure: obj->containsSlot(slot), at jsobj.cpp:5157
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
VERIFIED
FIXED
Tracking | Status | |
---|---|---|
blocking2.0 | --- | final+ |
status1.9.2 | --- | unaffected |
status1.9.1 | --- | unaffected |
People
(Reporter: decoder, Assigned: jorendorff)
References
Details
(Keywords: assertion, regression, testcase, Whiteboard: [sg:critical][hardblocker][fixed-in-tracemonkey])
Attachments
(1 file)
(deleted),
patch
|
brendan
:
review+
|
Details | Diff | Splinter Review |
The following code asserts on TM tip:
gczeal(2);
Function.prototype.prototype = function() { return 42; }
try {
foo(Function);
} catch (e) { }
Function.prototype.prototype = function() { return 42; }
I'm not sure, but this might be related to 623301 (at least Function and properties are used here as well). Security locked this because it seems like a GC problem although in my first test, it didn't crash after the assert. Unlock if it's not a security problem :)
Reporter | ||
Updated•14 years ago
|
Comment 1•14 years ago
|
||
I'm not crashing on this with daaf6a3b8782. Is this the complete testcase, or does comment 0 perhaps contain a mis-paste?
Comment 2•14 years ago
|
||
The first bad revision is:
changeset: 52d20032116a
user: Jason Orendorff
date: Thu Dec 09 12:04:35 2010 -0600
summary: Bug 614051 - TM: wrong behavior setting existing properties to joined function object values again. r=brendan.
Blocks: 614051
Keywords: regression
Comment 3•14 years ago
|
||
It asserts for me if I give the testcase to the shell as a file, but not if I paste it into an interactive shell.
Assignee | ||
Comment 4•14 years ago
|
||
The first SETMETHOD defines a method property. The second SETMETHOD reaches this code in js_SetPropertyHelper:
if (shape && (defineHow & JSDNP_SET_METHOD)) {
/*
* JSOP_SETMETHOD is assigning to an existing own property. If it
* is an identical method property, do nothing. Otherwise downgrade
* to ordinary assignment. Either way, do not fill the property
* cache, as the interpreter has no fast path for these unusual
* cases.
*/
bool identical = shape->isMethod() &&
&shape->methodObject() == &vp->toObject();
if (!identical) {
(1) if (!obj->methodShapeChange(cx, *shape))
return false;
JS_ASSERT(IsFunctionObject(*vp));
JSObject *funobj = &vp->toObject();
JSFunction *fun = GET_FUNCTION_PRIVATE(cx, funobj);
if (fun == funobj) {
(2) funobj = CloneFunctionObject(cx, fun, fun->parent);
if (!funobj)
return JS_FALSE;
vp->setObject(*funobj);
}
}
if (defineHow & JSDNP_CACHE_RESULT) {
JS_ASSERT_NOT_ON_TRACE(cx);
TRACE_2(SetPropHit, JS_NO_PROP_CACHE_FILL, shape);
}
(3) return identical || js_NativeSet(cx, obj, shape, false, vp);
}
After (1), shape still points to the old shape. Now *shape is gc-unreachable (the conservative stack scan does not see shape pointers).
CloneFunctionObject (2) does GC due to gczeal. This collects the shape and 0xdadadadas it out. js_NativeSet (3) reads that junk and asserts.
The fix is to update shape to point to the new property after (1).
Easy patch. This should block ff4 final at least.
blocking2.0: --- → ?
Assignee | ||
Updated•14 years ago
|
Assignee: general → jorendorff
Updated•14 years ago
|
blocking2.0: ? → final+
Assignee | ||
Comment 5•14 years ago
|
||
I could instead just do `shape = obj->lookup(id)` in js_SetPropertyHelper. That would be a smaller patch, but it seems silly to do a lookup when methodWriteBarrier could just return the shape.
Attachment #503313 -
Flags: review?(brendan)
Comment 6•14 years ago
|
||
Maybe sg:critical? given we might do things to the wrong/deleted shape.
Whiteboard: [sg:critical?]
Updated•14 years ago
|
Whiteboard: [sg:critical?] → [sg:critical?][hardblocker]
Comment 7•14 years ago
|
||
Comment on attachment 503313 [details] [diff] [review]
v1
Thanks, r=me.
/be
Attachment #503313 -
Flags: review?(brendan) → review+
Assignee | ||
Comment 8•14 years ago
|
||
Whiteboard: [sg:critical?][hardblocker] → [sg:critical][hardblocker][fixed-in-tracemonkey]
Comment 9•14 years ago
|
||
cdleary-bot mozilla-central merge info:
http://hg.mozilla.org/mozilla-central/rev/b90090c29571
Updated•14 years ago
|
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Comment 10•14 years ago
|
||
This part:
- obj->methodWriteBarrier(cx, shape->slot, value);
+ obj->methodWriteBarrier(cx, *shape, value);
seems to cause a -j performance regression. See bug 629968.
Updated•14 years ago
|
Attachment #507944 -
Attachment description: Bug Bounty Nomination → Bug Bounty Awarded + 3000
Updated•14 years ago
|
status1.9.1:
--- → unaffected
status1.9.2:
--- → unaffected
Updated•14 years ago
|
Attachment #507944 -
Attachment description: Bug Bounty Awarded + 3000 → Bug Bounty Awarded + 3000 [paid]
Reporter | ||
Comment 11•13 years ago
|
||
Fixed for a long time and not affecting old branches, opening this.
Group: core-security
Reporter | ||
Comment 12•13 years ago
|
||
Test was landed with fix, marking verified.
Status: RESOLVED → VERIFIED
Reporter | ||
Comment 13•12 years ago
|
||
A testcase for this bug was automatically identified at js/src/jit-test/tests/basic/bug623863.js.
Flags: in-testsuite+
Updated•11 years ago
|
Flags: sec-bounty+
You need to log in
before you can comment on or make changes to this bug.
Description
•