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 0340f6ff146c60669a1e4addea6570555b62da25..c4bd17e190003d98d9ace7041b5f6bf7f765ca4e 100644 |
--- a/components/nacl/loader/nonsfi/nonsfi_sandbox.cc |
+++ b/components/nacl/loader/nonsfi/nonsfi_sandbox.cc |
@@ -6,11 +6,8 @@ |
#include <errno.h> |
#include <fcntl.h> |
-#include <linux/futex.h> |
-#include <linux/net.h> |
#include <sys/mman.h> |
#include <sys/prctl.h> |
-#include <sys/ptrace.h> |
#include <sys/socket.h> |
#include <sys/syscall.h> |
#include <sys/time.h> |
@@ -23,13 +20,27 @@ |
#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/system_headers/android_futex.h" |
#include "sandbox/linux/system_headers/linux_syscalls.h" |
+#if !defined(OS_NACL_NONSFI) |
+#include <linux/net.h> // TODO move SYS_SOCKETPAIR etc to there. |
+#include <sys/ptrace.h> |
+#endif |
+ |
#if defined(__arm__) && !defined(MAP_STACK) |
// Chrome OS Daisy (ARM) build environment has old headers. |
#define MAP_STACK 0x20000 |
#endif |
+// TODO |
+#if !defined(PR_SET_NAME) |
+#define PR_SET_NAME 15 |
+#endif |
+#if !defined(MAP_STACK) |
+#define MAP_STACK 0x20000 |
+#endif |
+ |
#define CASES SANDBOX_BPF_DSL_CASES |
using sandbox::CrashSIGSYS; |
@@ -183,12 +194,15 @@ bool IsGracefullyDenied(int sysno) { |
} |
void RunSandboxSanityChecks() { |
+#if !defined(OS_NACL_NONSFI) |
+ // TODO: Is this sanity check needed? Can we have alternative? |
errno = 0; |
// Make a ptrace request with an invalid PID. |
long ptrace_ret = ptrace(PTRACE_PEEKUSER, -1 /* pid */, NULL, NULL); |
CHECK_EQ(-1, ptrace_ret); |
// Without the sandbox on, this ptrace call would ESRCH instead. |
CHECK_EQ(EPERM, errno); |
+#endif |
} |
} // namespace |