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

Side by Side Diff: sandbox/linux/seccomp-bpf/verifier.h

Issue 101773003: Linux sandbox: cleanup sandbox-bpf naming. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address namespace sandbox nits. Created 7 years 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/trap.cc ('k') | sandbox/linux/seccomp-bpf/verifier.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 #ifndef SANDBOX_LINUX_SECCOMP_BPF_VERIFIER_H__ 5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_VERIFIER_H__
6 #define SANDBOX_LINUX_SECCOMP_BPF_VERIFIER_H__ 6 #define SANDBOX_LINUX_SECCOMP_BPF_VERIFIER_H__
7 7
8 #include <linux/filter.h> 8 #include <linux/filter.h>
9 9
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 namespace playground2 { 13 namespace sandbox {
14 14
15 class SandboxBpfPolicy; 15 class SandboxBPFPolicy;
16 16
17 class Verifier { 17 class Verifier {
18 public: 18 public:
19 // Evaluate the BPF program for all possible inputs and verify that it 19 // Evaluate the BPF program for all possible inputs and verify that it
20 // computes the correct result. We use the "evaluators" to determine 20 // computes the correct result. We use the "evaluators" to determine
21 // the full set of possible inputs that we have to iterate over. 21 // the full set of possible inputs that we have to iterate over.
22 // Returns success, if the BPF filter accurately reflects the rules 22 // Returns success, if the BPF filter accurately reflects the rules
23 // set by the "evaluators". 23 // set by the "evaluators".
24 // Upon success, "err" is set to NULL. Upon failure, it contains a static 24 // Upon success, "err" is set to NULL. Upon failure, it contains a static
25 // error message that does not need to be free()'d. 25 // error message that does not need to be free()'d.
26 static bool VerifyBPF(Sandbox* sandbox, 26 static bool VerifyBPF(SandboxBPF* sandbox,
27 const std::vector<struct sock_filter>& program, 27 const std::vector<struct sock_filter>& program,
28 const SandboxBpfPolicy& policy, 28 const SandboxBPFPolicy& policy,
29 const char** err); 29 const char** err);
30 30
31 // Evaluate a given BPF program for a particular set of system call 31 // Evaluate a given BPF program for a particular set of system call
32 // parameters. If evaluation failed for any reason, "err" will be set to 32 // parameters. If evaluation failed for any reason, "err" will be set to
33 // a non-NULL error string. Otherwise, the BPF program's result will be 33 // a non-NULL error string. Otherwise, the BPF program's result will be
34 // returned by the function and "err" is NULL. 34 // returned by the function and "err" is NULL.
35 // We do not actually implement the full BPF state machine, but only the 35 // We do not actually implement the full BPF state machine, but only the
36 // parts that can actually be generated by our BPF compiler. If this code 36 // parts that can actually be generated by our BPF compiler. If this code
37 // is used for purposes other than verifying the output of the sandbox's 37 // is used for purposes other than verifying the output of the sandbox's
38 // BPF compiler, we might have to extend this BPF interpreter. 38 // BPF compiler, we might have to extend this BPF interpreter.
39 static uint32_t EvaluateBPF(const std::vector<struct sock_filter>& program, 39 static uint32_t EvaluateBPF(const std::vector<struct sock_filter>& program,
40 const struct arch_seccomp_data& data, 40 const struct arch_seccomp_data& data,
41 const char** err); 41 const char** err);
42 42
43 private: 43 private:
44 DISALLOW_IMPLICIT_CONSTRUCTORS(Verifier); 44 DISALLOW_IMPLICIT_CONSTRUCTORS(Verifier);
45 }; 45 };
46 46
47 } // namespace 47 } // namespace sandbox
48 48
49 #endif // SANDBOX_LINUX_SECCOMP_BPF_VERIFIER_H__ 49 #endif // SANDBOX_LINUX_SECCOMP_BPF_VERIFIER_H__
OLDNEW
« no previous file with comments | « sandbox/linux/seccomp-bpf/trap.cc ('k') | sandbox/linux/seccomp-bpf/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698