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

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

Issue 11363212: Added support for greylisting of system calls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Expanded comment Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « sandbox/linux/seccomp-bpf/errorcode.h ('k') | sandbox/linux/seccomp-bpf/sandbox_bpf.h » ('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/sandbox_bpf.h" 5 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h"
6 6
7 7
8 namespace playground2 { 8 namespace playground2 {
9 9
10 ErrorCode::ErrorCode(int err) { 10 ErrorCode::ErrorCode(int err) {
11 switch (err) { 11 switch (err) {
12 case ERR_ALLOWED: 12 case ERR_ALLOWED:
13 err_ = SECCOMP_RET_ALLOW; 13 err_ = SECCOMP_RET_ALLOW;
14 error_type_ = ET_SIMPLE; 14 error_type_ = ET_SIMPLE;
15 break; 15 break;
16 case ERR_MIN_ERRNO ... ERR_MAX_ERRNO: 16 case ERR_MIN_ERRNO ... ERR_MAX_ERRNO:
17 err_ = SECCOMP_RET_ERRNO + err; 17 err_ = SECCOMP_RET_ERRNO + err;
18 error_type_ = ET_SIMPLE; 18 error_type_ = ET_SIMPLE;
19 break; 19 break;
20 default: 20 default:
21 SANDBOX_DIE("Invalid use of ErrorCode object"); 21 SANDBOX_DIE("Invalid use of ErrorCode object");
22 } 22 }
23 } 23 }
24 24
25 ErrorCode::ErrorCode(ErrorCode::TrapFnc fnc, const void *aux, uint16_t id) 25 ErrorCode::ErrorCode(ErrorCode::TrapFnc fnc, const void *aux, bool safe,
26 uint16_t id)
26 : error_type_(ET_TRAP), 27 : error_type_(ET_TRAP),
27 fnc_(fnc), 28 fnc_(fnc),
28 aux_(const_cast<void *>(aux)), 29 aux_(const_cast<void *>(aux)),
30 safe_(safe),
29 err_(SECCOMP_RET_TRAP + id) { 31 err_(SECCOMP_RET_TRAP + id) {
30 } 32 }
31 33
32 ErrorCode::ErrorCode(int argno, ArgType width, Operation op, uint64_t value, 34 ErrorCode::ErrorCode(int argno, ArgType width, Operation op, uint64_t value,
33 const ErrorCode *passed, const ErrorCode *failed) 35 const ErrorCode *passed, const ErrorCode *failed)
34 : error_type_(ET_COND), 36 : error_type_(ET_COND),
35 value_(value), 37 value_(value),
36 argno_(argno), 38 argno_(argno),
37 width_(width), 39 width_(width),
38 op_(op), 40 op_(op),
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } else { 96 } else {
95 return false; 97 return false;
96 } 98 }
97 } else { 99 } else {
98 SANDBOX_DIE("Corrupted ErrorCode"); 100 SANDBOX_DIE("Corrupted ErrorCode");
99 } 101 }
100 } 102 }
101 } 103 }
102 104
103 } // namespace 105 } // namespace
OLDNEW
« no previous file with comments | « sandbox/linux/seccomp-bpf/errorcode.h ('k') | sandbox/linux/seccomp-bpf/sandbox_bpf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698