ARASH is named after the heroic archer in Persian mythology. It can also be read as an acronym for Analysis of cRASH.
Running an experiment requires three steps:
- Install dependencies.
- Setting up LLM access.
- Launch experiment.
You must install:
- Python 3.11
- pip
- python3.11-venv
- Git
- Docker
Install required dependencies in a Python virtual environment:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtSetup OpenAI or Vertex AI with the following steps.
There are two ways to access OpenAI models.
-
OpenAI API Key on OpenAI: This is the default way for using OpenAI models.
-
OpenAI API Key on Azure: Please refer to this section if you are using OpenAI models on Azure.
OpenAI requires an API key.
Then set it as an ENV variable:
export OPENAI_API_KEY='<your-api-key>'If your OpenAI API key is hosted on Azure, you need the specified Endpoint, API key, and the API version (optional).
Then set them as ENV variables:
export AZURE_OPENAI_API_KEY='<your-azure-api-key>'
export AZURE_OPENAI_ENDPOINT='<your-azure-endpoint>'
export AZURE_OPENAI_API_VERSION='<your-azure-api-version>'Tip: To distinguish between the two ways of accessing OpenAI models, you need to add
-azureto the model name when using OpenAI on Azure. For example,gpt-3.5-turbo-azurewill use OpenAI on Azure, whilegpt-3.5-turbowill use OpenAI on OpenAI.
Accessing Vertex AI models require a Google Cloud Project (GCP) with Vertex AI enabled.
Then auth to GCP:
gcloud auth login
gcloud auth application-default login
gcloud auth application-default set-quota-project <your-project>You'll also need to specify the GCP projects and locations where you have Vertex AI quota (comma delimited):
export CLOUD_ML_PROJECT_ID=<gcp-project-id>
export VERTEX_AI_LOCATIONS=us-west1,us-west4,us-east4,us-central1,northamerica-northeast1To generate and evaluate the fuzz targets in a benchmark set via local experiments:
python ./arash_run_all.py \
--model=<model-name> \
--benchmark-directory=./benchmarks/libaom-av1_highbd_dr_prediction_z3_avx2 \
[--ai-binary=<llm-access-binary>] \
[--work-dir=results-dir] \
[...] \where the <model-name> must be the name of one of the supported models.
A crash benchmark should contains:
- fuzz target source code (named as
fuzz_target.corfuzz_target.cc) - testcase to trigger crash (named as
testcase) - original crash output (named as
run.log) - project information (named as
project.yaml)
Each file cannot be empty. project.yaml should include project name, project folder name in docker, language(c or c++), sanitizer, commit, the built-in target_name and target_path of OSS-Fuzz, extra compiler flag (optional, for compiling fuzz target), index (optional, to distinguish benchmarks with the same API), header path (optional, for compiling fuzz target), static link input file path (optional, for compiling fuzz target). Here is an example. Note that the project under test needs to be integrated into OSS-Fuzz to build. Currently only libfuzzer is supported. Please make sure that the network can connect to the official source.
Arash supports Clang Static Analysis (CSA) to analyze the fuzz target code. Current CSA rules are stored in csa folder.
You can install a Git pre-push hook to auto-format/-lint your code:
./helper/add_pre-push_hookOr manually run the formater/linter by running:
.github/helper/presubmitWe use https://github.com/jazzband/pip-tools to manage our Python dependencies.
pip install pip-tools
pip-compile requirements.in > requirements.txt
pip install -r requirements.txt