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

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

Issue 733303004: Linux sandbox: change API to start the sandbox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month 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.h
diff --git a/content/common/sandbox_linux/sandbox_linux.h b/content/common/sandbox_linux/sandbox_linux.h
index a5a232277e9f87843da45b7f001a6fabef45578c..6b1fafcab13242e2af19ba9277341740ddaf9fbb 100644
--- a/content/common/sandbox_linux/sandbox_linux.h
+++ b/content/common/sandbox_linux/sandbox_linux.h
@@ -6,6 +6,7 @@
#define CONTENT_COMMON_SANDBOX_LINUX_SANDBOX_LINUX_H_
#include <string>
+#include <vector>
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
@@ -49,8 +50,21 @@ class LinuxSandbox {
// Do some initialization that can only be done before any of the sandboxes
// are enabled. If using the setuid sandbox, this should be called manually
// before the setuid sandbox is engaged.
+ // Security: When this runs, it is imperative that either InitializeSandbox()
+ // runs as well or that all file descriptors returned in
+ // GetFileDescriptorsToClose()
+ // get closed.
+ // Otherwise file descriptors that bypass the security of the setuid sandbox
+ // would be kept open. One must be particularly careful if a process performs
+ // a fork().
void PreinitializeSandbox();
+ // Return a list of file descriptors to close if PreinitializeSandbox() ran
+ // but
+ // InitializeSandbox won't. Avoid using.
+ // TODO(jln): get rid of this hack.
+ std::vector<int> GetFileDescriptorsToClose();
+
// Initialize the sandbox with the given pre-built configuration. Currently
// seccomp-bpf and address space limitations (the setuid sandbox works
// differently and is set-up in the Zygote). This will instantiate the

Powered by Google App Engine
This is Rietveld 408576698