Closed Bug 596103 Opened 15 years ago Closed 15 years ago

Shape is used after it is GCed

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla2.0b7
Tracking Status
blocking2.0 --- betaN+
status1.9.2 --- unaffected
status1.9.1 --- unaffected

People

(Reporter: jruderman, Assigned: brendan)

References

Details

(Keywords: assertion, regression, testcase, Whiteboard: [sg:critical?] fixed-in-tracemonkey)

Attachments

(3 files, 3 obsolete files)

Attached file testcase
To reproduce: Run "./js t.js". (Don't paste the testcase into an interactive shell.) Result: Assertion failure: thing, at js/src/jsgc.cpp:1895 or Assertion failure: !(addr & GC_CELL_MASK), at js/src/jsgc.cpp:425 The first bad revision is: changeset: 52718:bb3730430112 user: Steve Fink date: Wed Sep 01 14:09:54 2010 -0700 summary: Bug 584175 - Unify various JS probes into a single set of static probe points. r=gal
Attached file valgrind's explanation
Assignee: general → sphink
Severity: critical → normal
Steve, let me know if you need help with this.
blocking2.0: --- → ?
This *might* be the #14 topcrash on nightlies (see bug 595912). Does that mean it should block beta 6?
Thanks Jesse for helping to reduce this. It was kind of a real pain to reduce.
var y = []; Object.create(y); // give y an emptyShape; new object is garbage gc(); // array_trace does not mark y's emptyShape, so it is collected y.t = 3; // slowify y gc(); // tries to trace y's emptyShape (now reachable from y)
Bonus points if you can add DEBUG-only code that makes this crash without involving `a` or having to loop 600 times. I feel sure it can be done.
Attached patch Fix layering (obsolete) — Splinter Review
It's the little things... /be
Assignee: sphink → brendan
Status: NEW → ASSIGNED
Attachment #475129 - Flags: review?(jorendorff)
Thanks, J&J for the help. Sphink, sorry to darken your door with this bug. This blocks b6. /be
Severity: normal → critical
OS: Mac OS X → All
Priority: -- → P1
Hardware: x86 → All
Target Milestone: --- → mozilla2.0b6
Why does it have to loop ~300 times before hitting the assertion?
It doesn't, exactly. This'll crash too: var y = [ [] for (i in function(n) { while(n) yield n--; }(100)) ]; for (i in y) Object.create(y[i]); gc(); for (i in y) y[i].t = 42; gc(); But it still needs a bunch of them piling up before it'll barf.
(In reply to comment #9) > Why does it have to loop ~300 times before hitting the assertion? Because the GC'd Shape is only written over with 0xdadadada if the whole page of shapes is empty--basically only if that particular empty shape was the only thing on the page. The test loops, allocating one new Shape per iteration, until it triggers this case. The patch adds a DEBUG-only memset call in JSShape::insertFree, so we poison every Shape with dadadada as soon as it's GC'd. With that, we crash the second time through the loop.
Don't forget to hg add the testcase.
Attached patch counterproposal, with test (obsolete) — Splinter Review
Well, all right.
Attachment #475179 - Attachment is obsolete: true
Attachment #475193 - Flags: review?(brendan)
Attachment #475179 - Flags: review?(brendan)
Attached patch patch to commitSplinter Review
Not really a counterproposal, there -- I had almost the char-for-char identical test under construction (copied different boilerplate including a modeline), but I attached only the fix-patch in a big rush in case someone wanted to test it. Thanks for the test and jsscope.h patch and review. /be
Attachment #475129 - Attachment is obsolete: true
Attachment #475193 - Attachment is obsolete: true
Attachment #475203 - Flags: review+
Attachment #475193 - Flags: review?(brendan)
Attachment #475129 - Flags: review?(jorendorff)
Whiteboard: [sg:critical?] → [sg:critical?] fixed-in-tracemonkey
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Group: core-security
blocking2.0: ? → betaN+
A testcase for this bug was automatically identified at js/src/tests/js1_8_5/regress/regress-596103.js.
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: