From 33a7b536ed4cc8c918110ad7022f4dc560ef1ee4 Mon Sep 17 00:00:00 2001 From: Steffen Schulz Date: Wed, 29 Jun 2022 13:37:54 +0200 Subject: [PATCH] update default environment and expose as env.sh - WORKSPACE now points to top-level user-created folder, not kafl/ - KAFL_ROOT points to WORKSPACE/kafl, where all fuzzer components reside - KAFL_WORKDIR renamed to /dev/shm/kafl_* (similar to old default and not -tdfl) The resulting '.env' is now exposed as more obvious entry point 'env.sh' that also initializes the correct python venv for kAFL. The old hidden '.env' only made sense in combination with pipenv, which in turn has been deprecated by ansible/virtualenv setup. --- .gitignore | 2 ++ .../kafl/roles/fuzzer/tasks/post_tasks.yml | 2 +- .../intellabs/kafl/roles/fuzzer/templates/env.j2 | 15 ++++++++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 8b60920a..2a0bd058 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ # IDE .vscode/ +ctags # Python venvs +/env.sh venv/ .venv/ diff --git a/deploy/intellabs/kafl/roles/fuzzer/tasks/post_tasks.yml b/deploy/intellabs/kafl/roles/fuzzer/tasks/post_tasks.yml index 090dbc7b..1d0c03a4 100644 --- a/deploy/intellabs/kafl/roles/fuzzer/tasks/post_tasks.yml +++ b/deploy/intellabs/kafl/roles/fuzzer/tasks/post_tasks.yml @@ -24,4 +24,4 @@ - name: Create .env file template: src: env.j2 - dest: "{{ kafl_install_root }}/.env" \ No newline at end of file + dest: "{{ install_root }}/env.sh" diff --git a/deploy/intellabs/kafl/roles/fuzzer/templates/env.j2 b/deploy/intellabs/kafl/roles/fuzzer/templates/env.j2 index aa5ebdd0..86d44a17 100644 --- a/deploy/intellabs/kafl/roles/fuzzer/templates/env.j2 +++ b/deploy/intellabs/kafl/roles/fuzzer/templates/env.j2 @@ -1,8 +1,17 @@ -export WORKSPACE="{{ kafl_install_root }}" -export KAFL_ROOT="{{ fuzzer_root }}" +# source this file to activate the environment, +# or use "make env" to start a sub-shell + +# components managed by ansible +export KAFL_ROOT="{{ kafl_install_root }}" export QEMU_ROOT="{{ qemu_root }}" export LIBXDC_ROOT="{{ libxdc_root }}" export CAPSTONE_ROOT="{{ capstone_root }}" export RADAMSA_ROOT="{{ radamsa_root }}" + +# workspace defaults +export WORKSPACE="{{ install_root }}" export KAFL_CONFIG_FILE="{{ fuzzer_root }}/kafl.yaml" -export KAFL_WORKDIR="/dev/shm/{{ ansible_user_id }}_tdfl" +export KAFL_WORKDIR="/dev/shm/kafl_{{ ansible_user_id }}" + +# activate python venv +source $KAFL_ROOT/.venv/bin/activate