Closed Bug 2088719 Opened 26 days ago Closed 13 days ago

Crash in [@ gfxWindowsPlatform::EnsureDevicesInitialized] MOZ_DIAGNOSTIC_ASSERT(!IsWin32kLockedDown())

Categories

(Core :: Graphics, defect)

defect

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox-esr153 --- unaffected
firefox159 --- disabled
firefox160 --- disabled
firefox161 --- disabled
firefox162 --- fixed

People

(Reporter: clouseau-bot, Assigned: bobowen)

References

(Blocks 1 open bug)

Details

(Keywords: crash)

Crash Data

Attachments

(1 external file)

Crash report: https://crash-stats.mozilla.org/report/index/8bcf2471-0900-43c3-ad40-9f1820261103

MOZ_CRASH Reason:

MOZ_DIAGNOSTIC_ASSERT(!IsWin32kLockedDown())

Top 10 frames:

0  xul.dll  gfxWindowsPlatform::EnsureDevicesInitialized()  gfx/thebes/gfxWindowsPlatform.cpp:1476
1  xul.dll  mozilla::layers::WebRenderBridgeChild::GetForMedia()  gfx/layers/wr/WebRenderBridgeChild.cpp:547
2  xul.dll  mozilla::dom::MediaCapabilities::GetCompositor()  dom/media/mediacapabilities/MediaCapabilities.cpp:1833
3  xul.dll  mozilla::dom::MediaCapabilities::CreateNonWebRTCDecodingInfo(mozilla::dom::Media...  dom/media/mediacapabilities/MediaCapabilities.cpp:1160
4  xul.dll  mozilla::dom::MediaCapabilities::CreateMediaCapabilitiesDecodingInfo(mozilla::do...  dom/media/mediacapabilities/MediaCapabilities.cpp:995
5  xul.dll  mozilla::dom::MediaCapabilities::DecodingInfo(mozilla::dom::MediaDecodingConfigu...  dom/media/mediacapabilities/MediaCapabilities.cpp:930
6  xul.dll  mozilla::dom::MediaCapabilities_Binding::decodingInfo_promiseWrapper(JSContext*,...  dom/bindings/MediaCapabilitiesBinding.cpp:1498
7  xul.dll  mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::Normal...  dom/bindings/BindingUtils.cpp:3218
8  xul.dll  js::Interpret(JSContext*, js::RunState&)  js/src/vm/Interpreter.cpp:3292
9  xul.dll  js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvoke...  js/src/vm/Interpreter.cpp:736

There is 1 crash in nightly 161 with buildid 20261103080110.

In the last 30 days, Firefox has 9 crashes (from 4 installations) on nightly and 5 crashes (from 2 installations) on beta/DevEdition with this signature.

This signature has been reported since build 20190507012018 (2019-05-07), 2737 days before the build above.

This bug looks actionable because:

  • MOZ_DIAGNOSTIC_ASSERT(!IsWin32kLockedDown()) in gfxWindowsPlatform::EnsureDevicesInitialized fires. A win32k-locked-down content process reached it from WebRenderBridgeChild::GetForMedia because PDMFactory::AllDecodersAreRemote() returned false.

    1. At startup the parent decides content win32k lockdown in GetLiveWin32kLockdownState(), refusing it (DecodersArentRemote) unless PDMFactory::AllDecodersAreRemote() is true, and caches the result in gWin32kStatus.
    2. AllDecodersAreRemote() reads six media.rdd-* static prefs that are live (mirror: always), and the cached lockdown state is only recomputed for security.sandbox.content.win32k-disable.
    3. In this locked-down content process, a page script called MediaCapabilities.decodingInfo(), which goes through MediaCapabilities::GetCompositor() into WebRenderBridgeChild::GetForMedia().
    4. There AllDecodersAreRemote() returned false, probably because one of the media.rdd-* prefs changed after the lockdown decision, so GetForMedia called EnsureDevicesInitialized() (line 547).
    5. EnsureDevicesInitialized() asserts that the process is not win32k-locked-down, and the assert fails (line 1476).

    Frame 1 at line 547 is inside the !AllDecodersAreRemote() branch, and the crash reason is this exact assert, so both conditions held in this process. What made the predicate false after lockdown (a user pref change or another path) is not visible in the report. The owner should first look at whether GetForMedia should check IsWin32kLockedDown() (or the parent's cached decision) instead of the live decoder prefs.

  • The failing code was last changed in 6b30d87e0b90 (bug 1692894) by :bobowen, which landed on 2021-02-25; this signature is also reported on builds made before that date.

Impact

A content process crashes; the tabs it hosts show a crash page. MOZ_DIAGNOSTIC_ASSERT is in nightly and Developer Edition builds only; beta, release and ESR builds run on past it. In beta and release the assert is skipped, so EnsureDevicesInitialized() goes on to run InitializeDevices() and UpdateBackendPrefs() once, trying to create D3D devices in a process where win32k system calls are blocked.

Possible fixes

  • In WebRenderBridgeChild::GetForMedia, skip EnsureDevicesInitialized() when IsWin32kLockedDown() is true, since a locked-down process cannot use local D3D devices anyway.
  • Have GetForMedia and the lockdown decision use the same snapshot, for example by caching AllDecodersAreRemote() at content-process launch, so later media.rdd-* pref changes cannot split them.
  • Possibly make the media.rdd-* prefs used by AllDecodersAreRemote() mirror: once, or recompute gWin32kStatus when they change, so new content processes are not launched locked down with non-remote decoders.

How to confirm

On a Windows nightly with content win32k lockdown on, open a page, then set media.rdd-vpx.enabled (or another media.rdd-* pref) to false in about:config and call navigator.mediaCapabilities.decodingInfo({type:'file', video:{contentType:'video/webm; codecs="vp9"', width:640, height:360, bitrate:1000000, framerate:30}}) from that tab. The diagnostic assert should fire.

Code references:

:bobowen, can you have a look please?

Filed automatically by Clouseau with an LLM, from a submitted crash report: not an independent Mozilla discovery

Filed automatically by Clouseau, which analyses nightly crashes with an LLM. Nothing above was written or checked by a human. Please close it as INVALID if it is wrong — that is useful feedback, not a nuisance.

This is not an independent Mozilla discovery: the crash is known here only because somebody submitted the crash report linked at the top. If this duplicates an existing report, please resolve THIS bug as the duplicate and leave the credit with the earlier reporter.

Flags: needinfo?(bobowencode)
Summary: Crash in [@ gfxWindowsPlatform::EnsureDevicesInitialized] → Crash in [@ gfxWindowsPlatform::EnsureDevicesInitialized] MOZ_DIAGNOSTIC_ASSERT(!IsWin32kLockedDown())
Assignee: nobody → bobowencode
Severity: -- → S4
Status: NEW → ASSIGNED

Decoders in these processes never use the devices: DXVA is only used in the RDD
and GPU processes. Initializing them could hit the win32k lockdown assertion
when a media.rdd-* pref was changed after startup.

Pushed by bobowencode@gmail.com: https://github.com/mozilla-firefox/firefox/commit/550121921116 https://hg.mozilla.org/integration/autoland/rev/f7a2468d576c Stop initializing graphics devices for media in content and parent processes. r=aosmond,media-playback-reviewers
Status: ASSIGNED → RESOLVED
Closed: 13 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch

The patch landed in nightly and beta is affected.

:bobowen, please make an uplift decision for beta:

  • For beta, nominate the patch for beta uplift approval if the fix should be included in this release, or set status-firefox161 to wontfix if the fix can wait for the next release.

Uplift requests can be submitted from Lando: D341315.

See Requesting an Uplift for documentation on how to request an uplift.

For more information, please visit BugBot documentation.

Flags: needinfo?(bobowencode)
QA Whiteboard: [qa-ver-opt-c163/b162]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: