| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 /* | 9 /* |
| 10 * NaCl Simple/secure ELF loader (NaCl SEL). | 10 * NaCl Simple/secure ELF loader (NaCl SEL). |
| 11 */ | 11 */ |
| 12 #include "native_client/src/include/portability_io.h" | 12 #include "native_client/src/include/portability_io.h" |
| 13 #include "native_client/src/include/portability_string.h" | 13 #include "native_client/src/include/portability_string.h" |
| 14 #include "native_client/src/include/nacl_macros.h" | 14 #include "native_client/src/include/nacl_macros.h" |
| 15 | 15 |
| 16 #include "native_client/src/shared/gio/gio.h" | 16 #include "native_client/src/shared/gio/gio.h" |
| 17 #include "native_client/src/shared/platform/nacl_check.h" | 17 #include "native_client/src/shared/platform/nacl_check.h" |
| 18 #include "native_client/src/shared/platform/nacl_exit.h" | 18 #include "native_client/src/shared/platform/nacl_exit.h" |
| 19 #include "native_client/src/shared/platform/nacl_log.h" | 19 #include "native_client/src/shared/platform/nacl_log.h" |
| 20 #include "native_client/src/shared/platform/nacl_sync.h" | 20 #include "native_client/src/shared/platform/nacl_sync.h" |
| 21 #include "native_client/src/shared/platform/nacl_sync_checked.h" | 21 #include "native_client/src/shared/platform/nacl_sync_checked.h" |
| 22 #include "native_client/src/shared/platform/nacl_time.h" |
| 22 #include "native_client/src/shared/srpc/nacl_srpc.h" | 23 #include "native_client/src/shared/srpc/nacl_srpc.h" |
| 23 | 24 |
| 24 | 25 |
| 25 #include "native_client/src/trusted/desc/nacl_desc_base.h" | 26 #include "native_client/src/trusted/desc/nacl_desc_base.h" |
| 26 #include "native_client/src/trusted/desc/nacl_desc_conn_cap.h" | 27 #include "native_client/src/trusted/desc/nacl_desc_conn_cap.h" |
| 27 #include "native_client/src/trusted/desc/nacl_desc_imc.h" | 28 #include "native_client/src/trusted/desc/nacl_desc_imc.h" |
| 28 #include "native_client/src/trusted/desc/nacl_desc_io.h" | 29 #include "native_client/src/trusted/desc/nacl_desc_io.h" |
| 29 #include "native_client/src/trusted/desc/nrd_xfer.h" | 30 #include "native_client/src/trusted/desc/nrd_xfer.h" |
| 30 | 31 |
| 31 #include "native_client/src/trusted/fault_injection/fault_injection.h" | 32 #include "native_client/src/trusted/fault_injection/fault_injection.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 49 #include "native_client/src/trusted/service_runtime/sel_ldr.h" | 50 #include "native_client/src/trusted/service_runtime/sel_ldr.h" |
| 50 #include "native_client/src/trusted/service_runtime/sel_memory.h" | 51 #include "native_client/src/trusted/service_runtime/sel_memory.h" |
| 51 | 52 |
| 52 #include "native_client/src/trusted/service_runtime/name_service/default_name_se
rvice.h" | 53 #include "native_client/src/trusted/service_runtime/name_service/default_name_se
rvice.h" |
| 53 #include "native_client/src/trusted/service_runtime/name_service/name_service.h" | 54 #include "native_client/src/trusted/service_runtime/name_service/name_service.h" |
| 54 | 55 |
| 55 #include "native_client/src/trusted/service_runtime/sel_ldr_thread_interface.h" | 56 #include "native_client/src/trusted/service_runtime/sel_ldr_thread_interface.h" |
| 56 #include "native_client/src/trusted/threading/nacl_thread_interface.h" | 57 #include "native_client/src/trusted/threading/nacl_thread_interface.h" |
| 57 | 58 |
| 58 #include "native_client/src/trusted/service_runtime/include/sys/stat.h" | 59 #include "native_client/src/trusted/service_runtime/include/sys/stat.h" |
| 60 #include "native_client/src/trusted/service_runtime/include/sys/time.h" |
| 59 | 61 |
| 60 #include "native_client/src/trusted/simple_service/nacl_simple_rservice.h" | 62 #include "native_client/src/trusted/simple_service/nacl_simple_rservice.h" |
| 61 #include "native_client/src/trusted/simple_service/nacl_simple_service.h" | 63 #include "native_client/src/trusted/simple_service/nacl_simple_service.h" |
| 62 | 64 |
| 63 #include "native_client/src/trusted/threading/nacl_thread_interface.h" | 65 #include "native_client/src/trusted/threading/nacl_thread_interface.h" |
| 64 | 66 |
| 65 static int IsEnvironmentVariableSet(char const *env_name) { | 67 static int IsEnvironmentVariableSet(char const *env_name) { |
| 66 return NULL != getenv(env_name); | 68 return NULL != getenv(env_name); |
| 67 } | 69 } |
| 68 | 70 |
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 "NaClWaitForStartModuleCommand: awaken, module_may_start %d\n", | 1127 "NaClWaitForStartModuleCommand: awaken, module_may_start %d\n", |
| 1126 nap->module_may_start); | 1128 nap->module_may_start); |
| 1127 } | 1129 } |
| 1128 status = nap->module_load_status; | 1130 status = nap->module_load_status; |
| 1129 NaClXMutexUnlock(&nap->mu); | 1131 NaClXMutexUnlock(&nap->mu); |
| 1130 NaClLog(4, "NaClWaitForStartModuleCommand finished\n"); | 1132 NaClLog(4, "NaClWaitForStartModuleCommand finished\n"); |
| 1131 | 1133 |
| 1132 return status; | 1134 return status; |
| 1133 } | 1135 } |
| 1134 | 1136 |
| 1137 void NaClBlockIfCommandChannelExists(struct NaClApp *nap) { |
| 1138 if (NULL != nap->secure_service) { |
| 1139 for (;;) { |
| 1140 struct nacl_abi_timespec req; |
| 1141 req.tv_sec = 1000; |
| 1142 req.tv_nsec = 0; |
| 1143 NaClNanosleep(&req, (struct nacl_abi_timespec *) NULL); |
| 1144 } |
| 1145 } |
| 1146 } |
| 1147 |
| 1135 | 1148 |
| 1136 /* | 1149 /* |
| 1137 * Secure command channels. | 1150 * Secure command channels. |
| 1138 */ | 1151 */ |
| 1139 | 1152 |
| 1140 struct NaClSecureService { | 1153 struct NaClSecureService { |
| 1141 struct NaClSimpleService base; | 1154 struct NaClSimpleService base; |
| 1142 struct NaClApp *nap; | 1155 struct NaClApp *nap; |
| 1143 }; | 1156 }; |
| 1144 | 1157 |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1705 NaClSandboxMemoryStartForValgrind(mem_start); | 1718 NaClSandboxMemoryStartForValgrind(mem_start); |
| 1706 | 1719 |
| 1707 #ifdef __GNUC__ | 1720 #ifdef __GNUC__ |
| 1708 _ovly_debug_event (); | 1721 _ovly_debug_event (); |
| 1709 #endif | 1722 #endif |
| 1710 } | 1723 } |
| 1711 | 1724 |
| 1712 void NaClGdbHook(struct NaClApp const *nap) { | 1725 void NaClGdbHook(struct NaClApp const *nap) { |
| 1713 StopForDebuggerInit(nap->mem_start); | 1726 StopForDebuggerInit(nap->mem_start); |
| 1714 } | 1727 } |
| OLD | NEW |