| 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 /* | 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 struct NaClApp state; | 157 struct NaClApp state; |
| 158 char *nacl_file = NULL; | 158 char *nacl_file = NULL; |
| 159 char *blob_library_file = NULL; | 159 char *blob_library_file = NULL; |
| 160 int rpc_supplies_nexe = 0; | 160 int rpc_supplies_nexe = 0; |
| 161 int export_addr_to = -2; | 161 int export_addr_to = -2; |
| 162 | 162 |
| 163 struct NaClApp *nap; | 163 struct NaClApp *nap; |
| 164 | 164 |
| 165 struct GioFile gout; | 165 struct GioFile gout; |
| 166 NaClErrorCode errcode; | 166 NaClErrorCode errcode = LOAD_INTERNAL; |
| 167 struct GioMemoryFileSnapshot blob_file; | 167 struct GioMemoryFileSnapshot blob_file; |
| 168 | 168 |
| 169 int ret_code; | 169 int ret_code; |
| 170 struct DynArray env_vars; | 170 struct DynArray env_vars; |
| 171 | 171 |
| 172 char *log_file = NULL; | 172 char *log_file = NULL; |
| 173 struct GioFile *log_gio; | 173 struct GioFile *log_gio; |
| 174 int log_desc; | 174 int log_desc; |
| 175 int verbosity = 0; | 175 int verbosity = 0; |
| 176 int fuzzing_quit_after_load = 0; | 176 int fuzzing_quit_after_load = 0; |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 fflush(stdout); | 849 fflush(stdout); |
| 850 | 850 |
| 851 if (verbosity) { | 851 if (verbosity) { |
| 852 gprintf((struct Gio *) &gout, "exiting -- printing NaClApp details\n"); | 852 gprintf((struct Gio *) &gout, "exiting -- printing NaClApp details\n"); |
| 853 NaClAppPrintDetails(nap, (struct Gio *) &gout); | 853 NaClAppPrintDetails(nap, (struct Gio *) &gout); |
| 854 | 854 |
| 855 printf("Dumping vmmap.\n"); fflush(stdout); | 855 printf("Dumping vmmap.\n"); fflush(stdout); |
| 856 PrintVmmap(nap); | 856 PrintVmmap(nap); |
| 857 fflush(stdout); | 857 fflush(stdout); |
| 858 } | 858 } |
| 859 /* |
| 860 * If there is a secure command channel, we sent an RPC reply with |
| 861 * the reason that the nexe was rejected. If we exit now, that |
| 862 * reply may still be in-flight and the various channel closure (esp |
| 863 * reverse channel) may be detected first. This would result in a |
| 864 * crash being reported, rather than the error in the RPC reply. |
| 865 * Instead, we wait for the hard-shutdown on the command channel. |
| 866 */ |
| 867 if (LOAD_OK != errcode) { |
| 868 NaClBlockIfCommandChannelExists(nap); |
| 869 } |
| 859 | 870 |
| 860 done_file_dtor: | 871 done_file_dtor: |
| 861 if (verbosity > 0) { | 872 if (verbosity > 0) { |
| 862 printf("Done.\n"); | 873 printf("Done.\n"); |
| 863 } | 874 } |
| 864 fflush(stdout); | 875 fflush(stdout); |
| 865 | 876 |
| 866 if (handle_signals) NaClSignalHandlerFini(); | 877 if (handle_signals) NaClSignalHandlerFini(); |
| 867 NaClAllModulesFini(); | 878 NaClAllModulesFini(); |
| 868 | 879 |
| 869 NaClExit(ret_code); | 880 NaClExit(ret_code); |
| 870 | 881 |
| 871 /* Unreachable, but having the return prevents a compiler error. */ | 882 /* Unreachable, but having the return prevents a compiler error. */ |
| 872 return ret_code; | 883 return ret_code; |
| 873 } | 884 } |
| OLD | NEW |