| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_PUBLIC_COMMON_SANDBOX_INIT_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_SANDBOX_INIT_H_ |
| 6 #define CONTENT_PUBLIC_COMMON_SANDBOX_INIT_H_ | 6 #define CONTENT_PUBLIC_COMMON_SANDBOX_INIT_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/files/scoped_file.h" | 10 #include "base/files/scoped_file.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
| 11 #include "base/process/launch.h" | 12 #include "base/process/launch.h" |
| 12 #include "base/process/process.h" | 13 #include "base/process/process.h" |
| 13 #include "base/process/process_handle.h" | 14 #include "base/process/process_handle.h" |
| 14 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 15 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 class CommandLine; | 19 class CommandLine; |
| 19 class FilePath; | 20 class FilePath; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 91 |
| 91 #elif defined(OS_LINUX) || defined(OS_NACL_NONSFI) | 92 #elif defined(OS_LINUX) || defined(OS_NACL_NONSFI) |
| 92 | 93 |
| 93 class SandboxInitializerDelegate; | 94 class SandboxInitializerDelegate; |
| 94 | 95 |
| 95 // Initialize a seccomp-bpf sandbox. |policy| may not be NULL. | 96 // Initialize a seccomp-bpf sandbox. |policy| may not be NULL. |
| 96 // If an existing layer of sandboxing is present that would prevent access to | 97 // If an existing layer of sandboxing is present that would prevent access to |
| 97 // /proc, |proc_fd| must be a valid file descriptor to /proc/. | 98 // /proc, |proc_fd| must be a valid file descriptor to /proc/. |
| 98 // Returns true if the sandbox has been properly engaged. | 99 // Returns true if the sandbox has been properly engaged. |
| 99 CONTENT_EXPORT bool InitializeSandbox( | 100 CONTENT_EXPORT bool InitializeSandbox( |
| 100 scoped_ptr<sandbox::bpf_dsl::Policy> policy, | 101 std::unique_ptr<sandbox::bpf_dsl::Policy> policy, |
| 101 base::ScopedFD proc_fd); | 102 base::ScopedFD proc_fd); |
| 102 | 103 |
| 103 // Return a "baseline" policy. This is used by a SandboxInitializerDelegate to | 104 // Return a "baseline" policy. This is used by a SandboxInitializerDelegate to |
| 104 // implement a policy that is derived from the baseline. | 105 // implement a policy that is derived from the baseline. |
| 105 CONTENT_EXPORT scoped_ptr<sandbox::bpf_dsl::Policy> | 106 CONTENT_EXPORT std::unique_ptr<sandbox::bpf_dsl::Policy> |
| 106 GetBPFSandboxBaselinePolicy(); | 107 GetBPFSandboxBaselinePolicy(); |
| 107 #endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI) | 108 #endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI) |
| 108 | 109 |
| 109 } // namespace content | 110 } // namespace content |
| 110 | 111 |
| 111 #endif // CONTENT_PUBLIC_COMMON_SANDBOX_INIT_H_ | 112 #endif // CONTENT_PUBLIC_COMMON_SANDBOX_INIT_H_ |
| OLD | NEW |