Bug 1819410 - Ensure we shutdown the RemoteSandboxBrokerParent IPDL instance during launch failures. r=jld

If the process being launched by the sandbox broker crashes after we
setup the IPDL channel, but before we successfully complete the
initialization process, we don't explicitly teardown
RemoteSandboxBrokerParent. As such, when we destroy the owning objects,
it attempts to destroy RemoteSandboxBrokerParent while the protocol is
still open, triggering a release assert for destroying
PRemoteSandboxBrokerParent while the protocol/channel are still open.

This patch makes us explicitly teardown the channel if there is a launch
failure inside the sandbox broker.

Differential Revision: https://phabricator.services.mozilla.com/D171258
This commit is contained in:
Andrew Osmond 2023-03-07 16:25:18 +00:00
parent db773748bb
commit 54093fb0ef

View File

@ -103,6 +103,7 @@ bool RemoteSandboxBroker::LaunchApp(
bool rv = mParent.SendLaunchApp(std::move(mParameters), &ok, &handle) && ok; bool rv = mParent.SendLaunchApp(std::move(mParameters), &ok, &handle) && ok;
mParameters.shareHandles().Clear(); mParameters.shareHandles().Clear();
if (!rv) { if (!rv) {
mParent.Shutdown();
return false; return false;
} }
@ -111,6 +112,7 @@ bool RemoteSandboxBroker::LaunchApp(
HANDLE ourChildHandle = 0; HANDLE ourChildHandle = 0;
bool dh = mParent.DuplicateFromLauncher((HANDLE)handle, &ourChildHandle); bool dh = mParent.DuplicateFromLauncher((HANDLE)handle, &ourChildHandle);
if (!dh) { if (!dh) {
mParent.Shutdown();
return false; return false;
} }