Commit 0d71623b authored by Aaron Klotz's avatar Aaron Klotz
Browse files

Bug 1531030: Use MOZ_DISABLE_POISON_IO_INTERPOSER to disable...

Bug 1531030: Use MOZ_DISABLE_POISON_IO_INTERPOSER to disable PoisonIOInterposer when it is unsafe to initialize; r=erahm

If we are running a background thread in the launcher process to log failures,
then allowing the main thread to proceed with monkeypatching system calls is a
Bad Idea. This patch gives us an environment variable that, when set, indicates
that it is unsafe for PoisonIOInterposer to run.

This scenario is an uncommon one, but one that we must account for nonetheless.

Differential Revision:

extra : moz-landing-system : lando
parent e612be8f
......@@ -695,6 +695,13 @@ static bool SendPing(const mozilla::LauncherError& aError) {
#endif // defined(MOZ_LAUNCHER_PROCESS)
// We send this ping when the launcher process fails. After we start the
// SendPingThread, this thread falls back from running as the launcher process
// to running as the browser main thread. Once this happens, it will be unsafe
// to set up PoisonIOInterposer (since we have already spun up a background
// thread).
// Capture aError and our module list into context for processing on another
// thread.
auto thdParam = mozilla::MakeUnique<PingThreadContext>(aError);
......@@ -22,6 +22,7 @@
#endif // !defined(XP_WIN)
#include "nsXULAppAPI.h"
#include "PoisonIOInterposer.h"
#include "prenv.h"
using namespace mozilla;
......@@ -396,7 +397,14 @@ bool IOInterposer::Init() {
// Now we initialize the various interposers depending on platform
// Under certain conditions it may be unsafe to initialize PoisonIOInterposer,
// such as when a background thread is already running. We set this variable
// elsewhere when such a condition applies.
// We don't hook NSPR on Windows because PoisonIOInterposer captures a
// superset of the former's events.
#if !defined(XP_WIN)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment