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

Unified Diff: src/trusted/service_runtime/sel_validate_image.c

Issue 9535001: Add validation caching interface. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: More edits Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: src/trusted/service_runtime/sel_validate_image.c
diff --git a/src/trusted/service_runtime/sel_validate_image.c b/src/trusted/service_runtime/sel_validate_image.c
index b08b2312a7743f7bb6d9be7fc24563e15e79c010..f02418a42322eb2d54b31b673108284c709f267c 100644
--- a/src/trusted/service_runtime/sel_validate_image.c
+++ b/src/trusted/service_runtime/sel_validate_image.c
@@ -29,7 +29,12 @@ int NaClValidateCode(struct NaClApp *nap, uintptr_t guest_addr,
uint8_t *data, size_t size) {
NaClValidationStatus status = NaClValidationSucceeded;
enum NaClSBKind sb_kind = NACL_SB_DEFAULT;
+
+ NaClValidationCache *cache = nap->validation_cache;
+
if (nap->validator_stub_out_mode) {
+ /* Validation caching is currently incompatible with stubout. */
+ cache = NULL;
/* In stub out mode, we do two passes. The second pass acts as a
sanity check that bad instructions were indeed overwritten with
allowable HLTs. */
@@ -39,7 +44,8 @@ int NaClValidateCode(struct NaClApp *nap, uintptr_t guest_addr,
sb_kind,
NaClApplyValidationDoStubout,
guest_addr, data, size,
- nap->bundle_size, &nap->cpu_features);
+ nap->bundle_size, &nap->cpu_features,
+ cache);
}
if (status == NaClValidationSucceeded) {
status = NACL_SUBARCH_NAME(ApplyValidator,
@@ -48,7 +54,8 @@ int NaClValidateCode(struct NaClApp *nap, uintptr_t guest_addr,
sb_kind,
NaClApplyCodeValidation,
guest_addr, data, size,
- nap->bundle_size, &nap->cpu_features);
+ nap->bundle_size, &nap->cpu_features,
+ cache);
}
return NaClValidateStatus(status);
}

Powered by Google App Engine
This is Rietveld 408576698