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

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

Issue 226083005: Linux sandbox: componentize almost everything. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update dependencies. Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « sandbox/linux/sandbox_linux.gypi ('k') | sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_HELPERS_BASELINE_POLICY_H_ 5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_HELPERS_BASELINE_POLICY_H_
6 #define SANDBOX_LINUX_SECCOMP_BPF_HELPERS_BASELINE_POLICY_H_ 6 #define SANDBOX_LINUX_SECCOMP_BPF_HELPERS_BASELINE_POLICY_H_
7 7
8 #include "sandbox/linux/sandbox_export.h"
8 #include "sandbox/linux/seccomp-bpf/errorcode.h" 9 #include "sandbox/linux/seccomp-bpf/errorcode.h"
9 #include "sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h" 10 #include "sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h"
10 11
11 namespace sandbox { 12 namespace sandbox {
12 13
13 class SandboxBPF; 14 class SandboxBPF;
14 class SandboxBPFPolicy; 15 class SandboxBPFPolicy;
15 16
16 // This is a helper to build seccomp-bpf policies, i.e. policies for a sandbox 17 // This is a helper to build seccomp-bpf policies, i.e. policies for a sandbox
17 // that reduces the Linux kernel's attack surface. Given its nature, it doesn't 18 // that reduces the Linux kernel's attack surface. Given its nature, it doesn't
18 // have a clear semantics and is mostly "implementation-defined". 19 // have a clear semantics and is mostly "implementation-defined".
19 // 20 //
20 // This returns an object that implements the SandboxBPFPolicy interface with 21 // This returns an object that implements the SandboxBPFPolicy interface with
21 // a "baseline" policy within Chromium. 22 // a "baseline" policy within Chromium.
22 // The "baseline" policy is somewhat arbitrary. All Chromium policies are an 23 // The "baseline" policy is somewhat arbitrary. All Chromium policies are an
23 // alteration of it, and it represents a reasonable common ground to run most 24 // alteration of it, and it represents a reasonable common ground to run most
24 // code in a sandboxed environment. 25 // code in a sandboxed environment.
25 class BaselinePolicy : public SandboxBPFPolicy { 26 class SANDBOX_EXPORT BaselinePolicy : public SandboxBPFPolicy {
26 public: 27 public:
27 BaselinePolicy(); 28 BaselinePolicy();
28 // |fs_denied_errno| is the errno returned when a filesystem access system 29 // |fs_denied_errno| is the errno returned when a filesystem access system
29 // call is denied. 30 // call is denied.
30 explicit BaselinePolicy(int fs_denied_errno); 31 explicit BaselinePolicy(int fs_denied_errno);
31 virtual ~BaselinePolicy(); 32 virtual ~BaselinePolicy();
32 33
33 virtual ErrorCode EvaluateSyscall(SandboxBPF* sandbox_compiler, 34 virtual ErrorCode EvaluateSyscall(SandboxBPF* sandbox_compiler,
34 int system_call_number) const OVERRIDE; 35 int system_call_number) const OVERRIDE;
35 36
36 private: 37 private:
37 int fs_denied_errno_; 38 int fs_denied_errno_;
38 DISALLOW_COPY_AND_ASSIGN(BaselinePolicy); 39 DISALLOW_COPY_AND_ASSIGN(BaselinePolicy);
39 }; 40 };
40 41
41 } // namespace sandbox. 42 } // namespace sandbox.
42 43
43 #endif // SANDBOX_LINUX_SECCOMP_BPF_HELPERS_BASELINE_POLICY_H_ 44 #endif // SANDBOX_LINUX_SECCOMP_BPF_HELPERS_BASELINE_POLICY_H_
OLDNEW
« no previous file with comments | « sandbox/linux/sandbox_linux.gypi ('k') | sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698