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

Side by Side Diff: components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc

Issue 244013002: Non-SFI NaCl: Disallow epoll family and allow poll instead (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 | « components/nacl/loader/nonsfi/nonsfi_sandbox_sigsys_unittest.cc ('k') | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/nacl/loader/nonsfi/nonsfi_sandbox.h" 5 #include "components/nacl/loader/nonsfi/nonsfi_sandbox.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <pthread.h> 9 #include <pthread.h>
10 #include <sched.h> 10 #include <sched.h>
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy::EvaluateSyscallImpl) { 339 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy::EvaluateSyscallImpl) {
340 char* next_brk = static_cast<char*>(sbrk(0)) + getpagesize(); 340 char* next_brk = static_cast<char*>(sbrk(0)) + getpagesize();
341 // The kernel interface must return zero for brk. 341 // The kernel interface must return zero for brk.
342 BPF_ASSERT_EQ(0, syscall(__NR_brk, next_brk)); 342 BPF_ASSERT_EQ(0, syscall(__NR_brk, next_brk));
343 // The libc wrapper translates it to ENOMEM. 343 // The libc wrapper translates it to ENOMEM.
344 errno = 0; 344 errno = 0;
345 BPF_ASSERT_EQ(-1, brk(next_brk)); 345 BPF_ASSERT_EQ(-1, brk(next_brk));
346 BPF_ASSERT_EQ(ENOMEM, errno); 346 BPF_ASSERT_EQ(ENOMEM, errno);
347 } 347 }
348 348
349 BPF_TEST(NaClNonSfiSandboxTest, epoll_create_EPERM,
350 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy::EvaluateSyscallImpl) {
351 errno = 0;
352 BPF_ASSERT_EQ(-1, syscall(__NR_epoll_create));
353 BPF_ASSERT_EQ(EPERM, errno);
354 }
355
349 #if defined(__i386__) || defined(__arm__) 356 #if defined(__i386__) || defined(__arm__)
350 BPF_TEST(NaClNonSfiSandboxTest, getegid32_EPERM, 357 BPF_TEST(NaClNonSfiSandboxTest, getegid32_EPERM,
351 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy::EvaluateSyscallImpl) { 358 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy::EvaluateSyscallImpl) {
352 errno = 0; 359 errno = 0;
353 BPF_ASSERT_EQ(-1, syscall(__NR_getegid32)); 360 BPF_ASSERT_EQ(-1, syscall(__NR_getegid32));
354 BPF_ASSERT_EQ(EPERM, errno); 361 BPF_ASSERT_EQ(EPERM, errno);
355 } 362 }
356 363
357 BPF_TEST(NaClNonSfiSandboxTest, geteuid32_EPERM, 364 BPF_TEST(NaClNonSfiSandboxTest, geteuid32_EPERM,
358 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy::EvaluateSyscallImpl) { 365 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy::EvaluateSyscallImpl) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 #if defined(__i386__) || defined(__x86_64__) 489 #if defined(__i386__) || defined(__x86_64__)
483 BPF_TEST(NaClNonSfiSandboxTest, time_EPERM, 490 BPF_TEST(NaClNonSfiSandboxTest, time_EPERM,
484 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy::EvaluateSyscallImpl) { 491 nacl::nonsfi::NaClNonSfiBPFSandboxPolicy::EvaluateSyscallImpl) {
485 errno = 0; 492 errno = 0;
486 BPF_ASSERT_EQ(-1, syscall(__NR_time)); 493 BPF_ASSERT_EQ(-1, syscall(__NR_time));
487 BPF_ASSERT_EQ(EPERM, errno); 494 BPF_ASSERT_EQ(EPERM, errno);
488 } 495 }
489 #endif 496 #endif
490 497
491 } // namespace 498 } // namespace
OLDNEW
« no previous file with comments | « components/nacl/loader/nonsfi/nonsfi_sandbox_sigsys_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698