Closed
Bug 618129
Opened 15 years ago
Closed 15 years ago
Assertion failure: JSVAL_IS_DOUBLE_IMPL(data)
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
| Tracking | Status | |
|---|---|---|
| blocking2.0 | --- | betaN+ |
People
(Reporter: jandem, Assigned: dvander)
References
Details
(Keywords: reporter-external, testcase, Whiteboard: [sg:critical?][hardblocker][fixed-in-tracemonkey])
Attachments
(2 files)
|
621 bytes,
application/x-javascript
|
Details | |
|
719 bytes,
patch
|
brendan
:
review+
|
Details | Diff | Splinter Review |
Attached test case triggers this assert in debug builds (JM/TM/interpreter):
Assertion failure: JSVAL_IS_DOUBLE_IMPL(data), at ../jsvalue.h:705
It segfaults release builds, both shell and browser, so marking security sensitive.
Updated•15 years ago
|
blocking2.0: --- → ?
Comment 1•15 years ago
|
||
I started reducing to see if this was a nan-canonicalization bug. It doesn't seem to be, rather, I think its a bug involving how we touch object slots. I can't reduce it much smaller than this:
x = 1;
y = 1;
this.watch("x", function() {
Object.defineProperty(this, "x", ({ get:print }))
});
x = 1;
Error(); // assert when adding function to global object
// while initing Error class
Updated•15 years ago
|
blocking2.0: ? → betaN+
| Assignee | ||
Updated•15 years ago
|
Assignee: general → dvander
| Reporter | ||
Updated•15 years ago
|
Severity: normal → critical
Updated•15 years ago
|
Whiteboard: [sg:critical?]
Comment 3•15 years ago
|
||
Bug 622011 trips the same assertion.
Updated•15 years ago
|
Whiteboard: [sg:critical?] → [sg:critical?][hardblocker]
| Assignee | ||
Comment 4•15 years ago
|
||
The problem occurs at line 6 in comment #1, possibly within js_NativeSet:
sample = cx->runtime->propertyRemovals;
{
AutoShapeRooter tvr(cx, shape);
if (!shape->set(cx, obj, vp))
return false;
}
At this point, |slot == shape->slot == 191|. shape->set() then sees the obj_watch setter, and invokes it. This redefines the property being altered in js_NativeSet.
Then we reach here,
if (obj->containsSlot(slot) &&
where in shape->slot == SHAPE_INVALID_SLOT, but slot is 191.
Still investigating, it's not yet clear where the bug is. The slot bookkeeping could be wrong with this setter/watch combination, runtime->propertyRemovals could be wrong, or it could be that js_NativeSet should be reloading shape->slot.
Comment 5•15 years ago
|
||
Shared shapes are immutable, so reloading slot won't help.
This smells like a slot freelist bug. Want to throw it to me?
/be
| Assignee | ||
Comment 6•15 years ago
|
||
Sure. It's not shared before shape->set(); it becomes slotless after.
Assignee: dvander → brendan
| Assignee | ||
Comment 7•15 years ago
|
||
(Taking back to lighten blocker load.)
This lead me to bug 624050, which also involved stale shape data. I'm almost convinced shape->slot just needs to be reloaded:
Before js_NativeSet() calls shape->set(), the shape has a non-default setter op (js_watch_set, not a setter value, and thus not shared), and a slot (191). shape->set() calls js_watch_set, and the scripted handler evolves the shape to be shared (thus slotless, with a setter value). The old slot is added to the free list, but when js_NativeSet() attempts to update the slot value, it clobbers the free list.
The behavior is slightly different in bug 624050, where after shape->set(), then |shape != obj->nativeLookup(shape->id)|. But js_NativeSet checks that the object still contains both the slot and the shape, so this is safe.
I'm not sure if js_NativeGet has a similar bug. If so I can't reproduce one, because there's no "watch" for gets.
Comment 9•15 years ago
|
||
If the shape is flagged IN_DICTIONARY then you're right, it is mutable and owned by its object, not shared among objects. Is it changing from slotful to slotless?
/be
| Assignee | ||
Comment 10•15 years ago
|
||
Yes, that is exactly the change.
Comment 12•15 years ago
|
||
So your reload fix resolves this bug?
/be
| Assignee | ||
Comment 13•15 years ago
|
||
(In reply to comment #12)
> So your reload fix resolves this bug?
>
> /be
It fixes the test cases in this bug and its dupes, at least. They all involve watch and defining a getter or setter.
Comment 14•15 years ago
|
||
Comment on attachment 502163 [details] [diff] [review]
fix?
How about adding
JS_ASSERT_IF(!obj->inDictionaryMode(), shape->slot == slot);
after the set call and before updating slot? More to comment on what is going on than to catch anything super-dire like mutating shared immutable non-dictionary shapes. r=me with that.
/be
Attachment #502163 -
Flags: review?(brendan) → review+
| Assignee | ||
Comment 15•15 years ago
|
||
Whiteboard: [sg:critical?][hardblocker] → [sg:critical?][hardblocker][fixed-in-tracemonkey]
Comment 16•15 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Updated•13 years ago
|
Group: core-security
Updated•13 years ago
|
Flags: sec-bounty+
Updated•2 years ago
|
Keywords: reporter-external
You need to log in
before you can comment on or make changes to this bug.
Description
•