| 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 #include "content/renderer/renderer_main_platform_delegate.h" | 5 #include "content/renderer/renderer_main_platform_delegate.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 } | 23 } |
| 24 | 24 |
| 25 void RendererMainPlatformDelegate::PlatformInitialize() { | 25 void RendererMainPlatformDelegate::PlatformInitialize() { |
| 26 } | 26 } |
| 27 | 27 |
| 28 void RendererMainPlatformDelegate::PlatformUninitialize() { | 28 void RendererMainPlatformDelegate::PlatformUninitialize() { |
| 29 } | 29 } |
| 30 | 30 |
| 31 bool RendererMainPlatformDelegate::EnableSandbox() { | 31 bool RendererMainPlatformDelegate::EnableSandbox() { |
| 32 // The setuid sandbox is started in the zygote process: zygote_main_linux.cc | 32 // The setuid sandbox is started in the zygote process: zygote_main_linux.cc |
| 33 // http://code.google.com/p/chromium/wiki/LinuxSUIDSandbox | 33 // https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_san
dbox.md |
| 34 // | 34 // |
| 35 // Anything else is started in InitializeSandbox(). | 35 // Anything else is started in InitializeSandbox(). |
| 36 LinuxSandbox::InitializeSandbox(); | 36 LinuxSandbox::InitializeSandbox(); |
| 37 // about:sandbox uses a value returned from LinuxSandbox::GetStatus() before | 37 // about:sandbox uses a value returned from LinuxSandbox::GetStatus() before |
| 38 // any renderer has been started. | 38 // any renderer has been started. |
| 39 // Here, we test that the status of SeccompBpf in the renderer is consistent | 39 // Here, we test that the status of SeccompBpf in the renderer is consistent |
| 40 // with what LinuxSandbox::GetStatus() said we would do. | 40 // with what LinuxSandbox::GetStatus() said we would do. |
| 41 class LinuxSandbox* linux_sandbox = LinuxSandbox::GetInstance(); | 41 class LinuxSandbox* linux_sandbox = LinuxSandbox::GetInstance(); |
| 42 if (linux_sandbox->GetStatus() & kSandboxLinuxSeccompBPF) { | 42 if (linux_sandbox->GetStatus() & kSandboxLinuxSeccompBPF) { |
| 43 CHECK(linux_sandbox->seccomp_bpf_started()); | 43 CHECK(linux_sandbox->seccomp_bpf_started()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 57 // but we know that under the seccomp-bpf sandbox, this should return EPERM. | 57 // but we know that under the seccomp-bpf sandbox, this should return EPERM. |
| 58 CHECK_EQ(fchmod(-1, 07777), -1); | 58 CHECK_EQ(fchmod(-1, 07777), -1); |
| 59 CHECK_EQ(errno, EPERM); | 59 CHECK_EQ(errno, EPERM); |
| 60 } | 60 } |
| 61 #endif // __x86_64__ | 61 #endif // __x86_64__ |
| 62 | 62 |
| 63 return true; | 63 return true; |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace content | 66 } // namespace content |
| OLD | NEW |