OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_COMMON_SANDBOX_LINUX_SANDBOX_LINUX_H_ | 5 #ifndef CONTENT_COMMON_SANDBOX_LINUX_SANDBOX_LINUX_H_ |
6 #define CONTENT_COMMON_SANDBOX_LINUX_SANDBOX_LINUX_H_ | 6 #define CONTENT_COMMON_SANDBOX_LINUX_SANDBOX_LINUX_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "content/public/common/sandbox_linux.h" | 14 #include "content/public/common/sandbox_linux.h" |
15 | 15 |
16 #if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \ | 16 #if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \ |
17 defined(THREAD_SANITIZER) || defined(LEAK_SANITIZER) || \ | 17 defined(THREAD_SANITIZER) || defined(LEAK_SANITIZER) || \ |
18 defined(UNDEFINED_SANITIZER) || defined(SANITIZER_COVERAGE) | 18 defined(UNDEFINED_SANITIZER) || defined(SANITIZER_COVERAGE) |
19 #include <sanitizer/common_interface_defs.h> | 19 #include <sanitizer/common_interface_defs.h> |
20 #define ANY_OF_AMTLU_SANITIZER 1 | 20 #define ANY_OF_AMTLU_SANITIZER 1 |
21 #endif | 21 #endif |
22 | 22 |
23 template <typename T> struct DefaultSingletonTraits; | |
24 namespace base { | 23 namespace base { |
| 24 template <typename T> |
| 25 struct DefaultSingletonTraits; |
25 class Thread; | 26 class Thread; |
26 } | 27 } |
27 namespace sandbox { class SetuidSandboxClient; } | 28 namespace sandbox { class SetuidSandboxClient; } |
28 | 29 |
29 namespace content { | 30 namespace content { |
30 | 31 |
31 // A singleton class to represent and change our sandboxing state for the | 32 // A singleton class to represent and change our sandboxing state for the |
32 // three main Linux sandboxes. | 33 // three main Linux sandboxes. |
33 // The sandboxing model allows using two layers of sandboxing. The first layer | 34 // The sandboxing model allows using two layers of sandboxing. The first layer |
34 // can be implemented either with unprivileged namespaces or with the setuid | 35 // can be implemented either with unprivileged namespaces or with the setuid |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 return proc_fd_; | 127 return proc_fd_; |
127 } | 128 } |
128 | 129 |
129 #if defined(ANY_OF_AMTLU_SANITIZER) | 130 #if defined(ANY_OF_AMTLU_SANITIZER) |
130 __sanitizer_sandbox_arguments* sanitizer_args() const { | 131 __sanitizer_sandbox_arguments* sanitizer_args() const { |
131 return sanitizer_args_.get(); | 132 return sanitizer_args_.get(); |
132 }; | 133 }; |
133 #endif | 134 #endif |
134 | 135 |
135 private: | 136 private: |
136 friend struct DefaultSingletonTraits<LinuxSandbox>; | 137 friend struct base::DefaultSingletonTraits<LinuxSandbox>; |
137 | 138 |
138 LinuxSandbox(); | 139 LinuxSandbox(); |
139 ~LinuxSandbox(); | 140 ~LinuxSandbox(); |
140 | 141 |
141 // Some methods are static and get an instance of the Singleton. These | 142 // Some methods are static and get an instance of the Singleton. These |
142 // are the non-static implementations. | 143 // are the non-static implementations. |
143 bool InitializeSandboxImpl(); | 144 bool InitializeSandboxImpl(); |
144 void StopThreadImpl(base::Thread* thread); | 145 void StopThreadImpl(base::Thread* thread); |
145 // We must have been pre_initialized_ before using these. | 146 // We must have been pre_initialized_ before using these. |
146 bool seccomp_bpf_supported() const; | 147 bool seccomp_bpf_supported() const; |
(...skipping 29 matching lines...) Expand all Loading... |
176 #if defined(ANY_OF_AMTLU_SANITIZER) | 177 #if defined(ANY_OF_AMTLU_SANITIZER) |
177 scoped_ptr<__sanitizer_sandbox_arguments> sanitizer_args_; | 178 scoped_ptr<__sanitizer_sandbox_arguments> sanitizer_args_; |
178 #endif | 179 #endif |
179 | 180 |
180 DISALLOW_COPY_AND_ASSIGN(LinuxSandbox); | 181 DISALLOW_COPY_AND_ASSIGN(LinuxSandbox); |
181 }; | 182 }; |
182 | 183 |
183 } // namespace content | 184 } // namespace content |
184 | 185 |
185 #endif // CONTENT_COMMON_SANDBOX_LINUX_SANDBOX_LINUX_H_ | 186 #endif // CONTENT_COMMON_SANDBOX_LINUX_SANDBOX_LINUX_H_ |
OLD | NEW |