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

Side by Side Diff: sandbox/linux/bpf_dsl/bpf_dsl.h

Issue 600583002: sandbox: Avoid ~(flag1 | flag2 | ...) expressions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use uint64_t everywhere Created 6 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_BPF_DSL_BPF_DSL_H_ 5 #ifndef SANDBOX_LINUX_BPF_DSL_BPF_DSL_H_
6 #define SANDBOX_LINUX_BPF_DSL_BPF_DSL_H_ 6 #define SANDBOX_LINUX_BPF_DSL_BPF_DSL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 25 matching lines...) Expand all
36 // using namespace sandbox::bpf_dsl; 36 // using namespace sandbox::bpf_dsl;
37 // 37 //
38 // class SillyPolicy : public SandboxBPFDSLPolicy { 38 // class SillyPolicy : public SandboxBPFDSLPolicy {
39 // public: 39 // public:
40 // SillyPolicy() {} 40 // SillyPolicy() {}
41 // virtual ~SillyPolicy() {} 41 // virtual ~SillyPolicy() {}
42 // virtual ResultExpr EvaluateSyscall(int sysno) const OVERRIDE { 42 // virtual ResultExpr EvaluateSyscall(int sysno) const OVERRIDE {
43 // if (sysno == __NR_fcntl) { 43 // if (sysno == __NR_fcntl) {
44 // Arg<int> fd(0), cmd(1); 44 // Arg<int> fd(0), cmd(1);
45 // Arg<unsigned long> flags(2); 45 // Arg<unsigned long> flags(2);
46 // const unsigned long kBadFlags = ~(O_ACCMODE | O_NONBLOCK); 46 // const uint64_t kGoodFlags = O_ACCMODE | O_NONBLOCK;
47 // return If(fd == 0 && cmd == F_SETFL && (flags & kBadFlags) == 0, 47 // return If(fd == 0 && cmd == F_SETFL && (flags & ~kGoodFlags) == 0,
48 // Allow()) 48 // Allow())
49 // .ElseIf(cmd == F_DUPFD || cmd == F_DUPFD_CLOEXEC, 49 // .ElseIf(cmd == F_DUPFD || cmd == F_DUPFD_CLOEXEC,
50 // Error(EMFILE)) 50 // Error(EMFILE))
51 // .Else(Trap(SetFlagHandler, NULL)); 51 // .Else(Trap(SetFlagHandler, NULL));
52 // } else { 52 // } else {
53 // return Allow(); 53 // return Allow();
54 // } 54 // }
55 // } 55 // }
56 // 56 //
57 // private: 57 // private:
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 380
381 template <typename T> 381 template <typename T>
382 ResultExpr Caser<T>::Default(ResultExpr result) const { 382 ResultExpr Caser<T>::Default(ResultExpr result) const {
383 return elser_.Else(result); 383 return elser_.Else(result);
384 } 384 }
385 385
386 } // namespace bpf_dsl 386 } // namespace bpf_dsl
387 } // namespace sandbox 387 } // namespace sandbox
388 388
389 #endif // SANDBOX_LINUX_BPF_DSL_BPF_DSL_H_ 389 #endif // SANDBOX_LINUX_BPF_DSL_BPF_DSL_H_
OLDNEW
« no previous file with comments | « components/nacl/loader/nonsfi/nonsfi_sandbox.cc ('k') | sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698