diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 6cb0f9f0e257..a9f995b71717 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -146,6 +146,7 @@ # include "CubebUtils.h" # include "mozilla/Sandbox.h" # include "mozilla/SandboxInfo.h" +# include "mozilla/SandboxProfilerObserver.h" # elif defined(XP_MACOSX) # include # include "mozilla/Sandbox.h" @@ -1709,6 +1710,7 @@ mozilla::ipc::IPCResult ContentChild::RecvSetProcessSandbox( } if (sandboxEnabled) { + RegisterProfilerObserversForSandboxProfiler(); sandboxEnabled = SetContentProcessSandbox( ContentProcessSandboxParams::ForThisProcess(aBroker)); } @@ -2151,6 +2153,10 @@ mozilla::ipc::IPCResult ContentChild::RecvSetTRRMode( } void ContentChild::ActorDestroy(ActorDestroyReason why) { +#if defined(XP_LINUX) && defined(MOZ_SANDBOX) + DestroySandboxProfiler(); +#endif + if (mForceKillTimer) { mForceKillTimer->Cancel(); mForceKillTimer = nullptr; diff --git a/dom/media/gmp/GMPChild.cpp b/dom/media/gmp/GMPChild.cpp index ca8b6a4ed412..d627b7c81dcf 100644 --- a/dom/media/gmp/GMPChild.cpp +++ b/dom/media/gmp/GMPChild.cpp @@ -12,7 +12,10 @@ #include "GeckoProfiler.h" #ifdef XP_LINUX # include "dlfcn.h" -#endif +# if defined(MOZ_SANDBOX) +# include "mozilla/Sandbox.h" +# endif // defined(MOZ_SANDBOX) +#endif // defined (XP_LINUX) #include "gmp-video-decode.h" #include "gmp-video-encode.h" #include "GMPContentChild.h" @@ -567,6 +570,10 @@ MessageLoop* GMPChild::GMPMessageLoop() { return mGMPMessageLoop; } void GMPChild::ActorDestroy(ActorDestroyReason aWhy) { GMP_CHILD_LOG_DEBUG("%s reason=%d", __FUNCTION__, aWhy); +#if defined(XP_LINUX) && defined(MOZ_SANDBOX) + DestroySandboxProfiler(); +#endif + for (uint32_t i = mGMPContentChildren.Length(); i > 0; i--) { MOZ_ASSERT_IF(aWhy == NormalShutdown, !mGMPContentChildren[i - 1]->IsUsed()); diff --git a/dom/media/gmp/GMPLoader.cpp b/dom/media/gmp/GMPLoader.cpp index c0c9364c7bb1..0a684d645224 100644 --- a/dom/media/gmp/GMPLoader.cpp +++ b/dom/media/gmp/GMPLoader.cpp @@ -20,6 +20,7 @@ #if defined(XP_LINUX) && defined(MOZ_SANDBOX) # include "mozilla/Sandbox.h" # include "mozilla/SandboxInfo.h" +# include "mozilla/SandboxProfilerObserver.h" #endif #include @@ -179,6 +180,7 @@ class LinuxSandboxStarter : public mozilla::gmp::SandboxStarter { return nullptr; } bool Start(const char* aLibPath) override { + RegisterProfilerObserversForSandboxProfiler(); mozilla::SetMediaPluginSandbox(aLibPath); return true; } diff --git a/dom/media/ipc/RDDParent.cpp b/dom/media/ipc/RDDParent.cpp index 4b6c1372ce29..f85f24eaeeeb 100644 --- a/dom/media/ipc/RDDParent.cpp +++ b/dom/media/ipc/RDDParent.cpp @@ -32,6 +32,7 @@ #if defined(XP_LINUX) && defined(MOZ_SANDBOX) # include "mozilla/Sandbox.h" +# include "mozilla/SandboxProfilerObserver.h" #endif #include "ChildProfilerController.h" @@ -149,6 +150,7 @@ mozilla::ipc::IPCResult RDDParent::RecvInit( if (aBrokerFd.isSome()) { fd = aBrokerFd.value().ClonePlatformHandle().release(); } + RegisterProfilerObserversForSandboxProfiler(); SetRemoteDataDecoderSandbox(fd); # endif // XP_MACOSX/XP_LINUX #endif // MOZ_SANDBOX @@ -288,6 +290,10 @@ mozilla::ipc::IPCResult RDDParent::RecvTestTelemetryProbes() { } void RDDParent::ActorDestroy(ActorDestroyReason aWhy) { +#if defined(XP_LINUX) && defined(MOZ_SANDBOX) + DestroySandboxProfiler(); +#endif + if (AbnormalShutdown == aWhy) { NS_WARNING("Shutting down RDD process early due to a crash!"); Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT, "rdd"_ns, 1); diff --git a/ipc/glue/UtilityProcessChild.cpp b/ipc/glue/UtilityProcessChild.cpp index d99c2fb361dd..122e801ba48f 100644 --- a/ipc/glue/UtilityProcessChild.cpp +++ b/ipc/glue/UtilityProcessChild.cpp @@ -19,6 +19,7 @@ #if defined(XP_LINUX) && defined(MOZ_SANDBOX) # include "mozilla/Sandbox.h" +# include "mozilla/SandboxProfilerObserver.h" #endif #if defined(XP_OPENBSD) && defined(MOZ_SANDBOX) @@ -180,6 +181,7 @@ mozilla::ipc::IPCResult UtilityProcessChild::RecvInit( fd = aBrokerFd.value().ClonePlatformHandle().release(); } + RegisterProfilerObserversForSandboxProfiler(); SetUtilitySandbox(fd, mSandbox); # endif // XP_MACOSX/XP_LINUX @@ -348,6 +350,10 @@ UtilityProcessChild::RecvUnblockUntrustedModulesThread() { #endif // defined(XP_WIN) void UtilityProcessChild::ActorDestroy(ActorDestroyReason aWhy) { +#if defined(XP_LINUX) && defined(MOZ_SANDBOX) + DestroySandboxProfiler(); +#endif + if (AbnormalShutdown == aWhy) { NS_WARNING("Shutting down Utility process early due to a crash!"); ipc::ProcessChild::QuickExit(); diff --git a/netwerk/ipc/SocketProcessChild.cpp b/netwerk/ipc/SocketProcessChild.cpp index 943094f790c9..e23653f86032 100644 --- a/netwerk/ipc/SocketProcessChild.cpp +++ b/netwerk/ipc/SocketProcessChild.cpp @@ -60,6 +60,7 @@ #if defined(XP_LINUX) && defined(MOZ_SANDBOX) # include "mozilla/Sandbox.h" +# include "mozilla/SandboxProfilerObserver.h" #endif #include "ChildProfilerController.h" @@ -225,6 +226,10 @@ void SocketProcessChild::ActorDestroy(ActorDestroyReason aWhy) { mShuttingDown = true; } +#if defined(XP_LINUX) && defined(MOZ_SANDBOX) + DestroySandboxProfiler(); +#endif + if (AbnormalShutdown == aWhy) { NS_WARNING("Shutting down Socket process early due to a crash!"); ProcessChild::QuickExit(); @@ -339,6 +344,7 @@ mozilla::ipc::IPCResult SocketProcessChild::RecvInitLinuxSandbox( if (aBrokerFd.isSome()) { fd = aBrokerFd.value().ClonePlatformHandle().release(); } + RegisterProfilerObserversForSandboxProfiler(); SetSocketProcessSandbox(fd); #endif // XP_LINUX && MOZ_SANDBOX return IPC_OK();