OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__ | |
6 #define SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 namespace playground2 { | |
11 | |
12 class SyscallIterator { | |
13 public: | |
14 // 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 | |
16 // over ranges that can't contain system calls. It iterates more slowly | |
jln (very slow on Chromium)
2012/10/11 22:42:00
It should be documented (and asserted from unit te
Jorge Lucangeli Obes
2012/10/12 17:58:23
Invalid and InvalidOnly tests in syscall_iterator_
| |
17 // whenever it reaches a range that is potentially problematic. And it | |
18 // iterates over individual values whenever it is in the normal range for | |
19 // system calls (typically MIN_SYSCALL..MAX_SYSCALL). | |
20 // If "invalid_only" is "true", the iterator still iterates from | |
21 // 0..0xFFFFFFFFu, but it never returns values from the range of valid | |
22 // system call numbers. This feature can be used when verifying that all | |
23 // "impossible" system call values are treated the same. | |
24 explicit SyscallIterator(bool invalid_only) | |
25 : invalid_only_(invalid_only), | |
26 done_(false), | |
27 num_(0) { | |
28 } | |
29 | |
30 bool Done() const { return done_; } | |
31 uint32_t Next(); | |
32 static bool IsArmPrivate(uint32_t num); | |
33 static bool IsValid(uint32_t num); | |
34 | |
35 private: | |
36 bool invalid_only_; | |
37 bool done_; | |
38 uint32_t num_; | |
39 }; | |
40 | |
41 } // namespace | |
42 | |
43 #endif // SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__ | |
OLD | NEW |