Index: sandbox/linux/services/namespace_sandbox.cc |
diff --git a/sandbox/linux/services/namespace_sandbox.cc b/sandbox/linux/services/namespace_sandbox.cc |
index 23796446f3044e88a6ddcb5d6e38fb41156e8456..ce8ecf1c0d2e71e42293e297ba116ead48ab6ed2 100644 |
--- a/sandbox/linux/services/namespace_sandbox.cc |
+++ b/sandbox/linux/services/namespace_sandbox.cc |
@@ -24,6 +24,7 @@ |
#include "base/process/process.h" |
#include "sandbox/linux/services/credentials.h" |
#include "sandbox/linux/services/namespace_utils.h" |
+#include "sandbox/linux/system_headers/linux_signal.h" |
namespace sandbox { |
@@ -131,26 +132,6 @@ base::Process NamespaceSandbox::LaunchProcess( |
} |
// static |
-pid_t NamespaceSandbox::ForkInNewPidNamespace(bool drop_capabilities_in_child) { |
- const pid_t pid = |
- base::ForkWithFlags(CLONE_NEWPID | SIGCHLD, nullptr, nullptr); |
- if (pid < 0) { |
- return pid; |
- } |
- |
- if (pid == 0) { |
- DCHECK_EQ(1, getpid()); |
- if (drop_capabilities_in_child) { |
- // Since we just forked, we are single-threaded, so this should be safe. |
- CHECK(Credentials::DropAllCapabilitiesOnCurrentThread()); |
- } |
- return 0; |
- } |
- |
- return pid; |
-} |
- |
-// static |
void NamespaceSandbox::InstallDefaultTerminationSignalHandlers() { |
static const int kDefaultTermSignals[] = { |
SIGHUP, SIGINT, SIGABRT, SIGQUIT, SIGPIPE, SIGTERM, SIGUSR1, SIGUSR2, |
@@ -191,6 +172,26 @@ bool NamespaceSandbox::InstallTerminationSignalHandler( |
#endif // !defined(OS_NACL_NONSFI) |
// static |
+pid_t NamespaceSandbox::ForkInNewPidNamespace(bool drop_capabilities_in_child) { |
+ const pid_t pid = |
+ base::ForkWithFlags(CLONE_NEWPID | LINUX_SIGCHLD, nullptr, nullptr); |
+ if (pid < 0) { |
+ return pid; |
+ } |
+ |
+ if (pid == 0) { |
+ DCHECK_EQ(1, getpid()); |
+ if (drop_capabilities_in_child) { |
+ // Since we just forked, we are single-threaded, so this should be safe. |
+ CHECK(Credentials::DropAllCapabilitiesOnCurrentThread()); |
+ } |
+ return 0; |
+ } |
+ |
+ return pid; |
+} |
+ |
+// static |
bool NamespaceSandbox::InNewUserNamespace() { |
return getenv(kSandboxUSERNSEnvironmentVarName) != nullptr; |
} |