Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/trusted/service_runtime/sel_ldr.h

Issue 10134056: Refactor the process of choosing validators. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: The actual refactoring Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "native_client/src/trusted/service_runtime/nacl_kern_services.h" 47 #include "native_client/src/trusted/service_runtime/nacl_kern_services.h"
48 #include "native_client/src/trusted/service_runtime/nacl_resource.h" 48 #include "native_client/src/trusted/service_runtime/nacl_resource.h"
49 49
50 #include "native_client/src/trusted/service_runtime/sel_mem.h" 50 #include "native_client/src/trusted/service_runtime/sel_mem.h"
51 #include "native_client/src/trusted/service_runtime/sel_util.h" 51 #include "native_client/src/trusted/service_runtime/sel_util.h"
52 #include "native_client/src/trusted/service_runtime/sel_rt.h" 52 #include "native_client/src/trusted/service_runtime/sel_rt.h"
53 53
54 #include "native_client/src/trusted/service_runtime/name_service/name_service.h" 54 #include "native_client/src/trusted/service_runtime/name_service/name_service.h"
55 55
56 #include "native_client/src/trusted/validator/cpufeatures.h" 56 #include "native_client/src/trusted/validator/cpufeatures.h"
57 #include "native_client/src/trusted/validator/validation_status.h"
57 58
58 EXTERN_C_BEGIN 59 EXTERN_C_BEGIN
59 60
60 #define NACL_SERVICE_PORT_DESCRIPTOR 3 61 #define NACL_SERVICE_PORT_DESCRIPTOR 3
61 #define NACL_SERVICE_ADDRESS_DESCRIPTOR 4 62 #define NACL_SERVICE_ADDRESS_DESCRIPTOR 4
62 63
63 #define NACL_DEFAULT_STACK_MAX (16 << 20) /* main thread stack */ 64 #define NACL_DEFAULT_STACK_MAX (16 << 20) /* main thread stack */
64 65
65 #define NACL_SANDBOX_CHROOT_FD "SBX_D" 66 #define NACL_SANDBOX_CHROOT_FD "SBX_D"
66 67
(...skipping 24 matching lines...) Expand all
91 NACL_DEBUG_EXCEPTION_HANDLER_STARTED, 92 NACL_DEBUG_EXCEPTION_HANDLER_STARTED,
92 NACL_DEBUG_EXCEPTION_HANDLER_FAILED 93 NACL_DEBUG_EXCEPTION_HANDLER_FAILED
93 }; 94 };
94 /* 95 /*
95 * Callback function used to request that an exception handler be 96 * Callback function used to request that an exception handler be
96 * attached using the Windows debug API. See sel_main_chrome.h. 97 * attached using the Windows debug API. See sel_main_chrome.h.
97 */ 98 */
98 typedef int (*NaClAttachDebugExceptionHandlerFunc)(void *info, size_t size); 99 typedef int (*NaClAttachDebugExceptionHandlerFunc)(void *info, size_t size);
99 #endif 100 #endif
100 101
102 /* Function type for applying a Validator.
103 * This function is a part of NaCl Validator API: trusted/validator/ncvalidate.h
104 */
105 typedef NaClValidationStatus (*NaClValidateFunc) (
Nick Bray 2012/04/25 20:57:42 This is part of the validator interface, not part
pasko-google - do not use 2012/04/26 15:17:01 Done.
106 uintptr_t guest_addr,
107 uint8_t *data,
108 size_t size,
109 int stubout_mode,
110 int readonly_text,
111 const NaClCPUFeatures *cpu_features,
112 struct NaClValidationCache *cache);
113
114 /* Function type for applying a Validator to copy code from an existing code
115 * segment to a new code segment.
116 * This function is a part of NaCl Validator API: trusted/validator/ncvalidate.h
117 */
118 typedef NaClValidationStatus (*NaClValidateCopyFunc) (
119 uintptr_t guest_addr,
120 uint8_t *data_old,
121 uint8_t *data_new,
122 size_t size,
123 const NaClCPUFeatures *cpu_features);
124
125 /* Function type for applying a Validator on small updates to previously
126 * validated code segments.
127 * This function is a part of NaCl Validator API: trusted/validator/ncvalidate.h
128 */
129 typedef NaClValidationStatus (*NaClValidateCodeReplacementFunc) (
130 uintptr_t guest_addr,
131 uint8_t *data_old,
132 uint8_t *data_new,
133 size_t size,
134 const NaClCPUFeatures *cpu_features);
135
136 /* Make a messy choice for validating functions and record it in NaClApp. */
137 void NaClSelectValidator(struct NaClApp *nap);
138
101 struct NaClApp { 139 struct NaClApp {
102 /* 140 /*
103 * public, user settable prior to app start. 141 * public, user settable prior to app start.
104 */ 142 */
105 uint8_t addr_bits; 143 uint8_t addr_bits;
106 uintptr_t stack_size; 144 uintptr_t stack_size;
107 /* 145 /*
108 * stack_size is the maximum size of the (main) stack. The stack 146 * stack_size is the maximum size of the (main) stack. The stack
109 * memory is eager allocated (mapped in w/o MAP_NORESERVE) so 147 * memory is eager allocated (mapped in w/o MAP_NORESERVE) so
110 * there must be enough swap space; page table entries are not 148 * there must be enough swap space; page table entries are not
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 386
349 int enable_debug_stub; 387 int enable_debug_stub;
350 struct NaClDebugCallbacks *debug_stub_callbacks; 388 struct NaClDebugCallbacks *debug_stub_callbacks;
351 struct NaClMutex exception_mu; 389 struct NaClMutex exception_mu;
352 uint32_t exception_handler; 390 uint32_t exception_handler;
353 int enable_exception_handling; 391 int enable_exception_handling;
354 #if NACL_WINDOWS 392 #if NACL_WINDOWS
355 enum NaClDebugExceptionHandlerState debug_exception_handler_state; 393 enum NaClDebugExceptionHandlerState debug_exception_handler_state;
356 NaClAttachDebugExceptionHandlerFunc attach_debug_exception_handler_func; 394 NaClAttachDebugExceptionHandlerFunc attach_debug_exception_handler_func;
357 #endif 395 #endif
358 int enable_dfa_validator; 396
397 /* Functions for applying validation. */
398 NaClValidateFunc validate_func;
Nick Bray 2012/04/25 20:57:42 I was envisioning these functions in a separate (b
pasko-google - do not use 2012/04/26 15:17:01 well, I thought about this same possibility at fir
Nick Bray 2012/04/27 00:41:30 Yeah, the deref chain isn't pretty, but I figured
399 NaClValidateCopyFunc validate_copy_func;
400 NaClValidateCodeReplacementFunc validate_code_replacement_func;
359 }; 401 };
360 402
361 403
362 404
363 void NaClAppIncrVerbosity(void); 405 void NaClAppIncrVerbosity(void);
364 406
365 /* 407 /*
366 * Initializes a NaCl application with the default parameters 408 * Initializes a NaCl application with the default parameters
367 * and the specified syscall table. 409 * and the specified syscall table.
368 * 410 *
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 818
777 #endif 819 #endif
778 820
779 #if NACL_LINUX 821 #if NACL_LINUX
780 void handle_r_debug(const char *switch_value, char *argv0); 822 void handle_r_debug(const char *switch_value, char *argv0);
781 #endif 823 #endif
782 824
783 EXTERN_C_END 825 EXTERN_C_END
784 826
785 #endif /* NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_SEL_LDR_H_ */ 827 #endif /* NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_SEL_LDR_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698