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

Unified Diff: sandbox/linux/seccomp/sandbox_impl.h

Issue 371047: Allow the seccomp sandbox to be enabled, even if the suid sandbox has... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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
« no previous file with comments | « sandbox/linux/seccomp/sandbox.cc ('k') | sandbox/linux/seccomp/securemem.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/seccomp/sandbox_impl.h
===================================================================
--- sandbox/linux/seccomp/sandbox_impl.h (revision 31339)
+++ sandbox/linux/seccomp/sandbox_impl.h (working copy)
@@ -49,12 +49,23 @@
// This could be because the kernel does not support Seccomp mode, or it
// could be because we fail to successfully rewrite all system call entry
// points.
- static int supportsSeccompSandbox() asm("SupportsSeccompSandbox");
+ // "proc_fd" should be a file descriptor for "/proc", or -1 if not provided
+ // by the caller.
+ static int supportsSeccompSandbox(int proc_fd)
+ asm("SupportsSeccompSandbox");
+ // The sandbox needs to be able to access "/proc/self/maps". If this file
+ // is not accessible when "startSandbox()" gets called, the caller can
+ // provide an already opened file descriptor by calling "setProcSelfMaps()".
+ // The sandbox becomes the newer owner of this file descriptor and will
+ // eventually close it when "startSandbox()" executes.
+ static void setProcSelfMaps(int proc_self_maps)
+ asm("SeccompSandboxSetProcSelfMaps");
+
// This is the main public entry point. It finds all system calls that
// need rewriting, sets up the resources needed by the sandbox, and
// enters Seccomp mode.
- static void startSandbox() asm("StartSeccompSandbox");
+ static void startSandbox() asm("StartSeccompSandbox");
private:
// syscall_table.c has to be implemented in C, as C++ does not support
@@ -589,15 +600,16 @@
// memory mappings that existed when the sandbox was first enabled. Going
// forward, all these mappings are off-limits for operations such as
// mmap(), munmap(), and mprotect().
- static void initializeProtectedMap(int fd);
+ static int initializeProtectedMap(int fd);
// Helper functions that allows the trusted process to get access to
// "/proc/self/maps" in the sandbox.
- static void snapshotMemoryMappings(int processFd);
+ static void snapshotMemoryMappings(int processFd, int proc_self_maps);
// Main loop for the trusted process.
- static void trustedProcess(int parentProc, int processFdPub, int sandboxFd,
- int cloneFd, SecureMem::Args* secureArena)
+ static void trustedProcess(int parentMapsFd, int processFdPub,
+ int sandboxFd, int cloneFd,
+ SecureMem::Args* secureArena)
__attribute__((noreturn));
// Fork()s of the trusted process.
@@ -609,6 +621,7 @@
static void createTrustedThread(int processFdPub, int cloneFdPub,
SecureMem::Args* secureMem);
+ static int proc_self_maps_;
static enum SandboxStatus {
STATUS_UNKNOWN, STATUS_UNSUPPORTED, STATUS_AVAILABLE, STATUS_ENABLED
} status_;
« no previous file with comments | « sandbox/linux/seccomp/sandbox.cc ('k') | sandbox/linux/seccomp/securemem.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698