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

Side by Side Diff: components/nacl/loader/sandbox_linux/nacl_sandbox_linux.h

Issue 919203002: Linux Sandbox: add resource limits to NaCl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Correct typo. 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/nacl/loader/sandbox_linux/nacl_sandbox_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_NACL_LOADER_SANDBOX_LINUX_NACL_SANDBOX_LINUX_H_ 5 #ifndef COMPONENTS_NACL_LOADER_SANDBOX_LINUX_NACL_SANDBOX_LINUX_H_
6 #define COMPONENTS_NACL_LOADER_SANDBOX_LINUX_NACL_SANDBOX_LINUX_H_ 6 #define COMPONENTS_NACL_LOADER_SANDBOX_LINUX_NACL_SANDBOX_LINUX_H_
7 7
8 #include "base/files/scoped_file.h" 8 #include "base/files/scoped_file.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // layer-2 sandbox is not engaged. 43 // layer-2 sandbox is not engaged.
44 bool IsSingleThreaded(); 44 bool IsSingleThreaded();
45 // Check whether the current process owns any directory file descriptors. This 45 // Check whether the current process owns any directory file descriptors. This
46 // will ignore any directory file descriptor owned by this object (i.e. those 46 // will ignore any directory file descriptor owned by this object (i.e. those
47 // that will be closed after SealLayerOneSandbox()) is called. 47 // that will be closed after SealLayerOneSandbox()) is called.
48 // This API will only work if the layer-1 sandbox is not sealed and the 48 // This API will only work if the layer-1 sandbox is not sealed and the
49 // layer-2 sandbox is not engaged. 49 // layer-2 sandbox is not engaged.
50 bool HasOpenDirectory(); 50 bool HasOpenDirectory();
51 // Will attempt to initialize the layer-1 sandbox, depending on flags and the 51 // Will attempt to initialize the layer-1 sandbox, depending on flags and the
52 // environment. It can only succeed if the current process is a child of the 52 // environment. It can only succeed if the current process is a child of the
53 // setuid sandbox. 53 // setuid sandbox or was started by the namespace sandbox.
54 void InitializeLayerOneSandbox(); 54 void InitializeLayerOneSandbox();
55 // Will attempt to initialize the layer-2 sandbox, depending on flags and the 55 // Will attempt to initialize the layer-2 sandbox, depending on flags and the
56 // environment. |uses_nonsfi_mode| describes which seccomp-bpf policy is 56 // environment. |uses_nonsfi_mode| describes which seccomp-bpf policy is
57 // appropriate. 57 // appropriate.
58 // This layer will also add a limit to how much of the address space can be
59 // used.
58 void InitializeLayerTwoSandbox(bool uses_nonsfi_mode); 60 void InitializeLayerTwoSandbox(bool uses_nonsfi_mode);
59 // Seal the layer-1 sandbox, making it enforcing. 61 // Seal the layer-1 sandbox, making it enforcing.
60 void SealLayerOneSandbox(); 62 void SealLayerOneSandbox();
61 // Check that the current sandboxing state matches the level of sandboxing 63 // Check that the current sandboxing state matches the level of sandboxing
62 // expected for NaCl in the current configuration. Crash if it does not. 64 // expected for NaCl in the current configuration. Crash if it does not.
63 void CheckSandboxingStateWithPolicy(); 65 void CheckSandboxingStateWithPolicy();
64 66
65 bool layer_one_enabled() { return layer_one_enabled_; } 67 bool layer_one_enabled() { return layer_one_enabled_; }
66 bool layer_two_enabled() { return layer_two_enabled_; } 68 bool layer_two_enabled() { return layer_two_enabled_; }
67 69
68 private: 70 private:
69 void CheckForExpectedNumberOfOpenFds(); 71 void CheckForExpectedNumberOfOpenFds();
70 72
71 bool layer_one_enabled_; 73 bool layer_one_enabled_;
72 bool layer_one_sealed_; 74 bool layer_one_sealed_;
73 bool layer_two_enabled_; 75 bool layer_two_enabled_;
74 bool layer_two_is_nonsfi_; 76 bool layer_two_is_nonsfi_;
75 // |proc_fd_| must be released before the layer-1 sandbox is considered 77 // |proc_fd_| must be released before the layer-1 sandbox is considered
76 // enforcing. 78 // enforcing.
77 base::ScopedFD proc_fd_; 79 base::ScopedFD proc_fd_;
78 scoped_ptr<sandbox::SetuidSandboxClient> setuid_sandbox_client_; 80 scoped_ptr<sandbox::SetuidSandboxClient> setuid_sandbox_client_;
79 DISALLOW_COPY_AND_ASSIGN(NaClSandbox); 81 DISALLOW_COPY_AND_ASSIGN(NaClSandbox);
80 }; 82 };
81 83
82 } // namespace nacl 84 } // namespace nacl
83 85
84 #endif // COMPONENTS_NACL_LOADER_SANDBOX_LINUX_NACL_SANDBOX_LINUX_H_ 86 #endif // COMPONENTS_NACL_LOADER_SANDBOX_LINUX_NACL_SANDBOX_LINUX_H_
OLDNEW
« no previous file with comments | « no previous file | components/nacl/loader/sandbox_linux/nacl_sandbox_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698