Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Unified Diff: sandbox/linux/services/namespace_sandbox.cc

Issue 1310773006: Update sandbox/linux from upstream (Closed) Base URL: ssh://ssh.github.com/domokit/mojo.git@master
Patch Set: Update to 3909ebfa69566f7374a6900e63cd4d3c73a35378 Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sandbox/linux/services/namespace_sandbox.h ('k') | sandbox/linux/services/namespace_sandbox_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4b2e5886bdf7cff9c605daa43ee67118627668eb 100644
--- a/sandbox/linux/services/namespace_sandbox.cc
+++ b/sandbox/linux/services/namespace_sandbox.cc
@@ -24,6 +24,8 @@
#include "base/process/process.h"
#include "sandbox/linux/services/credentials.h"
#include "sandbox/linux/services/namespace_utils.h"
+#include "sandbox/linux/services/syscall_wrappers.h"
+#include "sandbox/linux/system_headers/linux_signal.h"
namespace sandbox {
@@ -65,6 +67,7 @@ void SetEnvironForNamespaceType(base::EnvironmentMap* environ,
// An empty string causes the env var to be unset in the child process.
(*environ)[env_var] = value ? "1" : "";
}
+#endif // !defined(OS_NACL_NONSFI)
// Linux supports up to 64 signals. This should be updated if that ever changes.
int g_signal_exit_codes[64];
@@ -77,9 +80,8 @@ void TerminationSignalHandler(int sig) {
_exit(g_signal_exit_codes[sig_idx]);
}
- _exit(NamespaceSandbox::kDefaultExitCode);
+ _exit(NamespaceSandbox::SignalExitCode(sig));
}
-#endif // !defined(OS_NACL_NONSFI)
} // namespace
@@ -129,11 +131,12 @@ base::Process NamespaceSandbox::LaunchProcess(
return base::LaunchProcess(argv, launch_options);
}
+#endif // !defined(OS_NACL_NONSFI)
// static
pid_t NamespaceSandbox::ForkInNewPidNamespace(bool drop_capabilities_in_child) {
const pid_t pid =
- base::ForkWithFlags(CLONE_NEWPID | SIGCHLD, nullptr, nullptr);
+ base::ForkWithFlags(CLONE_NEWPID | LINUX_SIGCHLD, nullptr, nullptr);
if (pid < 0) {
return pid;
}
@@ -153,11 +156,12 @@ pid_t NamespaceSandbox::ForkInNewPidNamespace(bool drop_capabilities_in_child) {
// static
void NamespaceSandbox::InstallDefaultTerminationSignalHandlers() {
static const int kDefaultTermSignals[] = {
- SIGHUP, SIGINT, SIGABRT, SIGQUIT, SIGPIPE, SIGTERM, SIGUSR1, SIGUSR2,
+ LINUX_SIGHUP, LINUX_SIGINT, LINUX_SIGABRT, LINUX_SIGQUIT,
+ LINUX_SIGPIPE, LINUX_SIGTERM, LINUX_SIGUSR1, LINUX_SIGUSR2,
};
for (const int sig : kDefaultTermSignals) {
- InstallTerminationSignalHandler(sig, kDefaultExitCode);
+ InstallTerminationSignalHandler(sig, SignalExitCode(sig));
}
}
@@ -166,12 +170,16 @@ bool NamespaceSandbox::InstallTerminationSignalHandler(
int sig,
int exit_code) {
struct sigaction old_action;
- PCHECK(sigaction(sig, nullptr, &old_action) == 0);
+ PCHECK(sys_sigaction(sig, nullptr, &old_action) == 0);
+#if !defined(OS_NACL_NONSFI)
if (old_action.sa_flags & SA_SIGINFO &&
old_action.sa_sigaction != nullptr) {
return false;
- } else if (old_action.sa_handler != SIG_DFL) {
+ }
+#endif
+
+ if (old_action.sa_handler != LINUX_SIG_DFL) {
return false;
}
@@ -185,10 +193,9 @@ bool NamespaceSandbox::InstallTerminationSignalHandler(
struct sigaction action = {};
action.sa_handler = &TerminationSignalHandler;
- PCHECK(sigaction(sig, &action, nullptr) == 0);
+ PCHECK(sys_sigaction(sig, &action, nullptr) == 0);
return true;
}
-#endif // !defined(OS_NACL_NONSFI)
// static
bool NamespaceSandbox::InNewUserNamespace() {
« no previous file with comments | « sandbox/linux/services/namespace_sandbox.h ('k') | sandbox/linux/services/namespace_sandbox_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698