| OLD | NEW |
| 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/bpf_dsl/bpf_dsl_forward.h" | 8 #include "sandbox/linux/bpf_dsl/bpf_dsl_forward.h" |
| 9 #include "sandbox/linux/bpf_dsl/policy.h" | 9 #include "sandbox/linux/bpf_dsl/policy.h" |
| 10 #include "sandbox/sandbox_export.h" | 10 #include "sandbox/sandbox_export.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // alteration of it, and it represents a reasonable common ground to run most | 21 // alteration of it, and it represents a reasonable common ground to run most |
| 22 // code in a sandboxed environment. | 22 // code in a sandboxed environment. |
| 23 // A baseline policy is only valid for the process for which this object was | 23 // A baseline policy is only valid for the process for which this object was |
| 24 // instantiated (so do not fork() and use it in a child). | 24 // instantiated (so do not fork() and use it in a child). |
| 25 class SANDBOX_EXPORT BaselinePolicy : public bpf_dsl::Policy { | 25 class SANDBOX_EXPORT BaselinePolicy : public bpf_dsl::Policy { |
| 26 public: | 26 public: |
| 27 BaselinePolicy(); | 27 BaselinePolicy(); |
| 28 // |fs_denied_errno| is the errno returned when a filesystem access system | 28 // |fs_denied_errno| is the errno returned when a filesystem access system |
| 29 // call is denied. | 29 // call is denied. |
| 30 explicit BaselinePolicy(int fs_denied_errno); | 30 explicit BaselinePolicy(int fs_denied_errno); |
| 31 virtual ~BaselinePolicy(); | 31 ~BaselinePolicy() override; |
| 32 | 32 |
| 33 virtual bpf_dsl::ResultExpr EvaluateSyscall( | 33 bpf_dsl::ResultExpr EvaluateSyscall(int system_call_number) const override; |
| 34 int system_call_number) const override; | 34 bpf_dsl::ResultExpr InvalidSyscall() const override; |
| 35 virtual bpf_dsl::ResultExpr InvalidSyscall() const override; | |
| 36 pid_t policy_pid() const { return policy_pid_; } | 35 pid_t policy_pid() const { return policy_pid_; } |
| 37 | 36 |
| 38 private: | 37 private: |
| 39 int fs_denied_errno_; | 38 int fs_denied_errno_; |
| 40 | 39 |
| 41 // The PID that the policy applies to (should be equal to the current pid). | 40 // The PID that the policy applies to (should be equal to the current pid). |
| 42 pid_t policy_pid_; | 41 pid_t policy_pid_; |
| 43 | 42 |
| 44 DISALLOW_COPY_AND_ASSIGN(BaselinePolicy); | 43 DISALLOW_COPY_AND_ASSIGN(BaselinePolicy); |
| 45 }; | 44 }; |
| 46 | 45 |
| 47 } // namespace sandbox. | 46 } // namespace sandbox. |
| 48 | 47 |
| 49 #endif // SANDBOX_LINUX_SECCOMP_BPF_HELPERS_BASELINE_POLICY_H_ | 48 #endif // SANDBOX_LINUX_SECCOMP_BPF_HELPERS_BASELINE_POLICY_H_ |
| OLD | NEW |