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

Side by Side Diff: sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc

Issue 231843008: sandbox_bpf_unittest.cc: Remove old code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months 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 | no next file » | 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 <errno.h> 5 #include <errno.h>
6 #include <pthread.h> 6 #include <pthread.h>
7 #include <sched.h> 7 #include <sched.h>
8 #include <sys/prctl.h> 8 #include <sys/prctl.h>
9 #include <sys/syscall.h> 9 #include <sys/syscall.h>
10 #include <sys/time.h> 10 #include <sys/time.h>
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 // index of that set + 1 (so that we never return a NUL errno). 350 // index of that set + 1 (so that we never return a NUL errno).
351 return ((sysno & ~3) >> 2) % 29 + 1; 351 return ((sysno & ~3) >> 2) % 29 + 1;
352 } 352 }
353 353
354 ErrorCode SyntheticPolicy(SandboxBPF*, int sysno, void*) { 354 ErrorCode SyntheticPolicy(SandboxBPF*, int sysno, void*) {
355 if (!SandboxBPF::IsValidSyscallNumber(sysno)) { 355 if (!SandboxBPF::IsValidSyscallNumber(sysno)) {
356 // FIXME: we should really not have to do that in a trivial policy 356 // FIXME: we should really not have to do that in a trivial policy
357 return ErrorCode(ENOSYS); 357 return ErrorCode(ENOSYS);
358 } 358 }
359 359
360 // TODO(jorgelo): remove this once the new code generator lands.
361 #if defined(__arm__)
362 if (sysno > static_cast<int>(MAX_PUBLIC_SYSCALL)) {
363 return ErrorCode(ENOSYS);
364 }
365 #endif
366
367 if (sysno == __NR_exit_group || sysno == __NR_write) { 360 if (sysno == __NR_exit_group || sysno == __NR_write) {
368 // exit_group() is special, we really need it to work. 361 // exit_group() is special, we really need it to work.
369 // write() is needed for BPF_ASSERT() to report a useful error message. 362 // write() is needed for BPF_ASSERT() to report a useful error message.
370 return ErrorCode(ErrorCode::ERR_ALLOWED); 363 return ErrorCode(ErrorCode::ERR_ALLOWED);
371 } else { 364 } else {
372 return ErrorCode(SysnoToRandomErrno(sysno)); 365 return ErrorCode(SysnoToRandomErrno(sysno));
373 } 366 }
374 } 367 }
375 368
376 BPF_TEST(SandboxBPF, SyntheticPolicy, SyntheticPolicy) { 369 BPF_TEST(SandboxBPF, SyntheticPolicy, SyntheticPolicy) {
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 &pid) == -EPERM); 1770 &pid) == -EPERM);
1778 } 1771 }
1779 1772
1780 BPF_TEST(SandboxBPF, PthreadEquality, PthreadPolicyEquality) { PthreadTest(); } 1773 BPF_TEST(SandboxBPF, PthreadEquality, PthreadPolicyEquality) { PthreadTest(); }
1781 1774
1782 BPF_TEST(SandboxBPF, PthreadBitMask, PthreadPolicyBitMask) { PthreadTest(); } 1775 BPF_TEST(SandboxBPF, PthreadBitMask, PthreadPolicyBitMask) { PthreadTest(); }
1783 1776
1784 } // namespace 1777 } // namespace
1785 1778
1786 } // namespace sandbox 1779 } // namespace sandbox
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698