Index: components/nacl/loader/nonsfi/nonsfi_sandbox.cc |
diff --git a/components/nacl/loader/nonsfi/nonsfi_sandbox.cc b/components/nacl/loader/nonsfi/nonsfi_sandbox.cc |
index c850347cad463f1bb7e0dfd2ddf81876913a1fbe..ee5e6d517815408cff31416a531eb4baf079da96 100644 |
--- a/components/nacl/loader/nonsfi/nonsfi_sandbox.cc |
+++ b/components/nacl/loader/nonsfi/nonsfi_sandbox.cc |
@@ -22,6 +22,7 @@ |
#include "content/public/common/sandbox_init.h" |
#include "sandbox/linux/bpf_dsl/bpf_dsl.h" |
#include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" |
+#include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h" |
#include "sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h" |
#include "sandbox/linux/services/linux_syscalls.h" |
@@ -67,26 +68,6 @@ ResultExpr RestrictFcntlCommands() { |
Allow()).Else(CrashSIGSYS()); |
} |
-ResultExpr RestrictClockID() { |
- // We allow accessing only CLOCK_MONOTONIC, CLOCK_PROCESS_CPUTIME_ID, |
- // CLOCK_REALTIME, and CLOCK_THREAD_CPUTIME_ID. In particular, this disallows |
- // access to arbitrary per-{process,thread} CPU-time clock IDs (such as those |
- // returned by {clock,pthread}_getcpuclockid), which can leak information |
- // about the state of the host OS. |
- COMPILE_ASSERT(4 == sizeof(clockid_t), clockid_is_not_32bit); |
- const Arg<clockid_t> clockid(0); |
- return If( |
-#if defined(OS_CHROMEOS) |
- // Allow the special clock for Chrome OS used by Chrome tracing. |
- clockid == base::TimeTicks::kClockSystemTrace || |
-#endif |
- clockid == CLOCK_MONOTONIC || |
- clockid == CLOCK_PROCESS_CPUTIME_ID || |
- clockid == CLOCK_REALTIME || |
- clockid == CLOCK_THREAD_CPUTIME_ID, |
- Allow()).Else(CrashSIGSYS()); |
-} |
- |
ResultExpr RestrictClone() { |
// We allow clone only for new thread creation. |
const Arg<int> flags(0); |
@@ -259,7 +240,7 @@ ResultExpr NaClNonSfiBPFSandboxPolicy::EvaluateSyscall(int sysno) const { |
case __NR_clock_getres: |
case __NR_clock_gettime: |
- return RestrictClockID(); |
+ return sandbox::RestrictClockID(); |
case __NR_clone: |
return RestrictClone(); |