| 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 * This loader can only process NaCl object files as produced using | 10 * This loader can only process NaCl object files as produced using |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 int thread_num); | 617 int thread_num); |
| 618 | 618 |
| 619 void NaClRemoveThreadMu(struct NaClApp *nap, | 619 void NaClRemoveThreadMu(struct NaClApp *nap, |
| 620 int thread_num); | 620 int thread_num); |
| 621 | 621 |
| 622 struct NaClAppThread *NaClGetThreadMu(struct NaClApp *nap, | 622 struct NaClAppThread *NaClGetThreadMu(struct NaClApp *nap, |
| 623 int thread_num); | 623 int thread_num); |
| 624 | 624 |
| 625 void NaClAppInitialDescriptorHookup(struct NaClApp *nap); | 625 void NaClAppInitialDescriptorHookup(struct NaClApp *nap); |
| 626 | 626 |
| 627 void NaClCreateServiceSocket(struct NaClApp *nap); | |
| 628 | |
| 629 void NaClSetUpBootstrapChannel(struct NaClApp *nap, | |
| 630 NaClHandle inherited_desc); | |
| 631 | |
| 632 void NaClSecureCommandChannel(struct NaClApp *nap); | |
| 633 | |
| 634 /* | 627 /* |
| 635 * Loads the |nexe| as a NaCl app module. | 628 * Loads the |nexe| as a NaCl app module. |
| 636 * The |load_cb| callback is invoked before the the |nexe| is loaded to allow | 629 * The |load_cb| callback is invoked before the the |nexe| is loaded to allow |
| 637 * validation being run in parallel. | 630 * validation being run in parallel. |
| 638 */ | 631 */ |
| 639 void NaClAppLoadModule(struct NaClApp *self, | 632 void NaClAppLoadModule(struct NaClApp *self, |
| 640 struct NaClDesc *nexe, | 633 struct NaClDesc *nexe, |
| 641 void (*load_cb)(void *instance_data, | 634 void (*load_cb)(void *instance_data, |
| 642 NaClErrorCode status), | 635 NaClErrorCode status), |
| 643 void *instance_data); | 636 void *instance_data); |
| 644 | 637 |
| 645 /* | 638 /* |
| 646 * Starts the NaCl app, the |start_cb| callback is invoked before the | 639 * Starts the NaCl app, the |start_cb| callback is invoked before the |
| 647 * application is actually started. | 640 * application is actually started. |
| 648 */ | 641 */ |
| 649 void NaClAppStartModule(struct NaClApp *self, | 642 void NaClAppStartModule(struct NaClApp *self, |
| 650 void (*start_cb)(void *instance_data, | 643 void (*start_cb)(void *instance_data, |
| 651 NaClErrorCode status), | 644 NaClErrorCode status), |
| 652 void *instance_data); | 645 void *instance_data); |
| 653 | 646 |
| 654 void NaClAppShutdown(struct NaClApp *self, | 647 void NaClAppShutdown(struct NaClApp *self, |
| 655 int exit_status); | 648 int exit_status); |
| 656 | 649 |
| 657 NaClErrorCode NaClWaitForLoadModuleCommand(struct NaClApp *nap) NACL_WUR; | |
| 658 | |
| 659 NaClErrorCode NaClGetLoadStatus(struct NaClApp *nap) NACL_WUR; | 650 NaClErrorCode NaClGetLoadStatus(struct NaClApp *nap) NACL_WUR; |
| 660 | 651 |
| 661 NaClErrorCode NaClWaitForStartModuleCommand(struct NaClApp *nap) NACL_WUR; | |
| 662 | |
| 663 /* | |
| 664 * NaClBlockIfCommandChannelExists is used during error exit. If | |
| 665 * there is a secure command channel, we sent an RPC reply with the | |
| 666 * reason that the nexe was rejected. If we exit immediately, that | |
| 667 * reply may still be in-flight and the various channel closure (esp | |
| 668 * reverse channels, if those were set up) may be detected first by | |
| 669 * the controlling process on the other end of the command channel or | |
| 670 * reverse channel. When channel closure wins the race against the | |
| 671 * RPC reply, it would result in a crash being reported, rather than | |
| 672 * the error code carried in the RPC reply. We want to ensure that | |
| 673 * the RPC reply to get processed. Instead of allowing the service | |
| 674 * runtime process to exit, we block the main thread and wait for the | |
| 675 * hard-shutdown on the command channel or command channel closure. | |
| 676 * | |
| 677 * If there is no command channel, NaClBlockIfCommandChannelExists | |
| 678 * just returns immediately. | |
| 679 */ | |
| 680 void NaClBlockIfCommandChannelExists(struct NaClApp *nap); | |
| 681 | |
| 682 void NaClFillMemoryRegionWithHalt(void *start, size_t size); | 652 void NaClFillMemoryRegionWithHalt(void *start, size_t size); |
| 683 | 653 |
| 684 void NaClFillTrampolineRegion(struct NaClApp *nap); | 654 void NaClFillTrampolineRegion(struct NaClApp *nap); |
| 685 | 655 |
| 686 void NaClFillEndOfTextRegion(struct NaClApp *nap); | 656 void NaClFillEndOfTextRegion(struct NaClApp *nap); |
| 687 | 657 |
| 688 #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_x86 && NACL_BUILD_SUBARCH == 32 | 658 #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_x86 && NACL_BUILD_SUBARCH == 32 |
| 689 | 659 |
| 690 int NaClMakePcrelThunk(struct NaClApp *nap, enum NaClAslrMode aslr_mode); | 660 int NaClMakePcrelThunk(struct NaClApp *nap, enum NaClAslrMode aslr_mode); |
| 691 | 661 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 #else | 792 #else |
| 823 static INLINE void NaClHandleBootstrapArgs(int *argc_p, char ***argv_p) { | 793 static INLINE void NaClHandleBootstrapArgs(int *argc_p, char ***argv_p) { |
| 824 UNREFERENCED_PARAMETER(argc_p); | 794 UNREFERENCED_PARAMETER(argc_p); |
| 825 UNREFERENCED_PARAMETER(argv_p); | 795 UNREFERENCED_PARAMETER(argv_p); |
| 826 } | 796 } |
| 827 #endif | 797 #endif |
| 828 | 798 |
| 829 EXTERN_C_END | 799 EXTERN_C_END |
| 830 | 800 |
| 831 #endif /* NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_SEL_LDR_H_ */ | 801 #endif /* NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_SEL_LDR_H_ */ |
| OLD | NEW |