| 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 #ifdef NACL_EXCEPTION_HANDLING_REQUESTED |
| 223 exception_handling_requested = 1; |
| 224 #endif |
| 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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 fflush(stdout); | 929 fflush(stdout); |
| 926 | 930 |
| 927 if (handle_signals) NaClSignalHandlerFini(); | 931 if (handle_signals) NaClSignalHandlerFini(); |
| 928 NaClAllModulesFini(); | 932 NaClAllModulesFini(); |
| 929 | 933 |
| 930 NaClExit(ret_code); | 934 NaClExit(ret_code); |
| 931 | 935 |
| 932 /* Unreachable, but having the return prevents a compiler error. */ | 936 /* Unreachable, but having the return prevents a compiler error. */ |
| 933 return ret_code; | 937 return ret_code; |
| 934 } | 938 } |
| OLD | NEW |