| 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_VERIFIER_H__ | 5 #ifndef SANDBOX_LINUX_BPF_DSL_VERIFIER_H__ |
| 6 #define SANDBOX_LINUX_SECCOMP_BPF_VERIFIER_H__ | 6 #define SANDBOX_LINUX_BPF_DSL_VERIFIER_H__ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "sandbox/sandbox_export.h" | 13 #include "sandbox/sandbox_export.h" |
| 14 | 14 |
| 15 struct sock_filter; | 15 struct sock_filter; |
| 16 | 16 |
| 17 namespace sandbox { | 17 namespace sandbox { |
| 18 struct arch_seccomp_data; | 18 struct arch_seccomp_data; |
| 19 |
| 19 namespace bpf_dsl { | 20 namespace bpf_dsl { |
| 20 class Policy; | 21 class Policy; |
| 21 class PolicyCompiler; | 22 class PolicyCompiler; |
| 22 } | |
| 23 | 23 |
| 24 class SANDBOX_EXPORT Verifier { | 24 class SANDBOX_EXPORT Verifier { |
| 25 public: | 25 public: |
| 26 // Evaluate the BPF program for all possible inputs and verify that it | 26 // Evaluate the BPF program for all possible inputs and verify that it |
| 27 // computes the correct result. We use the "evaluators" to determine | 27 // computes the correct result. We use the "evaluators" to determine |
| 28 // the full set of possible inputs that we have to iterate over. | 28 // the full set of possible inputs that we have to iterate over. |
| 29 // Returns success, if the BPF filter accurately reflects the rules | 29 // Returns success, if the BPF filter accurately reflects the rules |
| 30 // set by the "evaluators". | 30 // set by the "evaluators". |
| 31 // Upon success, "err" is set to NULL. Upon failure, it contains a static | 31 // Upon success, "err" is set to NULL. Upon failure, it contains a static |
| 32 // error message that does not need to be free()'d. | 32 // error message that does not need to be free()'d. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 44 // is used for purposes other than verifying the output of the sandbox's | 44 // is used for purposes other than verifying the output of the sandbox's |
| 45 // BPF compiler, we might have to extend this BPF interpreter. | 45 // BPF compiler, we might have to extend this BPF interpreter. |
| 46 static uint32_t EvaluateBPF(const std::vector<struct sock_filter>& program, | 46 static uint32_t EvaluateBPF(const std::vector<struct sock_filter>& program, |
| 47 const struct arch_seccomp_data& data, | 47 const struct arch_seccomp_data& data, |
| 48 const char** err); | 48 const char** err); |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 DISALLOW_IMPLICIT_CONSTRUCTORS(Verifier); | 51 DISALLOW_IMPLICIT_CONSTRUCTORS(Verifier); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 } // namespace bpf_dsl |
| 54 } // namespace sandbox | 55 } // namespace sandbox |
| 55 | 56 |
| 56 #endif // SANDBOX_LINUX_SECCOMP_BPF_VERIFIER_H__ | 57 #endif // SANDBOX_LINUX_BPF_DSL_VERIFIER_H__ |
| OLD | NEW |