Chromium Code Reviews| 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 #include "native_client/src/shared/platform/nacl_log.h" | 7 #include "native_client/src/shared/platform/nacl_log.h" |
| 8 #include "native_client/src/trusted/service_runtime/sel_ldr.h" | 8 #include "native_client/src/trusted/service_runtime/sel_ldr.h" |
| 9 #include "native_client/src/trusted/validator/ncvalidate.h" | 9 #include "native_client/src/trusted/validator/ncvalidate.h" |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 if (nap->validator_stub_out_mode) { | 64 if (nap->validator_stub_out_mode) { |
| 65 /* Validation caching is currently incompatible with stubout. */ | 65 /* Validation caching is currently incompatible with stubout. */ |
| 66 cache = NULL; | 66 cache = NULL; |
| 67 /* In stub out mode, we do two passes. The second pass acts as a | 67 /* In stub out mode, we do two passes. The second pass acts as a |
| 68 sanity check that bad instructions were indeed overwritten with | 68 sanity check that bad instructions were indeed overwritten with |
| 69 allowable HLTs. */ | 69 allowable HLTs. */ |
| 70 status = NACL_SUBARCH_NAME(ApplyValidator, | 70 status = NACL_SUBARCH_NAME(ApplyValidator, |
| 71 NACL_TARGET_ARCH, | 71 NACL_TARGET_ARCH, |
| 72 NACL_TARGET_SUBARCH)( | 72 NACL_TARGET_SUBARCH)( |
| 73 sb_kind, | 73 sb_kind, |
| 74 NaClApplyValidationDoStubout, | |
| 75 guest_addr, data, size, | 74 guest_addr, data, size, |
| 76 nap->bundle_size, | 75 nap->bundle_size, |
| 76 TRUE, /* stub out */ | |
| 77 FALSE, /* text is not read-only */ | 77 FALSE, /* text is not read-only */ |
| 78 &nap->cpu_features, | 78 &nap->cpu_features, |
| 79 cache); | 79 cache); |
| 80 } | 80 } |
| 81 if (status == NaClValidationSucceeded) { | 81 if (status == NaClValidationSucceeded) { |
| 82 status = NACL_SUBARCH_NAME(ApplyValidator, | 82 status = NACL_SUBARCH_NAME(ApplyValidator, |
| 83 NACL_TARGET_ARCH, | 83 NACL_TARGET_ARCH, |
| 84 NACL_TARGET_SUBARCH)( | 84 NACL_TARGET_SUBARCH)( |
| 85 sb_kind, | 85 sb_kind, |
| 86 NaClApplyCodeValidation, | |
| 87 guest_addr, data, size, | 86 guest_addr, data, size, |
| 88 nap->bundle_size, | 87 nap->bundle_size, |
| 88 FALSE, /* do not stub out */ | |
| 89 /* fixed feature cpu mode implies read-only*/ | |
|
Mark Seaborn
2012/04/10 00:57:38
Space before '*/'
I'd split this into a local var
Nick Bray (chromium)
2012/04/10 18:49:20
Done.
| |
| 89 nap->fixed_feature_cpu_mode, | 90 nap->fixed_feature_cpu_mode, |
| 90 &nap->cpu_features, | 91 &nap->cpu_features, |
| 91 cache); | 92 cache); |
| 92 } | 93 } |
| 93 return NaClValidateStatus(status); | 94 return NaClValidateStatus(status); |
| 94 } | 95 } |
| 95 | 96 |
| 96 int NaClValidateCodeReplacement(struct NaClApp *nap, uintptr_t guest_addr, | 97 int NaClValidateCodeReplacement(struct NaClApp *nap, uintptr_t guest_addr, |
| 97 uint8_t *data_old, uint8_t *data_new, | 98 uint8_t *data_old, uint8_t *data_new, |
| 98 size_t size) { | 99 size_t size) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 NaClLog(LOG_ERROR, | 160 NaClLog(LOG_ERROR, |
| 160 "Run sel_ldr in debug mode to ignore validation failure.\n"); | 161 "Run sel_ldr in debug mode to ignore validation failure.\n"); |
| 161 NaClLog(LOG_ERROR, | 162 NaClLog(LOG_ERROR, |
| 162 "Run ncval <module-name> for validation error details.\n"); | 163 "Run ncval <module-name> for validation error details.\n"); |
| 163 rcode = LOAD_VALIDATION_FAILED; | 164 rcode = LOAD_VALIDATION_FAILED; |
| 164 } | 165 } |
| 165 } | 166 } |
| 166 } | 167 } |
| 167 return rcode; | 168 return rcode; |
| 168 } | 169 } |
| OLD | NEW |