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)

x86_64
Linux
defect
Not set
critical

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)

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 :)
Keywords: assertion, testcase
I'm not crashing on this with daaf6a3b8782. Is this the complete testcase, or does comment 0 perhaps contain a mis-paste?
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
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.
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: general → jorendorff
blocking2.0: ? → final+
Attached patch v1 (deleted) — Splinter Review
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)
Maybe sg:critical? given we might do things to the wrong/deleted shape.
Whiteboard: [sg:critical?]
Whiteboard: [sg:critical?] → [sg:critical?][hardblocker]
Comment on attachment 503313 [details] [diff] [review] v1 Thanks, r=me. /be
Attachment #503313 - Flags: review?(brendan) → review+
Whiteboard: [sg:critical?][hardblocker] → [sg:critical][hardblocker][fixed-in-tracemonkey]
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Depends on: 629968
This part: - obj->methodWriteBarrier(cx, shape->slot, value); + obj->methodWriteBarrier(cx, *shape, value); seems to cause a -j performance regression. See bug 629968.
Attachment #507944 - Attachment description: Bug Bounty Nomination → Bug Bounty Awarded + 3000
Attachment #507944 - Attachment description: Bug Bounty Awarded + 3000 → Bug Bounty Awarded + 3000 [paid]
Fixed for a long time and not affecting old branches, opening this.
Group: core-security
Test was landed with fix, marking verified.
Status: RESOLVED → VERIFIED
A testcase for this bug was automatically identified at js/src/jit-test/tests/basic/bug623863.js.
Flags: in-testsuite+
Flags: sec-bounty+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: