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_ERRORCODE_H__ | 5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_ERRORCODE_H__ |
6 #define SANDBOX_LINUX_SECCOMP_BPF_ERRORCODE_H__ | 6 #define SANDBOX_LINUX_SECCOMP_BPF_ERRORCODE_H__ |
7 | 7 |
8 #include "sandbox/linux/seccomp-bpf/linux_seccomp.h" | 8 #include "sandbox/linux/seccomp-bpf/linux_seccomp.h" |
9 #include "sandbox/linux/seccomp-bpf/trap.h" | 9 #include "sandbox/linux/seccomp-bpf/trap.h" |
10 #include "sandbox/sandbox_export.h" | 10 #include "sandbox/sandbox_export.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // completely arbitrary. But we want to pick it so that is is unlikely | 28 // completely arbitrary. But we want to pick it so that is is unlikely |
29 // to be passed in accidentally, when the user intended to return an | 29 // to be passed in accidentally, when the user intended to return an |
30 // "errno" (see below) value instead. | 30 // "errno" (see below) value instead. |
31 ERR_ALLOWED = 0x04000000, | 31 ERR_ALLOWED = 0x04000000, |
32 | 32 |
33 // Deny the system call with a particular "errno" value. | 33 // Deny the system call with a particular "errno" value. |
34 // N.B.: It is also possible to return "0" here. That would normally | 34 // N.B.: It is also possible to return "0" here. That would normally |
35 // indicate success, but it won't actually run the system call. | 35 // indicate success, but it won't actually run the system call. |
36 // This is very different from return ERR_ALLOWED. | 36 // This is very different from return ERR_ALLOWED. |
37 ERR_MIN_ERRNO = 0, | 37 ERR_MIN_ERRNO = 0, |
| 38 #if defined(__mips__) |
| 39 // MIPS only supports errno up to 1133 |
| 40 ERR_MAX_ERRNO = 1133, |
| 41 #else |
38 // TODO(markus): Android only supports errno up to 255 | 42 // TODO(markus): Android only supports errno up to 255 |
39 // (crbug.com/181647). | 43 // (crbug.com/181647). |
40 ERR_MAX_ERRNO = 4095, | 44 ERR_MAX_ERRNO = 4095, |
| 45 #endif |
41 }; | 46 }; |
42 | 47 |
43 // While BPF filter programs always operate on 32bit quantities, the kernel | 48 // While BPF filter programs always operate on 32bit quantities, the kernel |
44 // always sees system call arguments as 64bit values. This statement is true | 49 // always sees system call arguments as 64bit values. This statement is true |
45 // no matter whether the host system is natively operating in 32bit or 64bit. | 50 // no matter whether the host system is natively operating in 32bit or 64bit. |
46 // The BPF compiler hides the fact that BPF instructions cannot directly | 51 // The BPF compiler hides the fact that BPF instructions cannot directly |
47 // access 64bit quantities. But policies are still advised to specify whether | 52 // access 64bit quantities. But policies are still advised to specify whether |
48 // a system call expects a 32bit or a 64bit quantity. | 53 // a system call expects a 32bit or a 64bit quantity. |
49 enum ArgType { | 54 enum ArgType { |
50 // When passed as an argument to SandboxBPF::Cond(), TP_32BIT requests that | 55 // When passed as an argument to SandboxBPF::Cond(), TP_32BIT requests that |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 194 |
190 // 32bit field used for all possible types of ErrorCode values. This is | 195 // 32bit field used for all possible types of ErrorCode values. This is |
191 // the value that uniquely identifies any ErrorCode and it (typically) can | 196 // the value that uniquely identifies any ErrorCode and it (typically) can |
192 // be emitted directly into a BPF filter program. | 197 // be emitted directly into a BPF filter program. |
193 uint32_t err_; | 198 uint32_t err_; |
194 }; | 199 }; |
195 | 200 |
196 } // namespace sandbox | 201 } // namespace sandbox |
197 | 202 |
198 #endif // SANDBOX_LINUX_SECCOMP_BPF_ERRORCODE_H__ | 203 #endif // SANDBOX_LINUX_SECCOMP_BPF_ERRORCODE_H__ |
OLD | NEW |