Bug 1313808 - Part 2: Move SandboxEarlyInit call into libxul. r=tedd r?glandium
MozReview-Commit-ID: 2EY0wadYhO0
--- a/ipc/app/moz.build
+++ b/ipc/app/moz.build
@@ -58,27 +58,16 @@ if CONFIG['OS_ARCH'] == 'WINNT':
'winmm.dll',
'user32.dll',
]
DELAYLOAD_DLLS += [
'xul.dll',
]
-if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_TARGET'] in ('Linux', 'Android'):
- USE_LIBS += [
- 'mozsandbox',
- ]
-
- # gcc lto likes to put the top level asm in syscall.cc in a different partition
- # from the function using it which breaks the build. Work around that by
- # forcing there to be only one partition.
- if '-flto' in CONFIG['OS_CXXFLAGS'] and not CONFIG['CLANG_CXX']:
- LDFLAGS += ['--param lto-partitions=1']
-
if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_TARGET'] == 'Darwin':
# For sandbox includes and the include dependencies those have
LOCAL_INCLUDES += [
'/security/sandbox/chromium',
'/security/sandbox/chromium-shim',
]
USE_LIBS += [
'mozsandbox',
--- a/ipc/app/pie/moz.build
+++ b/ipc/app/pie/moz.build
@@ -11,20 +11,9 @@ SOURCES += [
include('/ipc/chromium/chromium-config.mozbuild')
LOCAL_INCLUDES += [
'/toolkit/xre',
'/xpcom/base',
]
-if CONFIG['MOZ_SANDBOX']:
- USE_LIBS += [
- 'mozsandbox',
- ]
-
- # gcc lto likes to put the top level asm in syscall.cc in a different partition
- # from the function using it which breaks the build. Work around that by
- # forcing there to be only one partition.
- if '-flto' in CONFIG['OS_CXXFLAGS'] and not CONFIG['CLANG_CXX']:
- LDFLAGS += ['--param lto-partitions=1']
-
LDFLAGS += ['-pie']
--- a/ipc/contentproc/plugin-container.cpp
+++ b/ipc/contentproc/plugin-container.cpp
@@ -22,21 +22,16 @@
#include "GMPLoader.h"
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
#include "mozilla/sandboxing/SandboxInitialization.h"
#include "mozilla/sandboxing/sandboxLogging.h"
#endif
-#if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
-#include "mozilla/Sandbox.h"
-#include "mozilla/SandboxInfo.h"
-#endif
-
#ifdef MOZ_WIDGET_GONK
# include <sys/time.h>
# include <sys/resource.h>
# include <binder/ProcessState.h>
# ifdef LOGE_IF
# undef LOGE_IF
@@ -134,23 +129,16 @@ content_process_main(int argc, char* arg
}
childData.ProvideLogFunction = mozilla::sandboxing::ProvideLogFunction;
}
#endif
XRE_SetProcessType(argv[--argc]);
-#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
- // This has to happen while we're still single-threaded, and on
- // B2G that means before the Android Binder library is
- // initialized.
- mozilla::SandboxEarlyInit(XRE_GetProcessType());
-#endif
-
#ifdef MOZ_WIDGET_GONK
// This creates a ThreadPool for binder ipc. A ThreadPool is necessary to
// receive binder calls, though not necessary to send binder calls.
// ProcessState::Self() also needs to be called once on the main thread to
// register the main thread with the binder driver.
InitializeBinder(nullptr);
#endif
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -356,16 +356,21 @@ XRE_InitChildProcess(int aArgc,
char* aArgv[],
const XREChildData* aChildData)
{
NS_ENSURE_ARG_MIN(aArgc, 2);
NS_ENSURE_ARG_POINTER(aArgv);
NS_ENSURE_ARG_POINTER(aArgv[0]);
MOZ_ASSERT(aChildData);
+#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
+ // This has to happen while we're still single-threaded.
+ mozilla::SandboxEarlyInit(XRE_GetProcessType());
+#endif
+
#ifdef MOZ_JPROF
// Call the code to install our handler
setupProfilingStuff();
#endif
#ifdef XP_LINUX
// On Fennec, the GMPLoader's code resides inside XUL (because for the time
// being GMPLoader relies upon NSPR, which we can't use in plugin-container