Closed Bug 1816857 Opened 2 years ago Closed 2 years ago

Crash in [@ mozilla::ipc::UtilityProcessHost::RejectPromise]

Categories

(Core :: Security: Process Sandboxing, defect, P1)

Unspecified
Windows
defect

Tracking

()

RESOLVED FIXED
113 Branch
Tracking Status
firefox-esr102 --- wontfix
firefox111 --- wontfix
firefox112 --- wontfix
firefox113 --- fixed

People

(Reporter: gsvelto, Assigned: gerard-majax)

References

Details

(Keywords: crash)

Crash Data

Attachments

(1 file)

Crash report: https://crash-stats.mozilla.org/report/index/fb4e53c4-a81c-41e9-ae12-eb2230230214

Reason: EXCEPTION_ACCESS_VIOLATION_WRITE

Top 10 frames of crashing thread:

0  ntdll.dll  RtlAcquireSRWLockExclusive  
1  xul.dll  mozilla::OffTheBooksMutex::Lock  xpcom/threads/Mutex.h:65
1  xul.dll  mozilla::detail::BaseAutoLock<mozilla::Mutex&>::BaseAutoLock  xpcom/threads/Mutex.h:236
1  xul.dll  mozilla::MozPromise<bool, nsresult, 0>::Private::Reject<const nsresult&>  xpcom/threads/MozPromise.h:1233
2  xul.dll  mozilla::ipc::UtilityProcessHost::RejectPromise  ipc/glue/UtilityProcessHost.cpp:316
2  xul.dll  mozilla::ipc::UtilityProcessHost::Shutdown  ipc/glue/UtilityProcessHost.cpp:232
2  xul.dll  mozilla::ipc::UtilityProcessManager::DestroyProcess  ipc/glue/UtilityProcessManager.cpp:439
3  xul.dll  mozilla::ipc::UtilityProcessManager::LaunchProcess  ipc/glue/UtilityProcessManager.cpp:160
4  xul.dll  mozilla::ipc::UtilityProcessManager::StartUtility  ipc/glue/UtilityProcessManager.cpp:229
4  xul.dll  mozilla::ipc::UtilityProcessManager::StartProcessForRemoteMediaDecoding  ipc/glue/UtilityProcessManager.cpp:292

Note: there are no crashes under this signatures because we first need to land bug 1816846 for them to appear, the stack above however represents the problem. It seems that the lock contained within mLaunchPromise is set to NULL which causes the crash.

This seems not content process related, but sandboxing process. I think this can happen since bug 1753424 landed?

Component: DOM: Content Processes → Security: Process Sandboxing

Nika, can you take a look at this while Alexandre is out?

Assignee: nobody → nika
Severity: -- → S3

(In reply to Gabriele Svelto [:gsvelto] from comment #0)

[...]

Note: there are no crashes under this signatures because we first need to land bug 1816846 for them to appear, the stack above however represents the problem. It seems that the lock contained within mLaunchPromise is set to NULL which causes the crash.

I'm curious how this can be. Since the stack mention Shutdown I'm wondering if we could not be just missing a mLaunchPromise = nullptr at some point?

From this crash it seems that mLaunchPromise is actually nullptr where we do not expect it.

IIUC mLaunchPromise is set here but mLaunchPromiseSettled is always initialized false, so if we did never call UtilityProcessHost::LaunchPromise we might be in this state? I think it might be better to initialize mLaunchPromiseSettled to true and set it false only when we successfully created the promise?

It seems this can happen when UtilityProcessHost::Launch fails as it happens before we actually set mLaunchPromise, but DestroyProcess(aSandbox); apparently expects it being there and crashes.

Flags: needinfo?(lissyx+mozillians)

(note that according to searchfox coverage instrumentation this case is not hit during testing)

(I did comment before without having time to really have a look).

If we have Launch() failure, we will likely be able to catch more as soon as I fix to properly get us back error in bug 1819311.
I'm not sure however looking at https://crash-stats.mozilla.org/report/index/5b3fb790-3584-41b7-83a5-9864a0230304 that mLaunchPromise = nullptr, shouldn't we dont see mozilla::MozPromise<bool, nsresult, 0>::Private::Reject<const nsresult&>(nsresult const&, char const*) in the stack if it was the case?

Flags: needinfo?(lissyx+mozillians)

(In reply to Alexandre LISSY :gerard-majax from comment #6)

I'm not sure however looking at https://crash-stats.mozilla.org/report/index/5b3fb790-3584-41b7-83a5-9864a0230304 that mLaunchPromise = nullptr, shouldn't we dont see mozilla::MozPromise<bool, nsresult, 0>::Private::Reject<const nsresult&>(nsresult const&, char const*) in the stack if it was the case?

I think that there is nothing that would prevent us from calling Reject on a nullptr here. And yesterday I also looked at this stack's minidump in VS which also showed mLaunchPromise to be null when we get there (to be taken with a grain of salt, of course, as minidumps do not contain all the memory, but still).

Anyway, I've prepared a patch with your suggestion, but forgot to try it (now I did: https://treeherder.mozilla.org/jobs?repo=try&revision=c78c6a43b46fda7209b6a1964d702706a2e32d9b). I did that quite late, so I'd like to come back at it soon to make sure it's right.

Wondering if we should not just check for mLaunchPromise instead of changing the logic around.

(In reply to Alexandre LISSY :gerard-majax from comment #10)

Wondering if we should not just check for mLaunchPromise instead of changing the logic around.

Yeah, this way we would be able to keep the information if we ever started the promise: nullptr and mLaunchPromiseSettled == false would indicate we never started it, while nullptr and mLaunchPromiseSettled == true would tell us that it ran and settled.

Attachment #9321508 - Attachment description: WIP: Bug 1816857 - Avoid empty launch promise on Utility launch failure → Bug 1816857 - Avoid empty launch promise on Utility launch failure r?nika!
Assignee: nika → lissyx+mozillians
Priority: -- → P1
Pushed by alissy@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/148ae2898c4a Avoid empty launch promise on Utility launch failure r=nika
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch

The patch landed in nightly and beta is affected.
:gerard-majax, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox112 to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(lissyx+mozillians)
Flags: needinfo?(lissyx+mozillians)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: