Bug 1614885 - Do not attempt to bootstrap a child process if the launcher failed to boostrap the browser process. r=aklotz

Bug 1522830 added the call to `InitializeDllBlocklistOOP` in `SandboxBroker::LaunchApp`
to enable the new dll blocklist and telemetry in sandbox processes.  If the browser
process fails to bootstrap a process for some reason, firefox starts without any crash
nor any content processes because of that change.

What is worse is that this problem persists even after the launcher process was disabled.
To mitigate it, this patch stops an attempt to bootstrap a child process if the launcher
process already failed to do it.  With this, if something bad happens in the first launch,
the launcher process is automatically disabled via registry and next time firefox will work
normally.  So a user will see the launching problem only once.

We will follow up the bootstrap issue.

Differential Revision: https://phabricator.services.mozilla.com/D62636

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Toshihito Kikuchi 2020-02-13 05:49:03 +00:00
Родитель 526482fc87
Коммит 0d056e0130
3 изменённых файлов: 28 добавлений и 2 удалений

Просмотреть файл

@ -33,9 +33,14 @@ LauncherVoidResultWithLineInfo InitializeDllBlocklistOOP(
return mozilla::Ok();
}
LauncherVoidResultWithLineInfo InitializeDllBlocklistOOPFromLauncher(
const wchar_t* aFullImagePath, HANDLE aChildProcess) {
return mozilla::Ok();
}
#else
LauncherVoidResultWithLineInfo InitializeDllBlocklistOOP(
static LauncherVoidResultWithLineInfo InitializeDllBlocklistOOPInternal(
const wchar_t* aFullImagePath, HANDLE aChildProcess) {
CrossProcessDllInterceptor intcpt(aChildProcess);
intcpt.Init(L"ntdll.dll");
@ -127,6 +132,23 @@ LauncherVoidResultWithLineInfo InitializeDllBlocklistOOP(
return Ok();
}
LauncherVoidResultWithLineInfo InitializeDllBlocklistOOP(
const wchar_t* aFullImagePath, HANDLE aChildProcess) {
// We come here when the browser process launches a sandbox process.
// If the launcher process already failed to bootstrap the browser process,
// we should not attempt to bootstrap a child process.
if (!(gBlocklistInitFlags & eDllBlocklistInitFlagWasBootstrapped)) {
return Ok();
}
return InitializeDllBlocklistOOPInternal(aFullImagePath, aChildProcess);
}
LauncherVoidResultWithLineInfo InitializeDllBlocklistOOPFromLauncher(
const wchar_t* aFullImagePath, HANDLE aChildProcess) {
return InitializeDllBlocklistOOPInternal(aFullImagePath, aChildProcess);
}
#endif // defined(MOZ_ASAN) || defined(_M_ARM64)
} // namespace mozilla

Просмотреть файл

@ -16,6 +16,9 @@ namespace mozilla {
LauncherVoidResultWithLineInfo InitializeDllBlocklistOOP(
const wchar_t* aFullImagePath, HANDLE aChildProcess);
LauncherVoidResultWithLineInfo InitializeDllBlocklistOOPFromLauncher(
const wchar_t* aFullImagePath, HANDLE aChildProcess);
} // namespace mozilla
#endif // mozilla_DllBlocklistInit_h

Просмотреть файл

@ -43,7 +43,8 @@
static mozilla::LauncherVoidResult PostCreationSetup(
const wchar_t* aFullImagePath, HANDLE aChildProcess,
HANDLE aChildMainThread, const bool aIsSafeMode) {
return mozilla::InitializeDllBlocklistOOP(aFullImagePath, aChildProcess);
return mozilla::InitializeDllBlocklistOOPFromLauncher(aFullImagePath,
aChildProcess);
}
#if !defined( \