Skip to content
This repository has been archived by the owner on Oct 22, 2023. It is now read-only.

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nhynes committed Oct 7, 2019
1 parent 500caa4 commit 6146a3b
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .buildkite/rust/build_runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export KM_ENCLAVE_PATH="$src_dir/target/x86_64-fortanix-unknown-sgx/debug/ekiden
case $variant in
elf)
# Build non-SGX runtime.
cargo build --locked -p runtime-ethereum
cargo build --locked -p runtime-ethereum -p fuzz
;;
sgxs)
# Build SGX runtime.
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ cobertura.xml

fuzz/Cargo.lock
fuzz/artifacts
fuzz/hfuzz_*
hfuzz_*
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ heapsize = { git = "https://github.com/oasislabs/heapsize", branch = "sgx-target
members = [
"api",
"common",
"fuzz",
"gateway",
"genesis",
]
exclude = ["tests", "fuzz"]
exclude = ["tests"]
2 changes: 1 addition & 1 deletion fuzz/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To begin fuzzing,
1. install the hfuzz [dependencies](https://github.com/rust-fuzz/honggfuzz-rs#dependencies)
2. `cargo install honggfuzz`
3. ensure that runtime is buildable (i.e. build or otherwise obtain Ekiden enclaves)
4. `./run.sh <target name>`
4. `python3 fuzz.py <target name>`

At the current time, both targets have been fuzzed for over 1m iterations with no crashes found.
While encouraging, don't let this stop you from trying!
29 changes: 29 additions & 0 deletions fuzz/fuzz.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env python3

import argparse
import subprocess
import os
import os.path as osp

KM_ENV = 'KM_ENCLAVE_PATH'
REPO_ROOT = osp.abspath(osp.join(osp.dirname(__file__), '..'))


def main():
parser = argparse.ArgumentParser()
parser.add_argument('target', help='The name of the fuzz target to run')
args = parser.parse_args()
run(f'cargo hfuzz run {args.target}')


def run(cmd):
env = dict(os.environ)
if KM_ENV not in env:
env[KM_ENV] = osp.join(REPO_ROOT, '.ekiden', 'target',
'x86_64-fortanix-unknown-sgx', 'debug',
'ekiden-keymanager-runtime.sgxs')
subprocess.run(cmd, env=env, cwd=REPO_ROOT, shell=True, check=True)


if __name__ == '__main__':
main()
8 changes: 0 additions & 8 deletions fuzz/run.sh

This file was deleted.

0 comments on commit 6146a3b

Please sign in to comment.