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

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

Issue 945743002: bpf_dsl: switch PolicyCompiler from seccomp-bpf/die.h to base/logging.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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_TRAP_REGISTRY_H_ 5 #ifndef SANDBOX_LINUX_BPF_DSL_TRAP_REGISTRY_H_
6 #define SANDBOX_LINUX_BPF_DSL_TRAP_REGISTRY_H_ 6 #define SANDBOX_LINUX_BPF_DSL_TRAP_REGISTRY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 typedef intptr_t (*TrapFnc)(const struct arch_seccomp_data& args, void* aux); 42 typedef intptr_t (*TrapFnc)(const struct arch_seccomp_data& args, void* aux);
43 43
44 // Add registers the specified trap handler tuple and returns a 44 // Add registers the specified trap handler tuple and returns a
45 // non-zero trap ID that uniquely identifies the tuple for the life 45 // non-zero trap ID that uniquely identifies the tuple for the life
46 // time of the trap registry. If the same tuple is registered 46 // time of the trap registry. If the same tuple is registered
47 // multiple times, the same value will be returned each time. 47 // multiple times, the same value will be returned each time.
48 virtual uint16_t Add(TrapFnc fnc, const void* aux, bool safe) = 0; 48 virtual uint16_t Add(TrapFnc fnc, const void* aux, bool safe) = 0;
49 49
50 // EnableUnsafeTraps tries to enable unsafe traps and returns 50 // EnableUnsafeTraps tries to enable unsafe traps and returns
51 // whether it was successful. This is a one-way operation. 51 // whether it was successful. This is a one-way operation.
52 //
53 // CAUTION: Enabling unsafe traps effectively defeats the security
54 // guarantees provided by the sandbox policy. TrapRegistry
55 // implementations should ensure unsafe traps are only enabled
56 // during testing.
52 virtual bool EnableUnsafeTraps() = 0; 57 virtual bool EnableUnsafeTraps() = 0;
53 58
54 protected: 59 protected:
55 TrapRegistry() {} 60 TrapRegistry() {}
56 61
57 // TrapRegistry's destructor is intentionally non-virtual so that 62 // TrapRegistry's destructor is intentionally non-virtual so that
58 // implementations can omit their destructor. Instead we protect against 63 // implementations can omit their destructor. Instead we protect against
59 // misuse by marking it protected. 64 // misuse by marking it protected.
60 ~TrapRegistry() {} 65 ~TrapRegistry() {}
61 66
62 DISALLOW_COPY_AND_ASSIGN(TrapRegistry); 67 DISALLOW_COPY_AND_ASSIGN(TrapRegistry);
63 }; 68 };
64 69
65 } // namespace bpf_dsl 70 } // namespace bpf_dsl
66 } // namespace sandbox 71 } // namespace sandbox
67 72
68 #endif // SANDBOX_LINUX_BPF_DSL_TRAP_REGISTRY_H_ 73 #endif // SANDBOX_LINUX_BPF_DSL_TRAP_REGISTRY_H_
OLDNEW
« sandbox/linux/bpf_dsl/policy_compiler.cc ('K') | « sandbox/linux/bpf_dsl/policy_compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698