Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel fuzzing #11

Closed
9 tasks
senier opened this issue Jan 24, 2024 · 0 comments · Fixed by #20
Closed
9 tasks

Parallel fuzzing #11

senier opened this issue Jan 24, 2024 · 0 comments · Fixed by #20

Comments

@senier
Copy link
Owner

senier commented Jan 24, 2024

Utilize multiple CPU cores for fuzzing.

Parallel fuzzing requires refactoring of coverage collection. Right now, coverage is collected in the child process and the new coverage is sent over a pipe shared between parent and child. The parent then compares the new coverage with the coverage previously stored (by the parent) and in case it increased, stores the binary returned by the child process.

The current approach has a number of limitations:

  • Coverage is recorded in the child process only. In case of multiple child processes, a sample may be considered to lead to new paths, while it just lead to a new path in a specific child process.
  • Binaries are needlessly sent back from child to parent, while the parent needs to keep the sample anyways to handle cases where the child process hangs or times out
  • The information returned is either a number (the current coverage) or the text of an exception. Ideally, the format should be more structured (e.g. a JSON document).

Design:

Child processes

The tracer is changed such that it can be reset.

  • Read the next job from the job queue
  • Reset the tracer
  • Put a status message into the result queue before execution the target
  • Run the target
  • If the target ran successfully, put report message into result queue
  • If the target crashed, put an error reported into the result queue

Status report

class Status:
    worker: int
    job: int

Coverage report

class Report:
    worker: int
    job: int
    covered: list[tuple[str, str, int]]

Error report

class Error:
    worker: int
    job: int
    message: str

Parent process

  • The parent spawns and starts a configurable number of child processes and passes their worker ID, a command queue and a result queue
  • An object for each child process contains:
    • child process
  • In a loop, the parent
    • generates a new binary and associate it with a unique job ID
    • puts it into the job database under that id with status submitted and no worker id
    • submit it to the shared job queue
    • checks for response in the response queue
      • if response is an error: retrieve binary with corresponding job ID and store it into crash folder
      • if response is a status: update job with worker and timestamp in database
      • if response is a report: if provided coverage information increases total coverage store binary in samples
      • delete job from database
    • Check time stamps in job database
      • if timestamp of a submitted job is older than timeout, kill and restart the corresponding worker

Job

class Job:
   id: int
   data: bytes
senier added a commit that referenced this issue Jan 28, 2024
senier added a commit that referenced this issue Jan 29, 2024
senier added a commit that referenced this issue Feb 4, 2024
@senier senier closed this as completed in #20 Feb 4, 2024
@senier senier closed this as completed in 88e92e8 Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant