OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The Native Client Authors. All rights reserved. | 2 * Copyright 2009 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #include "native_client/src/include/portability.h" | 7 #include "native_client/src/include/portability.h" |
8 | 8 |
9 #if NACL_OSX | 9 #if NACL_OSX |
10 #include <crt_externs.h> | 10 #include <crt_externs.h> |
11 #endif | 11 #endif |
12 | 12 |
13 #ifdef _WIN64 /* TODO(gregoryd): remove this when win64 issues are fixed */ | 13 #ifdef _WIN64 /* TODO(gregoryd): remove this when win64 issues are fixed */ |
14 #define NACL_NO_INLINE | 14 #define NACL_NO_INLINE |
15 #endif | 15 #endif |
16 | 16 |
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_sync.h" | 18 #include "native_client/src/shared/platform/nacl_sync.h" |
19 #include "native_client/src/shared/platform/nacl_sync_checked.h" | 19 #include "native_client/src/shared/platform/nacl_sync_checked.h" |
20 #include "native_client/src/trusted/service_runtime/nacl_globals.h" | 20 #include "native_client/src/trusted/service_runtime/nacl_globals.h" |
21 #include "native_client/src/trusted/service_runtime/env_cleanser.h" | 21 #include "native_client/src/trusted/service_runtime/env_cleanser.h" |
22 #include "native_client/src/trusted/service_runtime/expiration.h" | 22 #include "native_client/src/trusted/service_runtime/expiration.h" |
23 #include "native_client/src/trusted/service_runtime/nacl_app.h" | 23 #include "native_client/src/trusted/service_runtime/nacl_app.h" |
24 #include "native_client/src/trusted/service_runtime/nacl_all_modules.h" | 24 #include "native_client/src/trusted/service_runtime/nacl_all_modules.h" |
25 #include "native_client/src/trusted/service_runtime/nacl_debug.h" | 25 #include "native_client/src/trusted/service_runtime/nacl_debug.h" |
26 #include "native_client/src/trusted/service_runtime/nacl_signal.h" | 26 #include "native_client/src/trusted/service_runtime/nacl_signal.h" |
27 #include "native_client/src/trusted/service_runtime/sel_ldr.h" | 27 #include "native_client/src/trusted/service_runtime/sel_ldr.h" |
| 28 #include "native_client/src/trusted/platform_qualify/nacl_dep_qualify.h" |
28 #include "native_client/src/trusted/platform_qualify/nacl_os_qualify.h" | 29 #include "native_client/src/trusted/platform_qualify/nacl_os_qualify.h" |
29 | 30 |
30 static int const kSrpcFd = 5; | 31 static int const kSrpcFd = 5; |
31 | 32 |
32 int verbosity = 0; | 33 int verbosity = 0; |
33 | 34 |
34 #ifdef __GNUC__ | 35 #ifdef __GNUC__ |
35 | 36 |
36 /* | 37 /* |
37 * GDB's canonical overlay managment routine. | 38 * GDB's canonical overlay managment routine. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 /* | 116 /* |
116 * Ensure this operating system platform is supported. | 117 * Ensure this operating system platform is supported. |
117 */ | 118 */ |
118 if (!NaClOsIsSupported()) { | 119 if (!NaClOsIsSupported()) { |
119 errcode = LOAD_UNSUPPORTED_OS_PLATFORM; | 120 errcode = LOAD_UNSUPPORTED_OS_PLATFORM; |
120 nap->module_load_status = errcode; | 121 nap->module_load_status = errcode; |
121 fprintf(stderr, "Error while loading in SelMain: %s\n", | 122 fprintf(stderr, "Error while loading in SelMain: %s\n", |
122 NaClErrorString(errcode)); | 123 NaClErrorString(errcode)); |
123 } | 124 } |
124 | 125 |
| 126 /* |
| 127 * Ensure this platform has Data Execution Prevention enabled. |
| 128 */ |
| 129 if (!NaClCheckDEP()) { |
| 130 errcode = LOAD_DEP_UNSUPPORTED; |
| 131 nap->module_load_status = errcode; |
| 132 fprintf(stderr, "Error while loading in SelMain: %s\n", |
| 133 NaClErrorString(errcode)); |
| 134 } |
| 135 |
125 /* Give debuggers a well known point at which xlate_base is known. */ | 136 /* Give debuggers a well known point at which xlate_base is known. */ |
126 StopForDebuggerInit(&state); | 137 StopForDebuggerInit(&state); |
127 | 138 |
128 /* | 139 /* |
129 * If export_addr_to is set to a non-negative integer, we create a | 140 * If export_addr_to is set to a non-negative integer, we create a |
130 * bound socket and socket address pair and bind the former to | 141 * bound socket and socket address pair and bind the former to |
131 * descriptor 3 and the latter to descriptor 4. The socket address | 142 * descriptor 3 and the latter to descriptor 4. The socket address |
132 * is written out to the export_addr_to descriptor. | 143 * is written out to the export_addr_to descriptor. |
133 * | 144 * |
134 * The service runtime also accepts a connection on the bound socket | 145 * The service runtime also accepts a connection on the bound socket |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 */ | 215 */ |
205 return ret_code; | 216 return ret_code; |
206 | 217 |
207 done: | 218 done: |
208 fflush(stdout); | 219 fflush(stdout); |
209 | 220 |
210 NaClAllModulesFini(); | 221 NaClAllModulesFini(); |
211 | 222 |
212 return ret_code; | 223 return ret_code; |
213 } | 224 } |
OLD | NEW |