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_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__ | 5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__ |
6 #define SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__ | 6 #define SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <base/logging.h> | |
11 | |
12 namespace playground2 { | 10 namespace playground2 { |
13 | 11 |
14 // Iterates over the entire system call range from 0..0xFFFFFFFFu. This | 12 // Iterates over the entire system call range from 0..0xFFFFFFFFu. This |
15 // iterator is aware of how system calls look like and will skip quickly | 13 // iterator is aware of how system calls look like and will skip quickly |
16 // over ranges that can't contain system calls. It iterates more slowly | 14 // over ranges that can't contain system calls. It iterates more slowly |
17 // whenever it reaches a range that is potentially problematic, returning | 15 // whenever it reaches a range that is potentially problematic, returning |
18 // the last invalid value before a valid range of system calls, and the | 16 // the last invalid value before a valid range of system calls, and the |
19 // first invalid value after a valid range of syscalls. It iterates over | 17 // first invalid value after a valid range of syscalls. It iterates over |
20 // individual values whenever it is in the normal range for system calls | 18 // individual values whenever it is in the normal range for system calls |
21 // (typically MIN_SYSCALL..MAX_SYSCALL). | 19 // (typically MIN_SYSCALL..MAX_SYSCALL). |
(...skipping 20 matching lines...) Expand all Loading... |
42 uint32_t Next(); | 40 uint32_t Next(); |
43 static bool IsValid(uint32_t num); | 41 static bool IsValid(uint32_t num); |
44 | 42 |
45 private: | 43 private: |
46 static bool IsArmPrivate(uint32_t num); | 44 static bool IsArmPrivate(uint32_t num); |
47 | 45 |
48 bool invalid_only_; | 46 bool invalid_only_; |
49 bool done_; | 47 bool done_; |
50 uint32_t num_; | 48 uint32_t num_; |
51 | 49 |
52 DISALLOW_COPY_AND_ASSIGN(SyscallIterator); | 50 DISALLOW_IMPLICIT_CONSTRUCTORS(SyscallIterator); |
53 }; | 51 }; |
54 | 52 |
55 } // namespace playground2 | 53 } // namespace playground2 |
56 | 54 |
57 #endif // SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__ | 55 #endif // SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__ |
58 | 56 |
OLD | NEW |