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_TRAP_H__ | 5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_TRAP_H__ |
6 #define SANDBOX_LINUX_SECCOMP_BPF_TRAP_H__ | 6 #define SANDBOX_LINUX_SECCOMP_BPF_TRAP_H__ |
7 | 7 |
8 #include <signal.h> | 8 #include <signal.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 | 15 |
16 namespace playground2 { | 16 namespace sandbox { |
17 | 17 |
18 class ErrorCode; | 18 class ErrorCode; |
19 | 19 |
20 // The Trap class allows a BPF filter program to branch out to user space by | 20 // The Trap class allows a BPF filter program to branch out to user space by |
21 // raising a SIGSYS signal. | 21 // raising a SIGSYS signal. |
22 // N.B.: This class does not perform any synchronization operations. If | 22 // N.B.: This class does not perform any synchronization operations. If |
23 // modifications are made to any of the traps, it is the caller's | 23 // modifications are made to any of the traps, it is the caller's |
24 // responsibility to ensure that this happens in a thread-safe fashion. | 24 // responsibility to ensure that this happens in a thread-safe fashion. |
25 // Preferably, that means that no other threads should be running at that | 25 // Preferably, that means that no other threads should be running at that |
26 // time. For the purposes of our sandbox, this assertion should always be | 26 // time. For the purposes of our sandbox, this assertion should always be |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 size_t trap_array_capacity_; // Currently allocated capacity of array | 104 size_t trap_array_capacity_; // Currently allocated capacity of array |
105 bool has_unsafe_traps_; // Whether unsafe traps have been enabled | 105 bool has_unsafe_traps_; // Whether unsafe traps have been enabled |
106 | 106 |
107 // Our constructor is private. A shared global instance is created | 107 // Our constructor is private. A shared global instance is created |
108 // automatically as needed. | 108 // automatically as needed. |
109 // Copying and assigning is unimplemented. It doesn't make sense for a | 109 // Copying and assigning is unimplemented. It doesn't make sense for a |
110 // singleton. | 110 // singleton. |
111 DISALLOW_IMPLICIT_CONSTRUCTORS(Trap); | 111 DISALLOW_IMPLICIT_CONSTRUCTORS(Trap); |
112 }; | 112 }; |
113 | 113 |
114 } // namespace playground2 | 114 } // namespace sandbox |
115 | 115 |
116 #endif // SANDBOX_LINUX_SECCOMP_BPF_TRAP_H__ | 116 #endif // SANDBOX_LINUX_SECCOMP_BPF_TRAP_H__ |
OLD | NEW |