Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "content/common/sandbox_linux/bpf_renderer_policy_linux.h" | 5 #include "content/common/sandbox_linux/bpf_renderer_policy_linux.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <linux/dma-buf.h> | |
| 8 #include <sys/ioctl.h> | 9 #include <sys/ioctl.h> |
| 9 | 10 |
| 10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 11 #include "content/common/sandbox_linux/sandbox_linux.h" | 12 #include "content/common/sandbox_linux/sandbox_linux.h" |
| 12 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" | 13 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" |
| 13 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" | 14 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" |
| 14 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h" | 15 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h" |
| 15 #include "sandbox/linux/seccomp-bpf-helpers/syscall_sets.h" | 16 #include "sandbox/linux/seccomp-bpf-helpers/syscall_sets.h" |
| 16 #include "sandbox/linux/system_headers/linux_syscalls.h" | 17 #include "sandbox/linux/system_headers/linux_syscalls.h" |
| 17 | 18 |
| 18 using sandbox::SyscallSets; | 19 using sandbox::SyscallSets; |
| 19 using sandbox::bpf_dsl::Allow; | 20 using sandbox::bpf_dsl::Allow; |
| 20 using sandbox::bpf_dsl::Arg; | 21 using sandbox::bpf_dsl::Arg; |
| 21 using sandbox::bpf_dsl::Error; | 22 using sandbox::bpf_dsl::Error; |
| 22 using sandbox::bpf_dsl::ResultExpr; | 23 using sandbox::bpf_dsl::ResultExpr; |
| 23 | 24 |
| 24 namespace content { | 25 namespace content { |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| 27 | 28 |
| 28 ResultExpr RestrictIoctl() { | 29 ResultExpr RestrictIoctl() { |
| 29 const Arg<unsigned long> request(1); | 30 const Arg<unsigned long> request(1); |
| 30 return Switch(request) | 31 return Switch(request) |
| 31 .SANDBOX_BPF_DSL_CASES((static_cast<unsigned long>(TCGETS), FIONREAD), | 32 .SANDBOX_BPF_DSL_CASES((static_cast<unsigned long>(TCGETS), FIONREAD), |
| 32 Allow()) | 33 Allow()) |
| 34 .SANDBOX_BPF_DSL_CASES((static_cast<unsigned long>(DMA_BUF_IOCTL_SYNC)), | |
| 35 Allow()) | |
|
spang
2016/03/30 00:19:00
I'm fairly certain this is going to cause compile
vignatti (out of this project)
2016/03/30 14:58:37
yeah, I was thinking the same. Did you read what I
| |
| 33 .Default(sandbox::CrashSIGSYSIoctl()); | 36 .Default(sandbox::CrashSIGSYSIoctl()); |
| 34 } | 37 } |
| 35 | 38 |
| 36 } // namespace | 39 } // namespace |
| 37 | 40 |
| 38 RendererProcessPolicy::RendererProcessPolicy() {} | 41 RendererProcessPolicy::RendererProcessPolicy() {} |
| 39 RendererProcessPolicy::~RendererProcessPolicy() {} | 42 RendererProcessPolicy::~RendererProcessPolicy() {} |
| 40 | 43 |
| 41 ResultExpr RendererProcessPolicy::EvaluateSyscall(int sysno) const { | 44 ResultExpr RendererProcessPolicy::EvaluateSyscall(int sysno) const { |
| 42 switch (sysno) { | 45 switch (sysno) { |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 72 return sandbox::RestrictSchedTarget(GetPolicyPid(), sysno); | 75 return sandbox::RestrictSchedTarget(GetPolicyPid(), sysno); |
| 73 case __NR_prlimit64: | 76 case __NR_prlimit64: |
| 74 return Error(EPERM); // See crbug.com/160157. | 77 return Error(EPERM); // See crbug.com/160157. |
| 75 default: | 78 default: |
| 76 // Default on the content baseline policy. | 79 // Default on the content baseline policy. |
| 77 return SandboxBPFBasePolicy::EvaluateSyscall(sysno); | 80 return SandboxBPFBasePolicy::EvaluateSyscall(sysno); |
| 78 } | 81 } |
| 79 } | 82 } |
| 80 | 83 |
| 81 } // namespace content | 84 } // namespace content |
| OLD | NEW |