| 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/include/concurrency_ops.h" | 7 #include "native_client/src/include/concurrency_ops.h" |
| 8 #include "native_client/src/shared/platform/nacl_log.h" | 8 #include "native_client/src/shared/platform/nacl_log.h" |
| 9 #include "native_client/src/shared/utils/types.h" | 9 #include "native_client/src/shared/utils/types.h" |
| 10 #include "native_client/src/trusted/service_runtime/sel_ldr.h" | 10 #include "native_client/src/trusted/service_runtime/sel_ldr.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 } | 66 } |
| 67 if (nap->validator_stub_out_mode) { | 67 if (nap->validator_stub_out_mode) { |
| 68 /* Validation caching is currently incompatible with stubout. */ | 68 /* Validation caching is currently incompatible with stubout. */ |
| 69 metadata = NULL; | 69 metadata = NULL; |
| 70 cache = NULL; | 70 cache = NULL; |
| 71 /* In stub out mode, we do two passes. The second pass acts as a | 71 /* In stub out mode, we do two passes. The second pass acts as a |
| 72 sanity check that bad instructions were indeed overwritten with | 72 sanity check that bad instructions were indeed overwritten with |
| 73 allowable HLTs. */ | 73 allowable HLTs. */ |
| 74 status = validator->Validate(guest_addr, data, size, | 74 status = validator->Validate(guest_addr, data, size, |
| 75 TRUE, /* stub out */ | 75 TRUE, /* stub out */ |
| 76 nap->pnacl_mode, |
| 76 FALSE, /* text is not read-only */ | 77 FALSE, /* text is not read-only */ |
| 77 nap->cpu_features, | 78 nap->cpu_features, |
| 78 metadata, | 79 metadata, |
| 79 cache); | 80 cache); |
| 80 } | 81 } |
| 81 if (status == NaClValidationSucceeded) { | 82 if (status == NaClValidationSucceeded) { |
| 82 /* Fixed feature CPU mode implies read-only. */ | 83 /* Fixed feature CPU mode implies read-only. */ |
| 83 int readonly_text = nap->fixed_feature_cpu_mode; | 84 int readonly_text = nap->fixed_feature_cpu_mode; |
| 84 status = validator->Validate(guest_addr, data, size, | 85 status = validator->Validate(guest_addr, data, size, |
| 85 FALSE, /* do not stub out */ | 86 FALSE, /* do not stub out */ |
| 87 nap->pnacl_mode, |
| 86 readonly_text, | 88 readonly_text, |
| 87 nap->cpu_features, | 89 nap->cpu_features, |
| 88 metadata, | 90 metadata, |
| 89 cache); | 91 cache); |
| 90 } | 92 } |
| 91 return NaClValidateStatus(status); | 93 return NaClValidateStatus(status); |
| 92 } | 94 } |
| 93 | 95 |
| 94 int NaClValidateCodeReplacement(struct NaClApp *nap, uintptr_t guest_addr, | 96 int NaClValidateCodeReplacement(struct NaClApp *nap, uintptr_t guest_addr, |
| 95 uint8_t *data_old, uint8_t *data_new, | 97 uint8_t *data_old, uint8_t *data_new, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 NaClLog(LOG_ERROR, | 166 NaClLog(LOG_ERROR, |
| 165 "Run sel_ldr in debug mode to ignore validation failure.\n"); | 167 "Run sel_ldr in debug mode to ignore validation failure.\n"); |
| 166 NaClLog(LOG_ERROR, | 168 NaClLog(LOG_ERROR, |
| 167 "Run ncval <module-name> for validation error details.\n"); | 169 "Run ncval <module-name> for validation error details.\n"); |
| 168 rcode = LOAD_VALIDATION_FAILED; | 170 rcode = LOAD_VALIDATION_FAILED; |
| 169 } | 171 } |
| 170 } | 172 } |
| 171 } | 173 } |
| 172 return rcode; | 174 return rcode; |
| 173 } | 175 } |
| OLD | NEW |