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

Issue 9535001: Add validation caching interface. (Closed)

Created:
8 years, 9 months ago by Nick Bray (chromium)
Modified:
8 years, 9 months ago
Reviewers:
Mark Seaborn, bsy
CC:
native-client-reviews_googlegroups.com
Visibility:
Public.

Description

Add validation caching interface. This CL paves the way for Chrome-side changes that will actually inject the validation caching interface into the sel_ldr process. BUG= http://code.google.com/p/nativeclient/issues/detail?id=2515 TEST= ./scons run_validation_cache_test Committed: https://src.chromium.org/viewvc/native_client?view=rev&revision=7920

Patch Set 1 #

Patch Set 2 : Whitespace #

Patch Set 3 : Type fix #

Patch Set 4 : Bugfix #

Total comments: 22

Patch Set 5 : Edits #

Total comments: 46

Patch Set 6 : More edits #

Total comments: 7

Patch Set 7 : Header update #

Total comments: 30

Patch Set 8 : More edits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+443 lines, -49 lines) Patch
M src/tools/validator_tools/ncstubout.c View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M src/trusted/service_runtime/sel_ldr.h View 1 2 3 4 5 6 7 2 chunks +2 lines, -0 lines 0 comments Download
M src/trusted/service_runtime/sel_ldr.c View 1 2 3 4 5 6 1 chunk +3 lines, -0 lines 0 comments Download
M src/trusted/service_runtime/sel_main_chrome.h View 1 2 3 4 5 6 7 2 chunks +4 lines, -0 lines 0 comments Download
M src/trusted/service_runtime/sel_main_chrome.c View 1 2 3 4 5 6 7 3 chunks +9 lines, -0 lines 0 comments Download
M src/trusted/service_runtime/sel_validate_image.c View 1 2 3 4 5 6 7 3 chunks +9 lines, -2 lines 0 comments Download
M src/trusted/validator/build.scons View 1 2 3 4 1 chunk +20 lines, -0 lines 0 comments Download
M src/trusted/validator/ncvalidate.h View 1 2 3 4 5 6 7 2 chunks +4 lines, -1 line 0 comments Download
A src/trusted/validator/validation_cache.h View 1 2 3 4 5 6 7 1 chunk +58 lines, -0 lines 0 comments Download
A src/trusted/validator/validation_cache_test.cc View 1 2 3 4 5 6 7 1 chunk +223 lines, -0 lines 0 comments Download
M src/trusted/validator/x86/32/ncvalidate.c View 1 2 3 4 5 6 7 4 chunks +36 lines, -4 lines 0 comments Download
M src/trusted/validator/x86/64/ncvalidate.h View 1 2 3 1 chunk +0 lines, -14 lines 0 comments Download
M src/trusted/validator/x86/64/ncvalidate.c View 1 2 3 4 5 6 7 5 chunks +45 lines, -22 lines 0 comments Download
M src/trusted/validator/x86/64/ncvalidate_verbose.c View 1 2 3 1 chunk +5 lines, -2 lines 0 comments Download
M src/trusted/validator/x86/nacl_cpuid.h View 2 chunks +4 lines, -0 lines 0 comments Download
M src/trusted/validator/x86/ncval_reg_sfi/ncvalidate_iter.h View 1 2 3 4 5 6 7 1 chunk +3 lines, -0 lines 0 comments Download
M src/trusted/validator/x86/ncval_reg_sfi/ncvalidate_iter.c View 1 2 3 4 5 6 7 1 chunk +4 lines, -0 lines 0 comments Download
M src/trusted/validator/x86/ncval_seg_sfi/ncvalidate.h View 1 2 3 4 5 6 7 1 chunk +3 lines, -0 lines 0 comments Download
M src/trusted/validator/x86/ncval_seg_sfi/ncvalidate.c View 1 2 3 4 5 6 7 1 chunk +4 lines, -0 lines 0 comments Download
M src/trusted/validator_arm/ncvalidate.cc View 1 2 3 4 5 6 7 1 chunk +4 lines, -1 line 0 comments Download
M src/trusted/validator_x86/ncenuminsts_x86_32.c View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M src/trusted/validator_x86/ncenuminsts_x86_64.c View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 8 (0 generated)
Nick Bray (chromium)
8 years, 9 months ago (2012-02-29 03:47:56 UTC) #1
Mark Seaborn
Initial feedback... https://chromiumcodereview.appspot.com/9535001/diff/7006/src/trusted/service_runtime/sel_validate_image.c File src/trusted/service_runtime/sel_validate_image.c (right): https://chromiumcodereview.appspot.com/9535001/diff/7006/src/trusted/service_runtime/sel_validate_image.c#newcode34 src/trusted/service_runtime/sel_validate_image.c:34: void * cache_context = nap->validation_cache_context; Spacing style ...
8 years, 9 months ago (2012-02-29 21:33:34 UTC) #2
Nick Bray (chromium)
PTAL, two disagreements. https://chromiumcodereview.appspot.com/9535001/diff/7006/src/trusted/service_runtime/sel_validate_image.c File src/trusted/service_runtime/sel_validate_image.c (right): https://chromiumcodereview.appspot.com/9535001/diff/7006/src/trusted/service_runtime/sel_validate_image.c#newcode34 src/trusted/service_runtime/sel_validate_image.c:34: void * cache_context = nap->validation_cache_context; On ...
8 years, 9 months ago (2012-02-29 22:58:08 UTC) #3
Mark Seaborn
http://codereview.chromium.org/9535001/diff/13001/src/tools/validator_tools/ncstubout.c File src/tools/validator_tools/ncstubout.c (right): http://codereview.chromium.org/9535001/diff/13001/src/tools/validator_tools/ncstubout.c#newcode43 src/tools/validator_tools/ncstubout.c:43: code_size, bundle_size, &cpu_features, NULL); You could fix the double ...
8 years, 9 months ago (2012-03-01 00:26:20 UTC) #4
Nick Bray (chromium)
Last call. http://codereview.chromium.org/9535001/diff/13001/src/tools/validator_tools/ncstubout.c File src/tools/validator_tools/ncstubout.c (right): http://codereview.chromium.org/9535001/diff/13001/src/tools/validator_tools/ncstubout.c#newcode43 src/tools/validator_tools/ncstubout.c:43: code_size, bundle_size, &cpu_features, NULL); On 2012/03/01 00:26:20, ...
8 years, 9 months ago (2012-03-01 01:25:16 UTC) #5
bsy
interface nits. https://chromiumcodereview.appspot.com/9535001/diff/11009/src/trusted/validator/validation_cache.h File src/trusted/validator/validation_cache.h (right): https://chromiumcodereview.appspot.com/9535001/diff/11009/src/trusted/validator/validation_cache.h#newcode36 src/trusted/validator/validation_cache.h:36: * AddData must not be called after ...
8 years, 9 months ago (2012-03-01 19:22:49 UTC) #6
Mark Seaborn
LGTM with fixes below https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validator/validation_cache.h File src/trusted/validator/validation_cache.h (right): https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validator/validation_cache.h#newcode46 src/trusted/validator/validation_cache.h:46: typedef struct NaClValidationCache { Suggestion: ...
8 years, 9 months ago (2012-03-01 19:23:11 UTC) #7
Nick Bray (chromium)
8 years, 9 months ago (2012-03-01 21:16:57 UTC) #8
Committed revision 7920.

