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 #include "sandbox/linux/seccomp-bpf/errorcode.h" | 5 #include "sandbox/linux/seccomp-bpf/errorcode.h" |
6 | 6 |
7 #include "sandbox/linux/seccomp-bpf/die.h" | 7 #include "sandbox/linux/seccomp-bpf/die.h" |
8 #include "sandbox/linux/system_headers/linux_seccomp.h" | 8 #include "sandbox/linux/system_headers/linux_seccomp.h" |
9 | 9 |
10 namespace sandbox { | 10 namespace sandbox { |
11 | 11 |
12 ErrorCode::ErrorCode() : error_type_(ET_INVALID), err_(SECCOMP_RET_INVALID) { | 12 ErrorCode::ErrorCode() : error_type_(ET_INVALID), err_(SECCOMP_RET_INVALID) { |
13 } | 13 } |
14 | 14 |
15 ErrorCode::ErrorCode(int err) { | 15 ErrorCode::ErrorCode(int err) { |
16 switch (err) { | 16 switch (err) { |
17 case ERR_ALLOWED: | 17 case ERR_ALLOWED: |
18 err_ = SECCOMP_RET_ALLOW; | 18 err_ = SECCOMP_RET_ALLOW; |
19 error_type_ = ET_SIMPLE; | 19 error_type_ = ET_SIMPLE; |
20 break; | 20 break; |
| 21 case ERR_KILL: |
| 22 err_ = SECCOMP_RET_KILL; |
| 23 error_type_ = ET_SIMPLE; |
| 24 break; |
21 case ERR_MIN_ERRNO... ERR_MAX_ERRNO: | 25 case ERR_MIN_ERRNO... ERR_MAX_ERRNO: |
22 err_ = SECCOMP_RET_ERRNO + err; | 26 err_ = SECCOMP_RET_ERRNO + err; |
23 error_type_ = ET_SIMPLE; | 27 error_type_ = ET_SIMPLE; |
24 break; | 28 break; |
25 default: | 29 default: |
26 if ((err & ~SECCOMP_RET_DATA) == ERR_TRACE) { | 30 if ((err & ~SECCOMP_RET_DATA) == ERR_TRACE) { |
27 err_ = SECCOMP_RET_TRACE + (err & SECCOMP_RET_DATA); | 31 err_ = SECCOMP_RET_TRACE + (err & SECCOMP_RET_DATA); |
28 error_type_ = ET_SIMPLE; | 32 error_type_ = ET_SIMPLE; |
29 break; | 33 break; |
30 } | 34 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } else { | 110 } else { |
107 return false; | 111 return false; |
108 } | 112 } |
109 } else { | 113 } else { |
110 SANDBOX_DIE("Corrupted ErrorCode"); | 114 SANDBOX_DIE("Corrupted ErrorCode"); |
111 } | 115 } |
112 } | 116 } |
113 } | 117 } |
114 | 118 |
115 } // namespace sandbox | 119 } // namespace sandbox |
OLD | NEW |