pub struct ControllerProxy { /* private fields */ }
Implementations§
Source§impl ControllerProxy
impl ControllerProxy
Sourcepub fn new(channel: AsyncChannel) -> Self
pub fn new(channel: AsyncChannel) -> Self
Create a new Proxy for fuchsia.fuzzer/Controller.
Sourcepub fn take_event_stream(&self) -> ControllerEventStream
pub fn take_event_stream(&self) -> ControllerEventStream
Get a Stream of events from the remote end of the protocol.
§Panics
Panics if the event stream was already taken.
Sourcepub fn configure(
&self,
options: &Options,
) -> QueryResponseFut<ControllerConfigureResult, DefaultFuchsiaResourceDialect>
pub fn configure( &self, options: &Options, ) -> QueryResponseFut<ControllerConfigureResult, DefaultFuchsiaResourceDialect>
Sets various execution and error detection parameters. This may be
called multiple times; only the most recently received options are used.
If the Options
parameter omits one or more fields, those parameters
are unchanged in the fuzzer. Until the initial call to this method, the
fuzzer should assume the default values for Options
.
- request
options
the execution and error detection parameters.
- error one of the following:
- error
ZX_ERR_BAD_STATE
if a long-running call such asExecute
,Cleanse
,Minimize
,Fuzz
, orMerge
is in progress.ZX_ERR_NOT_SUPPORTED
if a value provided for an option is not supported by the engine. Check the logs for additional details.
Sourcepub fn get_options(
&self,
) -> QueryResponseFut<Options, DefaultFuchsiaResourceDialect>
pub fn get_options( &self, ) -> QueryResponseFut<Options, DefaultFuchsiaResourceDialect>
Gets the current values for the various execution and error detection parameters.
- response
options
the execution and error detection parameters.
Sourcepub fn add_to_corpus(
&self,
corpus: Corpus,
input: Input,
) -> QueryResponseFut<ControllerAddToCorpusResult, DefaultFuchsiaResourceDialect>
pub fn add_to_corpus( &self, corpus: Corpus, input: Input, ) -> QueryResponseFut<ControllerAddToCorpusResult, DefaultFuchsiaResourceDialect>
Writes the provided input
to either the “seed” or “live” corpus
.
Returns an error if transferring the input fails; see Input
for
details.
- request
corpus
the type of corpus to add to. - request
input
the sequence of bytes to add as a test input.
- error one of the following:
ZX_ERR_INVALID_ARGS
if corpus type is invalid.- A socket error if transferring the input fails.
Sourcepub fn read_corpus(
&self,
corpus: Corpus,
corpus_reader: ClientEnd<CorpusReaderMarker>,
) -> QueryResponseFut<(), DefaultFuchsiaResourceDialect>
pub fn read_corpus( &self, corpus: Corpus, corpus_reader: ClientEnd<CorpusReaderMarker>, ) -> QueryResponseFut<(), DefaultFuchsiaResourceDialect>
Connects a corpus_reader
for either the “seed” or “live” corpus.
- request
corpus
the type of corpus to read from. - request
corpus_reader
the client used to send test inputs.
Sourcepub fn write_dictionary(
&self,
dictionary: Input,
) -> QueryResponseFut<ControllerWriteDictionaryResult, DefaultFuchsiaResourceDialect>
pub fn write_dictionary( &self, dictionary: Input, ) -> QueryResponseFut<ControllerWriteDictionaryResult, DefaultFuchsiaResourceDialect>
Parses and loads an AFL-style dictionary. Invalid entries are logged and skipped.
See also:
- https://github.com/mirrorer/afl/blob/master/dictionaries/README.dictionaries
- request
dictionary
the AFL-style dictionary
- error one of the following:
- A socket error if transferring the input fails.
*
ZX_ERR_INVALID_ARGS
if parsing the dictionary fails.
- A socket error if transferring the input fails.
*
Sourcepub fn read_dictionary(
&self,
) -> QueryResponseFut<Input, DefaultFuchsiaResourceDialect>
pub fn read_dictionary( &self, ) -> QueryResponseFut<Input, DefaultFuchsiaResourceDialect>
Returns the current dictionary as an Input, which may be empty.
- response
dictionary
the current AFL-style dictionary.
Sourcepub fn add_monitor(
&self,
monitor: ClientEnd<MonitorMarker>,
) -> QueryResponseFut<(), DefaultFuchsiaResourceDialect>
pub fn add_monitor( &self, monitor: ClientEnd<MonitorMarker>, ) -> QueryResponseFut<(), DefaultFuchsiaResourceDialect>
Installs a Monitor
to push status. To pull status instead, use
GetStatus
.
- request
monitor
the client used to send status updates.
Sourcepub fn fuzz(
&self,
) -> QueryResponseFut<ControllerFuzzResult, DefaultFuchsiaResourceDialect>
pub fn fuzz( &self, ) -> QueryResponseFut<ControllerFuzzResult, DefaultFuchsiaResourceDialect>
Runs the normal fuzzing feedback loop:
- Selects an input from the corpus.
- Mutates the input.
- Uses the
TargetAdapter
to execute the input. - Checks feedback from the
InstrumentedProcesses
. - If the input produced useful feedback, adds it to the corpus.
This call returns quickly, but the loop continues until one of three conditions is met:
- The configured, non-zero number of
runs
has been reached. - The configured, non-zero
duration
elapses. - An error is detected, and returned.
See Result
for more details on long running workflows such as this
one.
- error
ZX_ERR_BAD_STATE
if another long-running workflow is in progress.
Sourcepub fn try_one(
&self,
test_input: Input,
) -> QueryResponseFut<ControllerTryOneResult, DefaultFuchsiaResourceDialect>
pub fn try_one( &self, test_input: Input, ) -> QueryResponseFut<ControllerTryOneResult, DefaultFuchsiaResourceDialect>
Executes the target code with a single test_input
.
See Result
for more details on long running workflows such as this
one.
- request
input
the sequence of bytes to use with the fuzz target.
- error one of the following:
ZX_ERR_BAD_STATE
if another long-running workflow is in progress.- A socket error if transferring the input fails.
Sourcepub fn minimize(
&self,
test_input: Input,
) -> QueryResponseFut<ControllerMinimizeResult, DefaultFuchsiaResourceDialect>
pub fn minimize( &self, test_input: Input, ) -> QueryResponseFut<ControllerMinimizeResult, DefaultFuchsiaResourceDialect>
Attempts to find the smallest input that produces the same error as the
given test_input
,
constrained by the configured total_time
and/or runs
options.
See Result
for more details on long running workflows such as this
one.
- request
input
the sequence of bytes to minimize.
- error one of the following:
ZX_ERR_BAD_STATE
if another long-running workflow is in progress.- A socket error if transferring the input fails.
ZX_ERR_INVALID_ARGS
if the providedtest_input
does not cause an error.
Sourcepub fn cleanse(
&self,
test_input: Input,
) -> QueryResponseFut<ControllerCleanseResult, DefaultFuchsiaResourceDialect>
pub fn cleanse( &self, test_input: Input, ) -> QueryResponseFut<ControllerCleanseResult, DefaultFuchsiaResourceDialect>
Attempts to replace bytes of the given test_input
with “filler” bytes,
e.g. \x00, \xFF, without changing the error produced.
See Result
for more details on long running workflows such as this
one.
To preserve backwards compatibility with libFuzzer and ClusterFuzz, an input that produces no result is not considered an error, and is returned as-is.
- request
input
the sequence of bytes to cleanse.
- error one of the following:
ZX_ERR_BAD_STATE
if another long-running workflow is in progress.- A socket error if transferring the input fails.
Sourcepub fn merge(
&self,
) -> QueryResponseFut<ControllerMergeResult, DefaultFuchsiaResourceDialect>
pub fn merge( &self, ) -> QueryResponseFut<ControllerMergeResult, DefaultFuchsiaResourceDialect>
Attempts to shrink the corpora. Inputs from the seed corpus will be preserved. All other inputs will be sorted by amount of feedback produced and input size, and only those inputs that add new feedback not seen earlier in the sequence will be kept.
See Result
for more details on long running workflows such as this
one.
- error one of the following:
ZX_ERR_BAD_STATE
if another long-running workflow is in progress.ZX_ERR_INVALID_ARGS
if an input in the seed corpus causes an error. Inputs in the live corpus that cause errors are skipped.
Sourcepub fn get_status(
&self,
) -> QueryResponseFut<Status, DefaultFuchsiaResourceDialect>
pub fn get_status( &self, ) -> QueryResponseFut<Status, DefaultFuchsiaResourceDialect>
Returns various fuzzing metrics, e.g. total coverage, speed, etc.
- response
status
the current value of fuzzing metrics.
Sourcepub fn watch_artifact(
&self,
) -> QueryResponseFut<Artifact, DefaultFuchsiaResourceDialect>
pub fn watch_artifact( &self, ) -> QueryResponseFut<Artifact, DefaultFuchsiaResourceDialect>
Returns the results of a long-running workflow.
This method uses the
“hanging get” pattern.
Upon the first call for a given connection, it will immediately return
the controller’s current artifact. Upon subsequent calls, it will block
until the controller’s artifact changes before returning. Clients should
use GetStatus
to ensure the fuzzer is not idle before making a
blocking call to WatchArtifact
.
Combined with the Status.running
value obtained from GetStatus
, this
allows a (re-)connecting client to infer the state of the fuzzer:
- If the fuzzer is idle and has an empty artifact, then it is unchanged since the last connection, if any.
- If the fuzzer is running and has an empty artifact, then it is
performing a long-running workflow started by a previous connection.
The client may call
WatchArtifact
again to wait for the workflow to complete. - If the fuzzer is idle and has a non-empty artifact, then it has completed a long-running workflow since the last connection.
It is not an error for clients to disconnect while waiting for a response from this method. This method is intended to allow clients to resume waiting for a long-running workflow to complete after intentionally or inadvertently being disconnected for an indefinite amount of time.
- response
artifact
the most recent result and/or error-causing input.
Trait Implementations§
Source§impl Clone for ControllerProxy
impl Clone for ControllerProxy
Source§fn clone(&self) -> ControllerProxy
fn clone(&self) -> ControllerProxy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl ControllerProxyInterface for ControllerProxy
impl ControllerProxyInterface for ControllerProxy
type ConfigureResponseFut = QueryResponseFut<Result<(), i32>>
type GetOptionsResponseFut = QueryResponseFut<Options>
type AddToCorpusResponseFut = QueryResponseFut<Result<(), i32>>
type ReadCorpusResponseFut = QueryResponseFut<()>
type WriteDictionaryResponseFut = QueryResponseFut<Result<(), i32>>
type ReadDictionaryResponseFut = QueryResponseFut<Input>
type AddMonitorResponseFut = QueryResponseFut<()>
type FuzzResponseFut = QueryResponseFut<Result<(), i32>>
type TryOneResponseFut = QueryResponseFut<Result<(), i32>>
type MinimizeResponseFut = QueryResponseFut<Result<(), i32>>
type CleanseResponseFut = QueryResponseFut<Result<(), i32>>
type MergeResponseFut = QueryResponseFut<Result<(), i32>>
type GetStatusResponseFut = QueryResponseFut<Status>
type WatchArtifactResponseFut = QueryResponseFut<Artifact>
fn configure(&self, options: &Options) -> Self::ConfigureResponseFut
fn get_options(&self) -> Self::GetOptionsResponseFut
fn add_to_corpus( &self, corpus: Corpus, input: Input, ) -> Self::AddToCorpusResponseFut
fn read_corpus( &self, corpus: Corpus, corpus_reader: ClientEnd<CorpusReaderMarker>, ) -> Self::ReadCorpusResponseFut
fn write_dictionary( &self, dictionary: Input, ) -> Self::WriteDictionaryResponseFut
fn read_dictionary(&self) -> Self::ReadDictionaryResponseFut
fn add_monitor( &self, monitor: ClientEnd<MonitorMarker>, ) -> Self::AddMonitorResponseFut
fn fuzz(&self) -> Self::FuzzResponseFut
fn try_one(&self, test_input: Input) -> Self::TryOneResponseFut
fn minimize(&self, test_input: Input) -> Self::MinimizeResponseFut
fn cleanse(&self, test_input: Input) -> Self::CleanseResponseFut
fn merge(&self) -> Self::MergeResponseFut
fn get_status(&self) -> Self::GetStatusResponseFut
fn watch_artifact(&self) -> Self::WatchArtifactResponseFut
Source§impl Debug for ControllerProxy
impl Debug for ControllerProxy
Source§impl Proxy for ControllerProxy
impl Proxy for ControllerProxy
Source§type Protocol = ControllerMarker
type Protocol = ControllerMarker
Proxy
controls.Source§fn from_channel(inner: AsyncChannel) -> Self
fn from_channel(inner: AsyncChannel) -> Self
Source§fn into_channel(self) -> Result<AsyncChannel, Self>
fn into_channel(self) -> Result<AsyncChannel, Self>
Source§fn as_channel(&self) -> &AsyncChannel
fn as_channel(&self) -> &AsyncChannel
Auto Trait Implementations§
impl Freeze for ControllerProxy
impl !RefUnwindSafe for ControllerProxy
impl Send for ControllerProxy
impl Sync for ControllerProxy
impl Unpin for ControllerProxy
impl !UnwindSafe for ControllerProxy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)