Repository navigation
Implement untrusted RPCS for fuzzing and reproduction. - #888
Conversation
For the new fuzzing pipeline (#483).
|
/gcbrun |
|
/gcbrun |
|
/gcbrun |
|
/gcbrun |
|
/gcbrun |
| @@ -123,7 +123,17 @@ func (s *UntrustedRunnerServer) PruneCorpus(context.Context, *pb.PruneCorpusRequ | |||
| } | |||
|
|
|||
| // ProcessTestcase is processes a testcase with a fuzzing engine (e.g. minimization). | |||
There was a problem hiding this comment.
nit (not your change): "is " is a typo
| optional bytes output = 4; | ||
| } | ||
|
|
||
| message RunEngineFuzzerRequest { |
There was a problem hiding this comment.
a random thought: would it be better to name all of these starting with "Engine", e.g. "EngineRunFuzzerRequest", IMO that way it still sounds good, but kinda easier to attribute to the in-process fuzzing pipeline
There was a problem hiding this comment.
Yes, or how about just EngineRunRequest, EngineRunResponse ?
I don't see you use Fuzzer in any of the other fields like EngineCrash or stuff.
There was a problem hiding this comment.
Renamed to EngineFuzz{Request,Response}. Want to make it explicit that this is for fuzzing.
| build_dir = environment.get_value('BUILD_DIR') | ||
| target_path = engine_common.find_fuzzer_path(build_dir, target_name) | ||
| if not target_path: | ||
| raise TargetNotFoundError('Failed to find target ' + target_name) |
There was a problem hiding this comment.
Why not leave this logic in the constructor? Isn't it better to fail earlier?
There was a problem hiding this comment.
We can't call this in the constructor, which lives on the host and therefore doesn't have access to the build.
| raise ValueError('Unknown stat type for ' + key) | ||
|
|
||
| packed_value.Unpack(value) | ||
| unpacked_stats[key] = value.value |
There was a problem hiding this comment.
Are these two lines doing what they're expected to do? Doesn't look like a typical Python code to me, but I'm not familiar with that Unpack method :)
There was a problem hiding this comment.
Yeah, it's protobuf-generated code. See e.g. protocolbuffers/protobuf#4420 (comment)
| engine_impl = engine.get(request.engine) | ||
| result = testcase_manager.engine_reproduce( | ||
| engine_impl, request.target_name, request.testcase_path, | ||
| list(request.arguments), request.timeout) |
There was a problem hiding this comment.
nit: for some reason, I don't like the conversion to the list here, maybe do it inside engine_reproduce? That way it will work with both lists and whatever protobuf object there is, without requiring the caller to cast the type epxlicitly
There was a problem hiding this comment.
Good point! Moved!
| optional bytes output = 4; | ||
| } | ||
|
|
||
| message RunEngineFuzzerRequest { |
There was a problem hiding this comment.
Yes, or how about just EngineRunRequest, EngineRunResponse ?
I don't see you use Fuzzer in any of the other fields like EngineCrash or stuff.
|
|
||
| @classmethod | ||
| def setUpClass(cls): | ||
| cls.saved_env = os.environ.copy() |
There was a problem hiding this comment.
Why not test_helpers.patch_environ(self) and then remove code in tearDownClass
There was a problem hiding this comment.
That only works for setUp, not setUpClass
| build_manager.setup_build() | ||
| with self.assertRaises(testcase_manager.TargetNotFoundError): | ||
| testcase_manager.engine_reproduce(libfuzzer_engine.LibFuzzerEngine(), | ||
| 'not_found', testcase_file_path, [], 30) |
There was a problem hiding this comment.
s/not_found/not_exist ?
| build_dir = environment.get_value('BUILD_DIR') | ||
| target_path = engine_common.find_fuzzer_path(build_dir, target_name) | ||
| if not target_path: | ||
| raise TargetNotFoundError('Failed to find target ' + target_name) |
There was a problem hiding this comment.
We can't call this in the constructor, which lives on the host and therefore doesn't have access to the build.
| raise ValueError('Unknown stat type for ' + key) | ||
|
|
||
| packed_value.Unpack(value) | ||
| unpacked_stats[key] = value.value |
There was a problem hiding this comment.
Yeah, it's protobuf-generated code. See e.g. protocolbuffers/protobuf#4420 (comment)
| engine_impl = engine.get(request.engine) | ||
| result = testcase_manager.engine_reproduce( | ||
| engine_impl, request.target_name, request.testcase_path, | ||
| list(request.arguments), request.timeout) |
There was a problem hiding this comment.
Good point! Moved!
| build_manager.setup_build() | ||
| with self.assertRaises(testcase_manager.TargetNotFoundError): | ||
| testcase_manager.engine_reproduce(libfuzzer_engine.LibFuzzerEngine(), | ||
| 'not_found', testcase_file_path, [], 30) |
|
|
||
| @classmethod | ||
| def setUpClass(cls): | ||
| cls.saved_env = os.environ.copy() |
There was a problem hiding this comment.
That only works for setUp, not setUpClass
| optional bytes output = 4; | ||
| } | ||
|
|
||
| message RunEngineFuzzerRequest { |
There was a problem hiding this comment.
Renamed to EngineFuzz{Request,Response}. Want to make it explicit that this is for fuzzing.
| @@ -123,7 +123,17 @@ func (s *UntrustedRunnerServer) PruneCorpus(context.Context, *pb.PruneCorpusRequ | |||
| } | |||
|
|
|||
| // ProcessTestcase is processes a testcase with a fuzzing engine (e.g. minimization). | |||
|
/gcbrun |
|
/gcbrun |
For the new fuzzing pipeline (#483).