Closed Bug 684922 Opened 13 years ago Closed 13 years ago

Crash due to too much recursion through GetCustomIterator

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
critical

Tracking

()

VERIFIED FIXED
mozilla11
Tracking Status
firefox9 - ---
firefox10 - ---
firefox11 - ---

People

(Reporter: gkw, Assigned: dmandelin)

References

Details

(Keywords: crash, testcase, Whiteboard: [sg:dos])

Crash Data

Attachments

(2 files)

Attached file stacks
q = {}.__proto__
function h() {
    q.p = q
}
h()
function t() {
    for each(let y in []) {
        y.__iterator__ = Iterator
        for (c in []) {}
    }
}
t()

crashes js debug shell on m-c changeset db9e99d537f2 with the patch from bug 683966 without any CLI arguments at js::PropertyTable::search and crashes js opt shell at PrimitiveToObject.

Based on the stack, this seems to be a recursive overflow, but locking s-s just to be safe.
Summary: Crash [@ js::PropertyTable::search] or [@ PrimitiveToObject] with Iterator → Crash [@ js::PropertyTable::search] or [@ PrimitiveToObject] or [@ js::InvokeKernel] or [@ js_CheckForStringIndex] with Iterator
recursive stack exhaustion would be sg:dos, but the stacks you attached don't show that kind of error.
Crash Signature: [@ js::PropertyTable::search ] [@ PrimitiveToObject ] [@ js::InvokeKernel ] [@ js_CheckForStringIndex ]
Whiteboard: js-triage-needed → [sg:critical?] js-triage-needed
(In reply to Daniel Veditz from comment #1)
> recursive stack exhaustion would be sg:dos, but the stacks you attached
> don't show that kind of error.

I should probably attach longer stacks next time, but they seem to repeatedly go on for thousands of lines.
One way to make "too much recursion" explicit is to strip out all the distractions, like I did in bug 671797 ;)

I happen to know that 0x00007fff5f3ffffc is typical "guard page at the end of stack memory" on Mac.  It would be nice if gdb gave more information about the inaccessible memory page.
Summary: Crash [@ js::PropertyTable::search] or [@ PrimitiveToObject] or [@ js::InvokeKernel] or [@ js_CheckForStringIndex] with Iterator → Crash due to too much recursion through GetCustomIterator
By the way, in fuzzing/js-known/mozilla-central/assertions.txt, you can write

# Bug 684922
[TMR] GetCustomIterator

The "TMR" is special thing for too-much-recursion crashes. It instructs detect_interesting_crashes to only consider a crash report to be a match if the offending function is seen on 9+ lines.

You have to pick a function from the repeating portion of the stack, but that's saner than picking a function from the top.
Simpler testcase:

var op = Object.prototype;
op.b = op;
op.__iterator__ = Iterator;
for (var c in {}) {}
Ok to unhide the bug then?
Whiteboard: [sg:critical?] js-triage-needed → [sg:dos] js-triage-needed
Yes.
Group: core-security
The js::PropertyTable::search crash signature is #1 top crasher on Mac OS X in 9.0b2.
(In reply to Scoobidiver from comment #8)
> The js::PropertyTable::search crash signature is #1 top crasher on Mac OS X
> in 9.0b2.

Given that we have simple testcases in comment 0 and comment 5, plus it being a topcrasher (assuming the correlation), could someone please kindly take a look?

Nominating for tracking from versions 9 onwards.
OS: Mac OS X → All
Hardware: x86 → All
Attached patch PatchSplinter Review
This is an infinite recursion bug. The cycle goes through GetCustomIterator, which seems like a reasonable place to put a JS_CHECK_RECURSION.

I'd be pretty surprised if this had an effect on the topcrashes, but I wouldn't mind being lucky.
Assignee: general → dmandelin
Status: NEW → ASSIGNED
Attachment #577397 - Flags: review?(luke)
Whiteboard: [sg:dos] js-triage-needed → [sg:dos]
Attachment #577397 - Flags: review?(luke) → review+
http://hg.mozilla.org/integration/mozilla-inbound/rev/720247db9dc3

I don't think we need to track this bug, but we should check out the crashstats after it lands.
Flags: in-testsuite+
https://hg.mozilla.org/mozilla-central/rev/720247db9dc3
https://hg.mozilla.org/mozilla-central/rev/ff1c18668452
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla11
Do we want to fix this on Aurora as well?
(In reply to Scoobidiver from comment #8)
> The js::PropertyTable::search crash signature is #1 top crasher on Mac OS X
> in 9.0b2.

I looked at some of the js::PropertyTable::search crash reports and none of the stacks showed deep recursion. So the topcrash is not this bug.
fwiw I put the testcase in comment 5 in a <script> tag and opt Firefox crashed [@ PrimitiveToObject ] - the js::PropertyTable::search signature I got was off a debug shell.
A type of test for this bug has already been landed because it is already marked in-testsuite+ -> VERIFIED.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: