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 SANDBOX_BPF_H__ | 5 #ifndef SANDBOX_BPF_H__ |
6 #define SANDBOX_BPF_H__ | 6 #define SANDBOX_BPF_H__ |
7 | 7 |
8 #include <endian.h> | 8 #include <endian.h> |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <fcntl.h> | 10 #include <fcntl.h> |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 // notice and file a bug... | 217 // notice and file a bug... |
218 syscall(__NR_exit_group, 1); | 218 syscall(__NR_exit_group, 1); |
219 _exit(1); | 219 _exit(1); |
220 } | 220 } |
221 } | 221 } |
222 | 222 |
223 // Get a file descriptor pointing to "/proc", if currently available. | 223 // Get a file descriptor pointing to "/proc", if currently available. |
224 static int getProcFd() { return proc_fd_; } | 224 static int getProcFd() { return proc_fd_; } |
225 | 225 |
226 private: | 226 private: |
| 227 typedef std::vector<struct sock_filter> Program; |
| 228 |
227 static ErrorCode probeEvaluator(int signo); | 229 static ErrorCode probeEvaluator(int signo); |
228 static bool kernelSupportSeccompBPF(int proc_fd); | 230 static bool kernelSupportSeccompBPF(int proc_fd); |
229 | 231 static bool isSingleThreaded(int proc_fd); |
230 static bool isSingleThreaded(int proc_fd); | 232 static bool disableFilesystem(); |
231 static bool disableFilesystem(); | 233 static void installFilter(); |
232 static void installFilter(); | 234 static void sigSys(int nr, siginfo_t *info, void *void_context); |
233 static void sigSys(int nr, siginfo_t *info, void *void_context); | |
234 | 235 |
235 static bool suppressLogging_; | 236 static bool suppressLogging_; |
236 static SandboxStatus status_; | 237 static SandboxStatus status_; |
237 static int proc_fd_; | 238 static int proc_fd_; |
238 static std::vector<std::pair<EvaluateSyscall, | 239 static std::vector<std::pair<EvaluateSyscall, |
239 EvaluateArguments> > evaluators_; | 240 EvaluateArguments> > evaluators_; |
240 }; | 241 }; |
241 | 242 |
242 } // namespace | 243 } // namespace |
243 | 244 |
244 #endif // SANDBOX_BPF_H__ | 245 #endif // SANDBOX_BPF_H__ |
OLD | NEW |