From 8dbc2041aae4c44499a2751e612eff5b51a63295 Mon Sep 17 00:00:00 2001 From: Jed Davis Date: Tue, 15 Oct 2013 10:02:26 -0400 Subject: [PATCH] Bug 921817 - Enable sandbox in non-preallocated child processes. r=kang, r=bent --- dom/ipc/ContentParent.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 35a32ba4071f..5faeef5af3c1 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -1502,6 +1502,17 @@ ContentParent::ContentParent(mozIApplication* aApp, } } +#ifdef MOZ_CONTENT_SANDBOX + // Bug 921817. We enable the sandbox in RecvSetProcessPrivileges, + // which is where a preallocated process drops unnecessary privileges, + // but a non-preallocated process will already have changed its + // uid/gid/etc immediately after forking. Thus, we send this message, + // which is otherwise a no-op, to sandbox it at an appropriate point + // during startup. + if (aOSPrivileges != base::PRIVILEGES_INHERIT) { + SendSetProcessPrivileges(base::PRIVILEGES_INHERIT); + } +#endif } #ifdef MOZ_NUWA_PROCESS