OLD | NEW |
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/sandbox_linux/nacl_sandbox_linux.h" | 5 #include "components/nacl/loader/sandbox_linux/nacl_sandbox_linux.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <sys/prctl.h> | 10 #include <sys/prctl.h> |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "sandbox/linux/services/namespace_sandbox.h" | 32 #include "sandbox/linux/services/namespace_sandbox.h" |
33 #include "sandbox/linux/services/proc_util.h" | 33 #include "sandbox/linux/services/proc_util.h" |
34 #include "sandbox/linux/services/resource_limits.h" | 34 #include "sandbox/linux/services/resource_limits.h" |
35 #include "sandbox/linux/services/thread_helpers.h" | 35 #include "sandbox/linux/services/thread_helpers.h" |
36 #include "sandbox/linux/suid/client/setuid_sandbox_client.h" | 36 #include "sandbox/linux/suid/client/setuid_sandbox_client.h" |
37 | 37 |
38 namespace nacl { | 38 namespace nacl { |
39 | 39 |
40 namespace { | 40 namespace { |
41 | 41 |
42 // This is a poor man's check on whether we are sandboxed. | 42 // This is a simplistic check of whether we are sandboxed. |
43 bool IsSandboxed() { | 43 bool IsSandboxed() { |
44 int proc_fd = open("/proc/self/exe", O_RDONLY); | 44 int proc_fd = open("/proc/self/exe", O_RDONLY); |
45 if (proc_fd >= 0) { | 45 if (proc_fd >= 0) { |
46 PCHECK(0 == IGNORE_EINTR(close(proc_fd))); | 46 PCHECK(0 == IGNORE_EINTR(close(proc_fd))); |
47 return false; | 47 return false; |
48 } | 48 } |
49 return true; | 49 return true; |
50 } | 50 } |
51 | 51 |
52 bool MaybeSetProcessNonDumpable() { | 52 bool MaybeSetProcessNonDumpable() { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 static const char kNoBpfMsg[] = | 238 static const char kNoBpfMsg[] = |
239 "The seccomp-bpf sandbox is not engaged for NaCl:"; | 239 "The seccomp-bpf sandbox is not engaged for NaCl:"; |
240 if (can_be_no_sandbox) | 240 if (can_be_no_sandbox) |
241 LOG(ERROR) << kNoBpfMsg << kItIsDangerousMsg; | 241 LOG(ERROR) << kNoBpfMsg << kItIsDangerousMsg; |
242 else | 242 else |
243 LOG(FATAL) << kNoBpfMsg << kItIsNotAllowedMsg; | 243 LOG(FATAL) << kNoBpfMsg << kItIsNotAllowedMsg; |
244 } | 244 } |
245 } | 245 } |
246 | 246 |
247 } // namespace nacl | 247 } // namespace nacl |
OLD | NEW |