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 <asm/unistd.h> | 5 #include <asm/unistd.h> |
6 #include <dlfcn.h> | 6 #include <dlfcn.h> |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <linux/audit.h> | 9 #include <linux/audit.h> |
10 #include <linux/filter.h> | 10 #include <linux/filter.h> |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "content/common/sandbox_seccomp_bpf_linux.h" | 24 #include "content/common/sandbox_seccomp_bpf_linux.h" |
25 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
26 | 26 |
27 // These are the only architectures supported for now. | 27 // These are the only architectures supported for now. |
28 #if defined(__i386__) || defined(__x86_64__) | 28 #if defined(__i386__) || defined(__x86_64__) |
29 #define SECCOMP_BPF_SANDBOX | 29 #define SECCOMP_BPF_SANDBOX |
30 #endif | 30 #endif |
31 | 31 |
32 #if defined(SECCOMP_BPF_SANDBOX) | 32 #if defined(SECCOMP_BPF_SANDBOX) |
33 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" | 33 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" |
34 | 34 #include "sandbox/linux/services/x86_linux_syscalls.h" |
35 // These are fairly new and not defined in all headers yet. | |
36 #if defined(__x86_64__) | |
37 | |
38 #ifndef __NR_process_vm_readv | |
39 #define __NR_process_vm_readv 310 | |
40 #endif | |
41 | |
42 #ifndef __NR_process_vm_writev | |
43 #define __NR_process_vm_writev 311 | |
44 #endif | |
45 | |
46 #elif defined(__i386__) | |
47 | |
48 #ifndef __NR_process_vm_readv | |
49 #define __NR_process_vm_readv 347 | |
50 #endif | |
51 | |
52 #ifndef __NR_process_vm_writev | |
53 #define __NR_process_vm_writev 348 | |
54 #endif | |
55 | |
56 #endif | |
57 | 35 |
58 namespace { | 36 namespace { |
59 | 37 |
60 inline bool IsChromeOS() { | 38 inline bool IsChromeOS() { |
61 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
62 return true; | 40 return true; |
63 #else | 41 #else |
64 return false; | 42 return false; |
65 #endif | 43 #endif |
66 } | 44 } |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 // Process-specific policy. | 517 // Process-specific policy. |
540 ShouldEnableSeccompBpf(process_type) && | 518 ShouldEnableSeccompBpf(process_type) && |
541 SupportsSandbox()) { | 519 SupportsSandbox()) { |
542 return StartBpfSandbox_x86(command_line, process_type); | 520 return StartBpfSandbox_x86(command_line, process_type); |
543 } | 521 } |
544 #endif | 522 #endif |
545 return false; | 523 return false; |
546 } | 524 } |
547 | 525 |
548 } // namespace content | 526 } // namespace content |
OLD | NEW |