Closed Bug 1966754 Opened 3 months ago Closed 1 month ago

feGaussianBlur crashes firefox with [@ webrender::render_task::render_task_sanity_check ]

Categories

(Core :: Graphics: WebRender, defect, P2)

Unspecified
All
defect

Tracking

()

RESOLVED FIXED
142 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr128 --- wontfix
firefox-esr140 --- fixed
firefox138 --- wontfix
firefox139 --- wontfix
firefox140 --- wontfix
firefox141 --- wontfix
firefox142 --- fixed

People

(Reporter: pdr, Assigned: ahale, NeedInfo)

References

Details

(4 keywords)

Crash Data

Attachments

(3 files)

Attached file 41483741.html

Steps to reproduce:

When triaging a Chromium bug, I found a case that seems to crash firefox (see attached). This crash has not been observed on real user content, just a minimized testcase from a browser engineer.

Actual results:

Crash

Limiting access to MoCo employees for now.

Here's a bug report: https://crash-stats.mozilla.org/report/index/6de61d27-8092-40e9-b750-e47dc0250515#tab-bugzilla

Moving based on the bugs showing up as possible matches.

Group: mozilla-employee-confidential
Component: Untriaged → Graphics: WebRender
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Ever confirmed: true
Crash Signature: [@ webrender::render_task::render_task_sanity_check ]
Summary: feColorMatrix crashes firefox → feColorMatrix crashes firefox with [@ webrender::render_task::render_task_sanity_check ]

Based on the panic, this testcase causes a render where either the width or height exceeds 16384 (MAX_RENDER_TASK_SIZE). Ideally this should be caught earlier in the code and be handled by returning an appropriate error, but webrender::render_task::render_task_sanity_check() is a backstop that will crash the browser if it's not rather than risk over- (or under-) flowing buffers later. Given the sizes I see in the testcase I don't know how the render gets that big.

The feDisplacementMap doesn't seem to matter: I can remove it and it still crashes.

Both the feColorMatrix and feGaussianBlur seem to be required: it doesn't crash if I remove either of those. It also doesn't crash if I reduce the size of the filter (drastically!): if I set the width to 5px and height to 10px it doesn't crash. If I increase the width to 7px it does crash, and if I set the width to 6px it beachballs on macos and i have to manually kill the process.

Since the crash is happening while rendering the blur I'm taking the liberty of changing the summary. Frame 8 of the crash stack is
https://hg-edge.mozilla.org/mozilla-central/file/907a3d528f5eef73b26914c19fac7c0b0d79e190/gfx/wr/webrender/src/render_task.rs#l2330

Has STR: --- → yes
Summary: feColorMatrix crashes firefox with [@ webrender::render_task::render_task_sanity_check ] → feGaussianBlur crashes firefox with [@ webrender::render_task::render_task_sanity_check ]
Flags: needinfo?(gwatson)

Ashley, sounds related to your svg filter work?

Flags: needinfo?(gwatson) → needinfo?(ahale)

I'm not so sure about this being related to my svg filter work - the shader for feDisplacementMap is not implemented in WebRender currently and hence gfx.webrender.svg-filter-effects.fedisplacementmap is false so this goes to blob fallback, which implies this is not properly tiling the blob fallback perhaps?

Flags: needinfo?(ahale) → needinfo?(gwatson)

I'll take a look at this, on the assumption that feDisplacementMap is a distraction, if feColorMatrix and feGaussianBlur in combination on a very large image is causing a panic then that needs to be fixed, I'm assuming the real culprit is feGaussianBlur and I'll need to take a look at how the subregions are being generated in this case and what the parameters are on these nodes.

Flags: needinfo?(ahale)
Flags: needinfo?(gwatson)

Maybe an S2? Not sure.

Flags: needinfo?(bhood)

I will discuss this with Ashley.

Flags: needinfo?(bhood)

I consider this an S3 unless demonstrated in the wild, it's an S2 in the sense that it brings down the GPU process in a crash loop (what SRE folks call task flapping), so if encountered in the wild it makes the browser entirely unusable (and potentially across browser restarts if restoring pages is enabled). Unfortunately this is the general failure mode of WebRender when RenderTask size is excessive, I don't entirely agree with that behavior because we do get this kind of thing wrong from time to time and having it just crash-loop the GPU process is a really bad behavior.

In terms of demonstrating this in the wild, I think https://bugzilla.mozilla.org/show_bug.cgi?id=1961176 may be the same issue (and again feGaussianBlur with excessive size is the theme).

Flags: needinfo?(ahale)
Severity: -- → S3
Priority: -- → P2
See Also: → 1961176

I'm less convinced that Bug 1961176 is the same issue because while sizes are getting excessive there, it's a matter of memory exhaustion caused by the cumulative sizes of blurs rather than this where a single item is too big and crashes, similar root cause but this one is way more extreme.

Assignee: nobody → ahale
Status: NEW → ASSIGNED

(In reply to Philip Rogers from comment #0)

When triaging a Chromium bug, I found a case that seems to crash firefox [...]

Philip: Can we get a URL for the chromium bug for reference? If it's not a public bug, do you need us to keep this bug hidden for a time? Having the link is handy even if it's not currently public: if you want us to keep ours hidden we can then use the link to periodically check when it would be OK to make ours public

Flags: needinfo?(pdr)

When patching this bug I am including a WPT crashtest, so if there's some reason to land only the code fix at first and omit the crashtest for now, I'd appreciate knowing why :)

(In reply to Daniel Veditz [:dveditz] from comment #11)

do you need us to keep this bug hidden for a time?

FWIW looking at the history here, it seems there's no reason for concern on this^ -- Philip filed this as a public bug (it was only made private in comment 1 by flod as a precaution while we investigated the crash); and the only crash mentioned here was a Firefox crash (the Chrome bug may have just been a correctness issue). So, in the absence of a signal to the contrary, I think we're fine to publish stuff here.

(In reply to Ashley Hale [:ahale] from comment #12)

if there's some reason to land only the code fix at first and omit the crashtest for now

Per above, probably no need to worry about splitting it up.

Group: mozilla-employee-confidential

(In reply to Daniel Holbert [:dholbert] from comment #13)

Per above, probably no need to worry about splitting it up.

I appreciate the clarification, thanks!

Attachment #9499111 - Attachment description: (secure) → Bug 1966754 - reduce SVGFE render task resolution for excessively large inputs r?#gfx-reviewers
Pushed by ahale@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/c9c5e7ddb932 https://hg.mozilla.org/integration/autoland/rev/fa53eb0659e5 reduce SVGFE render task resolution for excessively large inputs r=gfx-reviewers,bradwerth
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/53709 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 142 Branch
Upstream PR merged by moz-wptsync-bot

Since nightly and release are affected, beta will likely be affected too.
For more information, please visit BugBot documentation.

Please nominate this for ESR140 uplift when you get a chance. It cherry-picks cleanly.

Flags: needinfo?(ahale)
Attachment #9505839 - Flags: approval-mozilla-esr140?

Comment on attachment 9505839 [details]
Bug 1966754 - reduce SVGFE render task resolution for excessively large inputs r?#gfx-reviewers

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: This prevents a rare crash with SVG filters on very large source images (image in the CSS sense - can be a block of text, etc), it has reduced crash volume in nightly.
  • User impact if declined: Crashes continue...?
  • Fix Landed on Version: 141
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): This code change hasn't caused problems so far.
Flags: needinfo?(ahale)
Attachment #9505839 - Flags: approval-mozilla-esr140? → approval-mozilla-esr140+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: