Skip to content

Commit

Permalink
update default environment and expose as env.sh
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
il-steffen committed Jun 29, 2022
1 parent eaadcf4 commit 33a7b53
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# IDE
.vscode/
ctags

# Python venvs
/env.sh
venv/
.venv/

Expand Down
2 changes: 1 addition & 1 deletion deploy/intellabs/kafl/roles/fuzzer/tasks/post_tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
- name: Create .env file
template:
src: env.j2
dest: "{{ kafl_install_root }}/.env"
dest: "{{ install_root }}/env.sh"
15 changes: 12 additions & 3 deletions deploy/intellabs/kafl/roles/fuzzer/templates/env.j2
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 33a7b53

Please sign in to comment.