Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef VERIFIER_H__ | |
| 6 #define VERIFIER_H__ | |
| 7 | |
| 8 #include <linux/filter.h> | |
| 9 | |
| 10 #include <utility> | |
| 11 #include <vector> | |
| 12 | |
| 13 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" | |
| 14 | |
| 15 | |
| 16 namespace playground2 { | |
| 17 | |
| 18 class Verifier { | |
| 19 public: | |
|
jln (very slow on Chromium)
2012/06/07 22:55:17
I would really prefer if this returned a bool or a
| |
| 20 static void verifyBPF(const std::vector<struct sock_filter>& program, | |
| 21 const Sandbox::Evaluators& evaluators); | |
| 22 | |
| 23 private: | |
| 24 struct State { | |
| 25 State(const std::vector<struct sock_filter>& p, | |
| 26 int s, Sandbox::ErrorCode e) : | |
| 27 program(p), | |
| 28 sysnum(s), | |
| 29 err(e), | |
| 30 ip(0), | |
| 31 accumulator(0), | |
| 32 accIsValid(false) { | |
| 33 } | |
| 34 const std::vector<struct sock_filter>& program; | |
| 35 int sysnum; | |
| 36 Sandbox::ErrorCode err; | |
| 37 unsigned int ip; | |
| 38 uint32_t accumulator; | |
| 39 bool accIsValid; | |
| 40 }; | |
| 41 | |
| 42 static void ld (State *state, const struct sock_filter& insn); | |
| 43 static void jmp(State *state, const struct sock_filter& insn); | |
| 44 static void ret(State *state, const struct sock_filter& insn); | |
|
jln (very slow on Chromium)
2012/06/07 22:55:17
Looks like Verifier is not meant to be instanciate
| |
| 45 }; | |
| 46 | |
| 47 } // namespace | |
| 48 | |
| 49 #endif // VERIFIER_H__ | |
| OLD | NEW |