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 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 | 75 |
76 // Check the policy and eventually start the seccomp-bpf sandbox. This should | 76 // Check the policy and eventually start the seccomp-bpf sandbox. This should |
77 // never be called with threads started. If we detect that threads have | 77 // never be called with threads started. If we detect that threads have |
78 // started we will crash. | 78 // started we will crash. |
79 bool StartSeccompBPF(const std::string& process_type); | 79 bool StartSeccompBPF(const std::string& process_type); |
80 | 80 |
81 // Limit the address space of the current process (and its children). | 81 // Limit the address space of the current process (and its children). |
82 // to make some vulnerabilities harder to exploit. | 82 // to make some vulnerabilities harder to exploit. |
83 bool LimitAddressSpace(const std::string& process_type); | 83 bool LimitAddressSpace(const std::string& process_type); |
84 | 84 |
85 #if (defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \ | |
86 defined(LEAK_SANITIZER)) && defined(OS_LINUX) | |
87 void SetSanitizerArgs(void *sanitizer_args); | |
jln (very slow on Chromium)
2014/05/13 01:17:35
style: "void* blah" in Chromium.
jln (very slow on Chromium)
2014/05/13 01:17:35
Note: it's ok to just call it set_sanitizer_args()
earthdok
2014/05/14 17:00:26
Done.
| |
88 #endif | |
89 | |
85 private: | 90 private: |
86 friend struct DefaultSingletonTraits<LinuxSandbox>; | 91 friend struct DefaultSingletonTraits<LinuxSandbox>; |
87 | 92 |
88 // Some methods are static and get an instance of the Singleton. These | 93 // Some methods are static and get an instance of the Singleton. These |
89 // are the non-static implementations. | 94 // are the non-static implementations. |
90 bool InitializeSandboxImpl(); | 95 bool InitializeSandboxImpl(); |
91 void StopThreadImpl(base::Thread* thread); | 96 void StopThreadImpl(base::Thread* thread); |
92 // We must have been pre_initialized_ before using this. | 97 // We must have been pre_initialized_ before using this. |
93 bool seccomp_bpf_supported() const; | 98 bool seccomp_bpf_supported() const; |
94 // Returns true if it can be determined that the current process has open | 99 // Returns true if it can be determined that the current process has open |
(...skipping 15 matching lines...) Expand all Loading... | |
110 // ourselves sandboxed. | 115 // ourselves sandboxed. |
111 int proc_fd_; | 116 int proc_fd_; |
112 bool seccomp_bpf_started_; | 117 bool seccomp_bpf_started_; |
113 // The value returned by GetStatus(). Gets computed once and then cached. | 118 // The value returned by GetStatus(). Gets computed once and then cached. |
114 int sandbox_status_flags_; | 119 int sandbox_status_flags_; |
115 // Did PreinitializeSandbox() run? | 120 // Did PreinitializeSandbox() run? |
116 bool pre_initialized_; | 121 bool pre_initialized_; |
117 bool seccomp_bpf_supported_; // Accurate if pre_initialized_. | 122 bool seccomp_bpf_supported_; // Accurate if pre_initialized_. |
118 bool yama_is_enforcing_; // Accurate if pre_initialized_. | 123 bool yama_is_enforcing_; // Accurate if pre_initialized_. |
119 scoped_ptr<sandbox::SetuidSandboxClient> setuid_sandbox_client_; | 124 scoped_ptr<sandbox::SetuidSandboxClient> setuid_sandbox_client_; |
125 #if (defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \ | |
126 defined(LEAK_SANITIZER)) && defined(OS_LINUX) | |
jln (very slow on Chromium)
2014/05/13 01:17:35
You're in _linux, so you can remove the last defin
earthdok
2014/05/14 17:00:26
Done.
| |
127 void *sanitizer_args_; | |
jln (very slow on Chromium)
2014/05/13 01:17:35
style: "void* blah" in chromium.
jln (very slow on Chromium)
2014/05/13 01:17:35
How about doing the following instead:
1. scoped_
earthdok
2014/05/14 17:00:26
Done.
earthdok
2014/05/14 17:00:26
Note that *SAN doesn't actually take ownership of
| |
128 #endif | |
120 | 129 |
121 ~LinuxSandbox(); | 130 ~LinuxSandbox(); |
122 DISALLOW_IMPLICIT_CONSTRUCTORS(LinuxSandbox); | 131 DISALLOW_IMPLICIT_CONSTRUCTORS(LinuxSandbox); |
123 }; | 132 }; |
124 | 133 |
125 } // namespace content | 134 } // namespace content |
126 | 135 |
127 #endif // CONTENT_COMMON_SANDBOX_LINUX_SANDBOX_LINUX_H_ | 136 #endif // CONTENT_COMMON_SANDBOX_LINUX_SANDBOX_LINUX_H_ |
OLD | NEW |