Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: content/common/sandbox_seccomp_bpf_linux.cc

Issue 98373007: Move more helpers to seccomp-bpf-helpers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sandbox/linux/sandbox_linux.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/net.h> 9 #include <linux/net.h>
10 #include <signal.h> 10 #include <signal.h>
11 #include <string.h> 11 #include <string.h>
12 #include <sys/ioctl.h> 12 #include <sys/ioctl.h>
13 #include <sys/mman.h> 13 #include <sys/mman.h>
14 #include <sys/prctl.h> 14 #include <sys/prctl.h>
15 #include <sys/socket.h> 15 #include <sys/socket.h>
16 #include <sys/stat.h> 16 #include <sys/stat.h>
17 #include <sys/types.h> 17 #include <sys/types.h>
18 #include <ucontext.h> 18 #include <ucontext.h>
19 #include <unistd.h> 19 #include <unistd.h>
20 20
21 #include <vector> 21 #include <vector>
22 22
23 #if defined(__arm__) && !defined(MAP_STACK)
24 #define MAP_STACK 0x20000 // Daisy build environment has old headers.
25 #endif
26
27 #include "base/basictypes.h" 23 #include "base/basictypes.h"
28 #include "base/bind.h" 24 #include "base/bind.h"
29 #include "base/callback.h" 25 #include "base/callback.h"
30 #include "base/command_line.h" 26 #include "base/command_line.h"
31 #include "base/logging.h" 27 #include "base/logging.h"
32 #include "build/build_config.h" 28 #include "build/build_config.h"
33 #include "content/common/sandbox_linux.h" 29 #include "content/common/sandbox_linux.h"
34 #include "content/common/sandbox_seccomp_bpf_linux.h" 30 #include "content/common/sandbox_seccomp_bpf_linux.h"
35 #include "content/public/common/content_switches.h" 31 #include "content/public/common/content_switches.h"
36 #include "sandbox/linux/services/broker_process.h" 32 #include "sandbox/linux/services/broker_process.h"
37 33
38 // These are the only architectures supported for now. 34 // These are the only architectures supported for now.
39 #if defined(__i386__) || defined(__x86_64__) || \ 35 #if defined(__i386__) || defined(__x86_64__) || \
40 (defined(__arm__) && (defined(__thumb__) || defined(__ARM_EABI__))) 36 (defined(__arm__) && (defined(__thumb__) || defined(__ARM_EABI__)))
41 #define SECCOMP_BPF_SANDBOX 37 #define SECCOMP_BPF_SANDBOX
42 #endif 38 #endif
43 39
44 #if defined(SECCOMP_BPF_SANDBOX) 40 #if defined(SECCOMP_BPF_SANDBOX)
45 #include "base/posix/eintr_wrapper.h" 41 #include "base/posix/eintr_wrapper.h"
42 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h"
43 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h"
46 #include "sandbox/linux/seccomp-bpf-helpers/syscall_sets.h" 44 #include "sandbox/linux/seccomp-bpf-helpers/syscall_sets.h"
47 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" 45 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h"
48 #include "sandbox/linux/services/linux_syscalls.h" 46 #include "sandbox/linux/services/linux_syscalls.h"
49 47
50 using playground2::arch_seccomp_data; 48 using playground2::arch_seccomp_data;
51 using playground2::ErrorCode; 49 using playground2::ErrorCode;
52 using playground2::Sandbox; 50 using playground2::Sandbox;
53 using sandbox::BrokerProcess; 51 using sandbox::BrokerProcess;
54 // TODO(jln): remove once the cleanup in crbug.com/325535 is done. 52 // TODO(jln): remove once the cleanup in crbug.com/325535 is done.
55 using namespace sandbox; 53 using namespace sandbox;
56 54
57 namespace { 55 namespace {
58 56
59 void StartSandboxWithPolicy(Sandbox::EvaluateSyscall syscall_policy, 57 void StartSandboxWithPolicy(Sandbox::EvaluateSyscall syscall_policy,
60 BrokerProcess* broker_process); 58 BrokerProcess* broker_process);
61 59
62 inline bool RunningOnASAN() {
63 #if defined(ADDRESS_SANITIZER)
64 return true;
65 #else
66 return false;
67 #endif
68 }
69
70 inline bool IsChromeOS() { 60 inline bool IsChromeOS() {
71 #if defined(OS_CHROMEOS) 61 #if defined(OS_CHROMEOS)
72 return true; 62 return true;
73 #else 63 #else
74 return false; 64 return false;
75 #endif 65 #endif
76 } 66 }
77 67
78 inline bool IsArchitectureX86_64() { 68 inline bool IsArchitectureX86_64() {
79 #if defined(__x86_64__) 69 #if defined(__x86_64__)
(...skipping 20 matching lines...) Expand all
100 } 90 }
101 91
102 inline bool IsUsingToolKitGtk() { 92 inline bool IsUsingToolKitGtk() {
103 #if defined(TOOLKIT_GTK) 93 #if defined(TOOLKIT_GTK)
104 return true; 94 return true;
105 #else 95 #else
106 return false; 96 return false;
107 #endif 97 #endif
108 } 98 }
109 99
110 // Write |error_message| to stderr. Similar to RawLog(), but a bit more careful
111 // about async-signal safety. |size| is the size to write and should typically
112 // not include a terminating \0.
113 void WriteToStdErr(const char* error_message, size_t size) {
114 while (size > 0) {
115 // TODO(jln): query the current policy to check if send() is available and
116 // use it to perform a non blocking write.
117 const int ret = HANDLE_EINTR(write(STDERR_FILENO, error_message, size));
118 // We can't handle any type of error here.
119 if (ret <= 0 || static_cast<size_t>(ret) > size) break;
120 size -= ret;
121 error_message += ret;
122 }
123 }
124
125 // Print a seccomp-bpf failure to handle |sysno| to stderr in an
126 // async-signal safe way.
127 void PrintSyscallError(uint32_t sysno) {
128 if (sysno >= 1024)
129 sysno = 0;
130 // TODO(markus): replace with async-signal safe snprintf when available.
131 const size_t kNumDigits = 4;
132 char sysno_base10[kNumDigits];
133 uint32_t rem = sysno;
134 uint32_t mod = 0;
135 for (int i = kNumDigits - 1; i >= 0; i--) {
136 mod = rem % 10;
137 rem /= 10;
138 sysno_base10[i] = '0' + mod;
139 }
140 static const char kSeccompErrorPrefix[] =
141 __FILE__":**CRASHING**:seccomp-bpf failure in syscall ";
142 static const char kSeccompErrorPostfix[] = "\n";
143 WriteToStdErr(kSeccompErrorPrefix, sizeof(kSeccompErrorPrefix) - 1);
144 WriteToStdErr(sysno_base10, sizeof(sysno_base10));
145 WriteToStdErr(kSeccompErrorPostfix, sizeof(kSeccompErrorPostfix) - 1);
146 }
147
148 intptr_t CrashSIGSYS_Handler(const struct arch_seccomp_data& args, void* aux) {
149 uint32_t syscall = args.nr;
150 if (syscall >= 1024)
151 syscall = 0;
152 PrintSyscallError(syscall);
153
154 // Encode 8-bits of the 1st two arguments too, so we can discern which socket
155 // type, which fcntl, ... etc., without being likely to hit a mapped
156 // address.
157 // Do not encode more bits here without thinking about increasing the
158 // likelihood of collision with mapped pages.
159 syscall |= ((args.args[0] & 0xffUL) << 12);
160 syscall |= ((args.args[1] & 0xffUL) << 20);
161 // Purposefully dereference the syscall as an address so it'll show up very
162 // clearly and easily in crash dumps.
163 volatile char* addr = reinterpret_cast<volatile char*>(syscall);
164 *addr = '\0';
165 // In case we hit a mapped address, hit the null page with just the syscall,
166 // for paranoia.
167 syscall &= 0xfffUL;
168 addr = reinterpret_cast<volatile char*>(syscall);
169 *addr = '\0';
170 for (;;)
171 _exit(1);
172 }
173
174 // TODO(jln): rewrite reporting functions.
175 intptr_t SIGSYSCloneFailure(const struct arch_seccomp_data& args, void* aux) {
176 // "flags" in the first argument in the kernel's clone().
177 // Mark as volatile to be able to find the value on the stack in a minidump.
178 #if !defined(NDEBUG)
179 RAW_LOG(ERROR, __FILE__":**CRASHING**:clone() failure\n");
180 #endif
181 volatile uint64_t clone_flags = args.args[0];
182 volatile char* addr;
183 if (IsArchitectureX86_64()) {
184 addr = reinterpret_cast<volatile char*>(clone_flags & 0xFFFFFF);
185 *addr = '\0';
186 }
187 // Hit the NULL page if this fails to fault.
188 addr = reinterpret_cast<volatile char*>(clone_flags & 0xFFF);
189 *addr = '\0';
190 for (;;)
191 _exit(1);
192 }
193
194 // TODO(jln): rewrite reporting functions.
195 intptr_t SIGSYSPrctlFailure(const struct arch_seccomp_data& args,
196 void* /* aux */) {
197 // Mark as volatile to be able to find the value on the stack in a minidump.
198 #if !defined(NDEBUG)
199 RAW_LOG(ERROR, __FILE__":**CRASHING**:prctl() failure\n");
200 #endif
201 volatile uint64_t option = args.args[0];
202 volatile char* addr =
203 reinterpret_cast<volatile char*>(option & 0xFFF);
204 *addr = '\0';
205 for (;;)
206 _exit(1);
207 }
208
209 intptr_t SIGSYSIoctlFailure(const struct arch_seccomp_data& args,
210 void* /* aux */) {
211 // Make "request" volatile so that we can see it on the stack in a minidump.
212 #if !defined(NDEBUG)
213 RAW_LOG(ERROR, __FILE__":**CRASHING**:ioctl() failure\n");
214 #endif
215 volatile uint64_t request = args.args[1];
216 volatile char* addr = reinterpret_cast<volatile char*>(request & 0xFFFF);
217 *addr = '\0';
218 // Hit the NULL page if this fails.
219 addr = reinterpret_cast<volatile char*>(request & 0xFFF);
220 *addr = '\0';
221 for (;;)
222 _exit(1);
223 }
224
225 bool IsAcceleratedVideoDecodeEnabled() { 100 bool IsAcceleratedVideoDecodeEnabled() {
226 // Accelerated video decode is currently enabled on Chrome OS, 101 // Accelerated video decode is currently enabled on Chrome OS,
227 // but not on Linux: crbug.com/137247. 102 // but not on Linux: crbug.com/137247.
228 bool is_enabled = IsChromeOS(); 103 bool is_enabled = IsChromeOS();
229 104
230 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 105 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
231 is_enabled = is_enabled && 106 is_enabled = is_enabled &&
232 !command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode); 107 !command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode);
233 108
234 return is_enabled; 109 return is_enabled;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 #if defined(__arm__) 193 #if defined(__arm__)
319 IsArmPciConfig(sysno) || 194 IsArmPciConfig(sysno) ||
320 #endif 195 #endif
321 IsTimer(sysno)) { 196 IsTimer(sysno)) {
322 return true; 197 return true;
323 } else { 198 } else {
324 return false; 199 return false;
325 } 200 }
326 } 201 }
327 202
328 ErrorCode RestrictMmapFlags(Sandbox* sandbox) {
329 // The flags you see are actually the allowed ones, and the variable is a
330 // "denied" mask because of the negation operator.
331 // Significantly, we don't permit MAP_HUGETLB, or the newer flags such as
332 // MAP_POPULATE.
333 // TODO(davidung), remove MAP_DENYWRITE with updated Tegra libraries.
334 uint32_t denied_mask = ~(MAP_SHARED | MAP_PRIVATE | MAP_ANONYMOUS |
335 MAP_STACK | MAP_NORESERVE | MAP_FIXED |
336 MAP_DENYWRITE);
337 return sandbox->Cond(3, ErrorCode::TP_32BIT, ErrorCode::OP_HAS_ANY_BITS,
338 denied_mask,
339 sandbox->Trap(CrashSIGSYS_Handler, NULL),
340 ErrorCode(ErrorCode::ERR_ALLOWED));
341 }
342
343 ErrorCode RestrictMprotectFlags(Sandbox* sandbox) {
344 // The flags you see are actually the allowed ones, and the variable is a
345 // "denied" mask because of the negation operator.
346 // Significantly, we don't permit weird undocumented flags such as
347 // PROT_GROWSDOWN.
348 uint32_t denied_mask = ~(PROT_READ | PROT_WRITE | PROT_EXEC);
349 return sandbox->Cond(2, ErrorCode::TP_32BIT, ErrorCode::OP_HAS_ANY_BITS,
350 denied_mask,
351 sandbox->Trap(CrashSIGSYS_Handler, NULL),
352 ErrorCode(ErrorCode::ERR_ALLOWED));
353 }
354
355 ErrorCode RestrictFcntlCommands(Sandbox* sandbox) {
356 // We allow F_GETFL, F_SETFL, F_GETFD, F_SETFD, F_DUPFD, F_DUPFD_CLOEXEC,
357 // F_SETLK, F_SETLKW and F_GETLK.
358 // We also restrict the flags in F_SETFL. We don't want to permit flags with
359 // a history of trouble such as O_DIRECT. The flags you see are actually the
360 // allowed ones, and the variable is a "denied" mask because of the negation
361 // operator.
362 // Glibc overrides the kernel's O_LARGEFILE value. Account for this.
363 int kOLargeFileFlag = O_LARGEFILE;
364 if (IsArchitectureX86_64() || IsArchitectureI386())
365 kOLargeFileFlag = 0100000;
366
367 // TODO(jln): add TP_LONG/TP_SIZET types.
368 ErrorCode::ArgType mask_long_type;
369 if (sizeof(long) == 8)
370 mask_long_type = ErrorCode::TP_64BIT;
371 else if (sizeof(long) == 4)
372 mask_long_type = ErrorCode::TP_32BIT;
373 else
374 NOTREACHED();
375
376 unsigned long denied_mask = ~(O_ACCMODE | O_APPEND | O_NONBLOCK | O_SYNC |
377 kOLargeFileFlag | O_CLOEXEC | O_NOATIME);
378 return sandbox->Cond(1, ErrorCode::TP_32BIT,
379 ErrorCode::OP_EQUAL, F_GETFL,
380 ErrorCode(ErrorCode::ERR_ALLOWED),
381 sandbox->Cond(1, ErrorCode::TP_32BIT,
382 ErrorCode::OP_EQUAL, F_SETFL,
383 sandbox->Cond(2, mask_long_type,
384 ErrorCode::OP_HAS_ANY_BITS, denied_mask,
385 sandbox->Trap(CrashSIGSYS_Handler, NULL),
386 ErrorCode(ErrorCode::ERR_ALLOWED)),
387 sandbox->Cond(1, ErrorCode::TP_32BIT,
388 ErrorCode::OP_EQUAL, F_GETFD,
389 ErrorCode(ErrorCode::ERR_ALLOWED),
390 sandbox->Cond(1, ErrorCode::TP_32BIT,
391 ErrorCode::OP_EQUAL, F_SETFD,
392 ErrorCode(ErrorCode::ERR_ALLOWED),
393 sandbox->Cond(1, ErrorCode::TP_32BIT,
394 ErrorCode::OP_EQUAL, F_DUPFD,
395 ErrorCode(ErrorCode::ERR_ALLOWED),
396 sandbox->Cond(1, ErrorCode::TP_32BIT,
397 ErrorCode::OP_EQUAL, F_SETLK,
398 ErrorCode(ErrorCode::ERR_ALLOWED),
399 sandbox->Cond(1, ErrorCode::TP_32BIT,
400 ErrorCode::OP_EQUAL, F_SETLKW,
401 ErrorCode(ErrorCode::ERR_ALLOWED),
402 sandbox->Cond(1, ErrorCode::TP_32BIT,
403 ErrorCode::OP_EQUAL, F_GETLK,
404 ErrorCode(ErrorCode::ERR_ALLOWED),
405 sandbox->Cond(1, ErrorCode::TP_32BIT,
406 ErrorCode::OP_EQUAL, F_DUPFD_CLOEXEC,
407 ErrorCode(ErrorCode::ERR_ALLOWED),
408 sandbox->Trap(CrashSIGSYS_Handler, NULL))))))))));
409 }
410
411 #if defined(__i386__)
412 ErrorCode RestrictSocketcallCommand(Sandbox* sandbox) {
413 // Allow the same individual syscalls as we do on ARM or x86_64.
414 // The main difference is that we're unable to restrict the first parameter
415 // to socketpair(2). Whilst initially sounding bad, it's noteworthy that very
416 // few protocols actually support socketpair(2). The scary call that we're
417 // worried about, socket(2), remains blocked.
418 return sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
419 SYS_SOCKETPAIR, ErrorCode(ErrorCode::ERR_ALLOWED),
420 sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
421 SYS_SEND, ErrorCode(ErrorCode::ERR_ALLOWED),
422 sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
423 SYS_RECV, ErrorCode(ErrorCode::ERR_ALLOWED),
424 sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
425 SYS_SENDTO, ErrorCode(ErrorCode::ERR_ALLOWED),
426 sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
427 SYS_RECVFROM, ErrorCode(ErrorCode::ERR_ALLOWED),
428 sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
429 SYS_SHUTDOWN, ErrorCode(ErrorCode::ERR_ALLOWED),
430 sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
431 SYS_SENDMSG, ErrorCode(ErrorCode::ERR_ALLOWED),
432 sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
433 SYS_RECVMSG, ErrorCode(ErrorCode::ERR_ALLOWED),
434 ErrorCode(EPERM)))))))));
435 }
436 #endif
437
438 const int kFSDeniedErrno = EPERM; 203 const int kFSDeniedErrno = EPERM;
439 204
440 ErrorCode BaselinePolicy(Sandbox* sandbox, int sysno) { 205 ErrorCode BaselinePolicy(Sandbox* sandbox, int sysno) {
441 if (IsBaselinePolicyAllowed(sysno)) { 206 if (IsBaselinePolicyAllowed(sysno)) {
442 return ErrorCode(ErrorCode::ERR_ALLOWED); 207 return ErrorCode(ErrorCode::ERR_ALLOWED);
443 } 208 }
444 209
445 #if defined(__x86_64__) || defined(__arm__) 210 #if defined(__x86_64__) || defined(__arm__)
446 if (sysno == __NR_socketpair) { 211 if (sysno == __NR_socketpair) {
447 // Only allow AF_UNIX, PF_UNIX. Crash if anything else is seen. 212 // Only allow AF_UNIX, PF_UNIX. Crash if anything else is seen.
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 switch (sysno) { 376 switch (sysno) {
612 case __NR_access: 377 case __NR_access:
613 case __NR_open: 378 case __NR_open:
614 case __NR_openat: 379 case __NR_openat:
615 return ErrorCode(ErrorCode::ERR_ALLOWED); 380 return ErrorCode(ErrorCode::ERR_ALLOWED);
616 default: 381 default:
617 return ArmGpuProcessPolicy(sandbox, sysno, aux); 382 return ArmGpuProcessPolicy(sandbox, sysno, aux);
618 } 383 }
619 } 384 }
620 385
621 // Allow clone(2) for threads.
622 // Reject fork(2) attempts with EPERM.
623 // Crash if anything else is attempted.
624 // Don't restrict on ASAN.
625 ErrorCode RestrictCloneToThreadsAndEPERMFork(Sandbox* sandbox) {
626 // Glibc's pthread.
627 if (!RunningOnASAN()) {
628 return sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
629 CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND |
630 CLONE_THREAD | CLONE_SYSVSEM | CLONE_SETTLS |
631 CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID,
632 ErrorCode(ErrorCode::ERR_ALLOWED),
633 sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
634 CLONE_PARENT_SETTID | SIGCHLD,
635 ErrorCode(EPERM),
636 // ARM
637 sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
638 CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD,
639 ErrorCode(EPERM),
640 sandbox->Trap(SIGSYSCloneFailure, NULL))));
641 } else {
642 return ErrorCode(ErrorCode::ERR_ALLOWED);
643 }
644 }
645
646 ErrorCode RestrictPrctl(Sandbox* sandbox) {
647 // Allow PR_SET_NAME, PR_SET_DUMPABLE, PR_GET_DUMPABLE. Will need to add
648 // seccomp compositing in the future.
649 // PR_SET_PTRACER is used by breakpad but not needed anymore.
650 return sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
651 PR_SET_NAME, ErrorCode(ErrorCode::ERR_ALLOWED),
652 sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
653 PR_SET_DUMPABLE, ErrorCode(ErrorCode::ERR_ALLOWED),
654 sandbox->Cond(0, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL,
655 PR_GET_DUMPABLE, ErrorCode(ErrorCode::ERR_ALLOWED),
656 sandbox->Trap(SIGSYSPrctlFailure, NULL))));
657 }
658
659 ErrorCode RestrictIoctl(Sandbox* sandbox) {
660 // Allow TCGETS and FIONREAD, trap to SIGSYSIoctlFailure otherwise.
661 return sandbox->Cond(1, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL, TCGETS,
662 ErrorCode(ErrorCode::ERR_ALLOWED),
663 sandbox->Cond(1, ErrorCode::TP_32BIT, ErrorCode::OP_EQUAL, FIONREAD,
664 ErrorCode(ErrorCode::ERR_ALLOWED),
665 sandbox->Trap(SIGSYSIoctlFailure, NULL)));
666 }
667
668 ErrorCode RendererOrWorkerProcessPolicy(Sandbox* sandbox, int sysno, void*) { 386 ErrorCode RendererOrWorkerProcessPolicy(Sandbox* sandbox, int sysno, void*) {
669 switch (sysno) { 387 switch (sysno) {
670 case __NR_clone: 388 case __NR_clone:
671 return RestrictCloneToThreadsAndEPERMFork(sandbox); 389 return RestrictCloneToThreadsAndEPERMFork(sandbox);
672 case __NR_ioctl: 390 case __NR_ioctl:
673 return RestrictIoctl(sandbox); 391 return RestrictIoctl(sandbox);
674 case __NR_prctl: 392 case __NR_prctl:
675 return RestrictPrctl(sandbox); 393 return RestrictPrctl(sandbox);
676 // Allow the system calls below. 394 // Allow the system calls below.
677 case __NR_fdatasync: 395 case __NR_fdatasync:
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 return false; 829 return false;
1112 } 830 }
1113 831
1114 #if defined(SECCOMP_BPF_SANDBOX) 832 #if defined(SECCOMP_BPF_SANDBOX)
1115 playground2::BpfSandboxPolicyCallback SandboxSeccompBpf::GetBaselinePolicy() { 833 playground2::BpfSandboxPolicyCallback SandboxSeccompBpf::GetBaselinePolicy() {
1116 return base::Bind(&BaselinePolicyWithAux); 834 return base::Bind(&BaselinePolicyWithAux);
1117 } 835 }
1118 #endif // defined(SECCOMP_BPF_SANDBOX) 836 #endif // defined(SECCOMP_BPF_SANDBOX)
1119 837
1120 } // namespace content 838 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | sandbox/linux/sandbox_linux.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698