Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2113)

Side by Side Diff: sandbox/linux/seccomp-bpf/errorcode.cc

Issue 1302043002: sandbox/linux: refactor bpf_dsl dependency on die.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change default panic behavior to simply Kill Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sandbox/linux/seccomp-bpf/errorcode.h ('k') | sandbox/linux/seccomp-bpf/sandbox_bpf.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « sandbox/linux/seccomp-bpf/errorcode.h ('k') | sandbox/linux/seccomp-bpf/sandbox_bpf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698