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

Unified Diff: components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc

Issue 307033002: Non-SFI NaCl: CLOCK_SYSTEM_TRACE fails gracefully on Chrome OS Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use only OS_LINUX to decide whether we define kClockSystemTrace Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/nacl/loader/nonsfi/nonsfi_sandbox.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc
diff --git a/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc b/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc
index 8d0a4d499a5ad0d1e638a1e4fe5c23617a660b7e..221629c64ec1b0d3b527a4204bdec532a4942a7c 100644
--- a/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc
+++ b/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc
@@ -31,8 +31,10 @@
#include "base/files/scoped_file.h"
#include "base/logging.h"
#include "base/posix/eintr_wrapper.h"
+#include "base/time/time.h"
#include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h"
#include "sandbox/linux/seccomp-bpf/bpf_tests.h"
+#include "sandbox/linux/services/linux_syscalls.h"
#include "third_party/lss/linux_syscall_support.h" // for MAKE_PROCESS_CPUCLOCK
namespace {
@@ -418,6 +420,24 @@ BPF_DEATH_TEST_C(NaClNonSfiSandboxTest,
clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
}
+#if defined(OS_CHROMEOS)
+BPF_TEST_C(NaClNonSfiSandboxTest,
+ clock_gettime_eperm_system_trace,
+ nacl::nonsfi::NaClNonSfiBPFSandboxPolicy) {
+ struct timespec ts = {};
+ BPF_ASSERT_EQ(-1, clock_gettime(base::TimeTicks::kClockSystemTrace, &ts));
+ BPF_ASSERT_EQ(EPERM, errno);
+}
+#else
+BPF_DEATH_TEST_C(NaClNonSfiSandboxTest,
+ clock_gettime_crash_system_trace,
+ DEATH_MESSAGE(sandbox::GetErrorMessageContentForTests()),
+ nacl::nonsfi::NaClNonSfiBPFSandboxPolicy) {
+ struct timespec ts;
+ clock_gettime(base::TimeTicks::kClockSystemTrace, &ts);
+}
+#endif
+
BPF_DEATH_TEST_C(NaClNonSfiSandboxTest,
clock_gettime_crash_cpu_clock,
DEATH_MESSAGE(sandbox::GetErrorMessageContentForTests()),
« no previous file with comments | « components/nacl/loader/nonsfi/nonsfi_sandbox.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698