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

Unified Diff: content/common/sandbox_linux/sandbox_linux.cc

Issue 868233011: Start all children in their own PID namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only drop capabilities if we have any. Created 5 years, 10 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
Index: content/common/sandbox_linux/sandbox_linux.cc
diff --git a/content/common/sandbox_linux/sandbox_linux.cc b/content/common/sandbox_linux/sandbox_linux.cc
index 5eee4e1d6c14d47e785a0ac42e4c8a77a93d6383..773277da2bdc818017d39d435c02e609bea25c1f 100644
--- a/content/common/sandbox_linux/sandbox_linux.cc
+++ b/content/common/sandbox_linux/sandbox_linux.cc
@@ -4,6 +4,7 @@
#include <dirent.h>
#include <fcntl.h>
+#include <sys/capability.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/time.h>
@@ -186,7 +187,11 @@ void LinuxSandbox::EngageNamespaceSandbox() {
// Note: this requires SealSandbox() to be called later in this process to be
// safe, as this class is keeping a file descriptor to /proc/.
CHECK(sandbox::Credentials::DropFileSystemAccess(proc_fd_));
- CHECK(sandbox::Credentials::DropAllCapabilities(proc_fd_));
+
+ // We do not drop CAP_SYS_ADMIN because we need it to place each child process
+ // in its own PID namespace later on.
+ const std::vector<cap_value_t> caps(1, CAP_SYS_ADMIN);
+ CHECK(sandbox::Credentials::SetCapabilities(proc_fd_, caps));
// This needs to happen after moving to a new user NS, since doing so involves
// writing the UID/GID map.

Powered by Google App Engine
This is Rietveld 408576698