| 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 23 matching lines...) Expand all Loading... |
| 34 // tracer will be notified of a PTRACE_EVENT_SECCOMP and allowed to change | 34 // tracer will be notified of a PTRACE_EVENT_SECCOMP and allowed to change |
| 35 // or skip the system call. The lower 16 bits of err will be available to | 35 // or skip the system call. The lower 16 bits of err will be available to |
| 36 // the tracer via PTRACE_GETEVENTMSG. | 36 // the tracer via PTRACE_GETEVENTMSG. |
| 37 ERR_TRACE = 0x08000000, | 37 ERR_TRACE = 0x08000000, |
| 38 | 38 |
| 39 // Deny the system call with a particular "errno" value. | 39 // Deny the system call with a particular "errno" value. |
| 40 // N.B.: It is also possible to return "0" here. That would normally | 40 // N.B.: It is also possible to return "0" here. That would normally |
| 41 // indicate success, but it won't actually run the system call. | 41 // indicate success, but it won't actually run the system call. |
| 42 // This is very different from return ERR_ALLOWED. | 42 // This is very different from return ERR_ALLOWED. |
| 43 ERR_MIN_ERRNO = 0, | 43 ERR_MIN_ERRNO = 0, |
| 44 #if defined(__mips__) |
| 45 // MIPS only supports errno up to 1133 |
| 46 ERR_MAX_ERRNO = 1133, |
| 47 #else |
| 44 // TODO(markus): Android only supports errno up to 255 | 48 // TODO(markus): Android only supports errno up to 255 |
| 45 // (crbug.com/181647). | 49 // (crbug.com/181647). |
| 46 ERR_MAX_ERRNO = 4095, | 50 ERR_MAX_ERRNO = 4095, |
| 51 #endif |
| 47 }; | 52 }; |
| 48 | 53 |
| 49 // While BPF filter programs always operate on 32bit quantities, the kernel | 54 // While BPF filter programs always operate on 32bit quantities, the kernel |
| 50 // always sees system call arguments as 64bit values. This statement is true | 55 // always sees system call arguments as 64bit values. This statement is true |
| 51 // no matter whether the host system is natively operating in 32bit or 64bit. | 56 // no matter whether the host system is natively operating in 32bit or 64bit. |
| 52 // The BPF compiler hides the fact that BPF instructions cannot directly | 57 // The BPF compiler hides the fact that BPF instructions cannot directly |
| 53 // access 64bit quantities. But policies are still advised to specify whether | 58 // access 64bit quantities. But policies are still advised to specify whether |
| 54 // a system call expects a 32bit or a 64bit quantity. | 59 // a system call expects a 32bit or a 64bit quantity. |
| 55 enum ArgType { | 60 enum ArgType { |
| 56 // When passed as an argument to SandboxBPF::Cond(), TP_32BIT requests that | 61 // 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... |
| 195 | 200 |
| 196 // 32bit field used for all possible types of ErrorCode values. This is | 201 // 32bit field used for all possible types of ErrorCode values. This is |
| 197 // the value that uniquely identifies any ErrorCode and it (typically) can | 202 // the value that uniquely identifies any ErrorCode and it (typically) can |
| 198 // be emitted directly into a BPF filter program. | 203 // be emitted directly into a BPF filter program. |
| 199 uint32_t err_; | 204 uint32_t err_; |
| 200 }; | 205 }; |
| 201 | 206 |
| 202 } // namespace sandbox | 207 } // namespace sandbox |
| 203 | 208 |
| 204 #endif // SANDBOX_LINUX_SECCOMP_BPF_ERRORCODE_H__ | 209 #endif // SANDBOX_LINUX_SECCOMP_BPF_ERRORCODE_H__ |
| OLD | NEW |