https://chromiumcodereview.appspot.com/9535001/diff/11009/src/trusted/validat...
File src/trusted/validator/validation_cache.h (right):

https://chromiumcodereview.appspot.com/9535001/diff/11009/src/trusted/validat...
src/trusted/validator/validation_cache.h:36: * AddData must not be called after
calling this function.
On 2012/03/01 19:22:50, bsy wrote:
> can this be invoked more than once?

Done.

https://chromiumcodereview.appspot.com/9535001/diff/11009/src/trusted/validat...
src/trusted/validator/validation_cache.h:40: * QueryCodeValidates must be called
first.
On 2012/03/01 19:22:50, bsy wrote:
> monotonic cache:  no way to clear the bit, except by hoping for the cache to
> fill and evict an entry?  so the cache exhibits one-sided error, so that if
> cache->QueryCodeValides(query) returns "false", that really means "unknown"? 
> maybe rename it to something that suggests "KnownToValidate"?

Done.

https://chromiumcodereview.appspot.com/9535001/diff/11009/src/trusted/validat...
src/trusted/validator/validation_cache.h:43: * DestroyQuery: cleanup and
deallocate the query object.
On 2012/03/01 19:22:50, bsy wrote:
> if query could be NULL here, it would make some cleanup code simpler.  if it
> took the address of the query, then it could also automatically set the
variable
> to be NULL, so that unless the caller copied the pointer after invoking
> CreateQuery, we're unlikely to have use-after-free issues.

