Closed Bug 1618501 Opened 4 years ago Closed 4 years ago

Crash when displaying a large table if layers.force-active=true

Categories

(Core :: Panning and Zooming, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox-esr68 --- unaffected
firefox73 --- unaffected
firefox74 --- unaffected
firefox75 --- disabled

People

(Reporter: zrhoffman, Assigned: kats)

References

(Regression)

Details

(4 keywords, Whiteboard: [reporter-external] [client-bounty-form] [verif?][sg:dos])

Attachments

(4 files)

Attached file testcase.html

mozilla::layers::APZCTreeManager::UpdateHitTestingTreeImpl<mozilla::layers::LayerMetricsWrapper> calls mRootNode->Dump(" "), which calls mLastChild->Dump(nsPrintfCString("%s ", aPrefix).get()), which recursively calls mPrevSibling->Dump(aPrefix) until unsafe memory is accessed.

Flags: sec-bounty?
Attached file gdb backtrace

Attached backtrace.

Tested in a trunk build from today (515608:7f41334e1044), verified in latest nightly, both on 64-bit Arch Linux.

Attachment #9129452 - Attachment mime type: application/octet-stream → text/plain

:kats, from a quick look at the stack this looks like it got tripped by APZ (mozilla::layers::APZCTreeManager::UpdateHitTestingTreeImpl<mozilla::layers::LayerMetricsWrapper>(), though I suppose it's quite possible for the actual bug to be elsewhere - could you take a look and/or redirect as appropriate?

Group: firefox-core-security → core-security
Component: Security → Panning and Zooming
Flags: needinfo?(kats)
Product: Firefox → Core
Group: core-security → layout-core-security
Keywords: crash, testcase

Thanks, I'll investigate. Regression from bug 1616591 since prior to that the code in question was compiled out by default.

Assignee: nobody → kats
Type: task → defect
Flags: needinfo?(kats)
Regressed by: 1616591
Has Regression Range: --- → yes

Thanks! Updating release flags based on that. :-)

This just looks like stack exhaustion, so I'm unhiding it. (Tyson said the fuzzers are hitting this a lot, too.)

Group: layout-core-security
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: csectype-dos
Whiteboard: [reporter-external] [client-bounty-form] [verif?] → [reporter-external] [client-bounty-form] [verif?][sg:dos]

So there's two problems here: one is that we're going into the logging code at all even when logging is not enabled. The other is that the logging code is poorly written (by me) and recurses across siblings as well as when descending to children. So for layer trees that are really wide, such as in this example, this results in stack exhaustion.

I have patches to fix both of these things, will put them up once my try results are back. https://treeherder.mozilla.org/#/jobs?repo=try&group_state=expanded&revision=8cf8ac8e1ada0bcbfcb43c3cd143035001079352

This avoids doing a full recursive walk of the tree for no purpose unless
the logging is actually enabled.

The HTTN dumping code recursed not only when going down the tree, but
also when traversing siblings. For "wide" trees this could result in
stack exhaustion. This patch rewrites that function to only recurse
when going down a level and uses iteration to walk the siblings at a
given level.

Depends on D64657

Pushed by kgupta@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8e3c1d399649
Don't go into the hit-testing tree dumping codepath if we're not actually dumping. r=botond
https://hg.mozilla.org/integration/autoland/rev/6cb26395019b
Rewrite the dumping code to not recurse so much. r=botond
Priority: -- → P2
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
Flags: sec-bounty? → sec-bounty-

Unfortunately this kind of denial of service is not covered by our security bug bounty program.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: