Skip to content

Commit

Permalink
Print more info and update README
Browse files Browse the repository at this point in the history
  • Loading branch information
yuntongzhang committed Dec 21, 2023
1 parent 9a95458 commit 0d937de
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 5 additions & 3 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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()

0 comments on commit 0d937de

Please sign in to comment.