From 0d937de94ae8a37791a16a3511d5524b6677c8ef Mon Sep 17 00:00:00 2001 From: Zhang Yuntong Date: Thu, 21 Dec 2023 13:38:12 +0800 Subject: [PATCH] Print more info and update README --- README.md | 35 +++++++++++++++++++++++++++++++++++ src/main.py | 8 +++++--- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index af3e251..b47e72b 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,41 @@ ISSTA22 period and steps for using that version, please refer to [ISSTA22.md](do > TODO: Add getting started instruction for the new tool version. +Firstly, certain OS configurations are required to be set for VulnFix and its dependencies (e.g. AFL). +To set these, run: + +```bash +echo core | sudo tee /proc/sys/kernel/core_pattern +cd /sys/devices/system/cpu +echo performance | sudo tee cpu*/cpufreq/scaling_governor + +echo 0 | sudo tee /proc/sys/kernel/randomize_va_space +``` + +The VulnFix tool and its dependencies are available in docker container. (Please refer to +[doc/INSTALL.md](doc/INSTALL.md) for instructions on building it from source.) + +To start: + +```bash +docker pull yuntongzhang/vulnfix:latest-manual +docker run -it --memory=30g --name vulnfix yuntongzhang/vulnfix:latest-manual +``` + +Once inside the container, invoke it on one example (e.g. CVE-2012-5134) with: + +```bash +# clone and build the target project +cd /home/yuntong/vulnfix/data/libxml2/cve_2012_5134 +./setup.sh +# run vulnfix to repair +cd /home/yuntong/vulnfix +vulnfix data/libxml2/cve_2012_5134/config +``` + +After VulnFix finishes, the results (generated invariants and patches) can be found in +`/home/yuntong/vulnfix/data/libxml2/cve_2012_5134/runtime/result/`. + ## Documentation More details can be found in the documentation in the `doc` folder. [MANUAL.md](doc/MANUAL.md) diff --git a/src/main.py b/src/main.py index 6c369b0..dddba1d 100644 --- a/src/main.py +++ b/src/main.py @@ -261,13 +261,13 @@ def save_invariant_result(patch_invs): result_file = pjoin(values.dir_result, "invariants.txt") with open(result_file, "w") as f: if not patch_invs: - f.write("FAIL: no patch invariants can be generated\n") + f.write("FAIL: no patch invariants can be generated.\n") else: - f.write("SUCCESS: Some patch invariants are generated. (Their correctness is not checked yet)\n") + f.write("SUCCESS: Some patch invariants are generated. (Their correctness is not checked yet.)\n") f.write("\nPatch Invariants:\n") f.write(str(len(patch_invs)) + "\n") f.write(f'{[i for i in patch_invs]}') - + f.write('\n') def save_one_patch(old_patch_file: str, patch_name: str): """ @@ -492,6 +492,8 @@ def main(): else: logger.info(f'Generated {num_patches} patches.') + logger.info(f"VulnFix finished. Please find results at {values.dir_result}.") + if __name__ == "__main__": main()