Skipping.  It's a marginal safety improvement for bad code, and it makes an
assumption there is a single, mutable query pointer - not a bad assumption, but
still an assumption.

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
File src/trusted/validator/validation_cache.h (right):

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
src/trusted/validator/validation_cache.h:46: typedef struct NaClValidationCache
{
On 2012/03/01 19:23:12, Mark Seaborn wrote:
> Suggestion: I'd be inclined to refer to it as 'struct NaClValidationCache' and
> not use the typedef, for consistency with service_runtime and NaClDesc.

Done.

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
File src/trusted/validator/validation_cache_test.cc (right):

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
src/trusted/validator/validation_cache_test.cc:16: const char nop[CODE_SIZE+1] =
On 2012/03/01 19:23:12, Mark Seaborn wrote:
> space around '+'

Done.

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
src/trusted/validator/validation_cache_test.cc:31: /* Sanity check that we're
getting the right object. */
On 2012/03/01 19:23:12, Mark Seaborn wrote:
> Putting the comment on the same line as 'int marker' would make it clearer
what
> it's referring to.

Done.

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
src/trusted/validator/validation_cache_test.cc:34: int set_validates_expected;
On 2012/03/01 19:23:12, Mark Seaborn wrote:
> "expect_set_code_validates_call"?  This is C++, so you can use the "bool"
type.

Done.

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
src/trusted/validator/validation_cache_test.cc:35: int query_destroyed;
On 2012/03/01 19:23:12, Mark Seaborn wrote:
> "bool"

Done.

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
src/trusted/validator/validation_cache_test.cc:40: QUERY_GET,
On 2012/03/01 19:23:12, Mark Seaborn wrote:
> QUERY_GET_CALLED, QUERY_SET_CALLED?

Done.

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
src/trusted/validator/validation_cache_test.cc:56: EXPECT_EQ(31,
mcontext->marker);
On 2012/03/01 19:23:12, Mark Seaborn wrote:
> Magic number, move to enum/const

Done.

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
src/trusted/validator/validation_cache_test.cc:57: mquery->marker = 37;
On 2012/03/01 19:23:12, Mark Seaborn wrote:
> Ditto - magic number

Done.

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
src/trusted/validator/validation_cache_test.cc:67: UNREFERENCED_PARAMETER(data);
On 2012/03/01 19:23:12, Mark Seaborn wrote:
> These should go as close to the function start as possible.

Done.

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
src/trusted/validator/validation_cache_test.cc:69: /* Small data is supicious.
*/
On 2012/03/01 19:23:12, Mark Seaborn wrote:
> 'suspicious'

Done.

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
src/trusted/validator/validation_cache_test.cc:112: unsigned char
code_buffer[32];
On 2012/03/01 19:23:12, Mark Seaborn wrote:
> 32 -> CODE_SIZE

Done.

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
src/trusted/validator/validation_cache_test.cc:131: memset(code_buffer, 0x90,
32);
On 2012/03/01 19:23:12, Mark Seaborn wrote:
> 32 -> sizeof(code_buffer) or CODE_SIZE

Done.

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
src/trusted/validator/validation_cache_test.cc:148: cache.AddData(query, 0, 6);
On 2012/03/01 19:23:12, Mark Seaborn wrote:
> 0 -> NULL

Done.

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
File src/trusted/validator/x86/32/ncvalidate.c (right):

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
src/trusted/validator/x86/32/ncvalidate.c:12: /* HACK to get access to
didstubout */
On 2012/03/01 19:23:12, Mark Seaborn wrote:
> I thought you were going to add a getter function for 'didstubout'?

Done.

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
File src/trusted/validator/x86/64/ncvalidate.c (right):

https://chromiumcodereview.appspot.com/9535001/diff/19002/src/trusted/validat...
src/trusted/validator/x86/64/ncvalidate.c:13: /* HACK to get access to
did_stub_out */
On 2012/03/01 19:23:12, Mark Seaborn wrote:
> Ditto.  Add an accessor function?  (At least you should write "TODO" not
> "HACK".)

Done.

Powered by Google App Engine
This is Rietveld 408576698