OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 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 /* | 7 /* |
8 * NaCl Simple/secure ELF loader (NaCl SEL). | 8 * NaCl Simple/secure ELF loader (NaCl SEL). |
9 */ | 9 */ |
10 #include "native_client/src/include/portability.h" | 10 #include "native_client/src/include/portability.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 #if NACL_OSX | 212 #if NACL_OSX |
213 /* Mac dynamic libraries cannot access the environ variable directly. */ | 213 /* Mac dynamic libraries cannot access the environ variable directly. */ |
214 envp = (const char **) *_NSGetEnviron(); | 214 envp = (const char **) *_NSGetEnviron(); |
215 #else | 215 #else |
216 /* Overzealous code style check is overzealous. */ | 216 /* Overzealous code style check is overzealous. */ |
217 /* @IGNORE_LINES_FOR_CODE_HYGIENE[1] */ | 217 /* @IGNORE_LINES_FOR_CODE_HYGIENE[1] */ |
218 extern char **environ; | 218 extern char **environ; |
219 envp = (const char **) environ; | 219 envp = (const char **) environ; |
220 #endif | 220 #endif |
221 | 221 |
222 if (getenv("NACL_UNTRUSTED_EXCEPTION_HANDLING") != NULL) { | |
Mark Seaborn
2012/02/13 19:04:08
If you put this immediately before "if (exception_
bradn
2012/02/13 23:42:03
Done.
| |
223 exception_handling_requested = 1; | |
224 } | |
225 | |
222 #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm || NACL_SANDBOX_FIXED_AT_ZERO == 1 | 226 #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm || NACL_SANDBOX_FIXED_AT_ZERO == 1 |
223 /* | 227 /* |
224 * Set malloc not to use mmap even for large allocations. This is currently | 228 * Set malloc not to use mmap even for large allocations. This is currently |
225 * necessary when we must use a specific area of RAM for the sandbox. | 229 * necessary when we must use a specific area of RAM for the sandbox. |
226 * | 230 * |
227 * During startup, before the sandbox is set up, the sel_ldr allocates a chunk | 231 * During startup, before the sandbox is set up, the sel_ldr allocates a chunk |
228 * of memory to store the untrusted code. Normally such an allocation would | 232 * of memory to store the untrusted code. Normally such an allocation would |
229 * go into the sel_ldr's heap area, but the allocation is typically large -- | 233 * go into the sel_ldr's heap area, but the allocation is typically large -- |
230 * at least hundreds of KiB. The default malloc configuration on Linux (at | 234 * at least hundreds of KiB. The default malloc configuration on Linux (at |
231 * least) switches to mmap for such allocations, and mmap will select | 235 * least) switches to mmap for such allocations, and mmap will select |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
929 fflush(stdout); | 933 fflush(stdout); |
930 | 934 |
931 if (handle_signals) NaClSignalHandlerFini(); | 935 if (handle_signals) NaClSignalHandlerFini(); |
932 NaClAllModulesFini(); | 936 NaClAllModulesFini(); |
933 | 937 |
934 NaClExit(ret_code); | 938 NaClExit(ret_code); |
935 | 939 |
936 /* Unreachable, but having the return prevents a compiler error. */ | 940 /* Unreachable, but having the return prevents a compiler error. */ |
937 return ret_code; | 941 return ret_code; |
938 } | 942 } |
OLD | NEW |