- Notifications
You must be signed in to change notification settings - Fork112
A collection of fuzzers in a harness for testing the SpiderMonkey JavaScript engine.
License
MozillaSecurity/funfuzz
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This repository contains several JavaScript-based fuzzers.jsfunfuzz tests JavaScript engines and can run in a JavaScript shell, compare_jit compares output from SpiderMonkey using different flags, while randorderfuzz throws in random tests from the mozilla-central directory into generated jsfunfuzz output.
Most of the code other than testcase generation is written in Python: restarting the program when it exits or crashes, noticing evidence of new bugs from the program's output,reducing testcases, andidentifying when regressions were introduced.
Install the required pip packages usingpip install -r requirements.txt (assuming you are in the funfuzz repository).
Some parts of the fuzzer will only activate if the Python scripts can find your mozilla-central tree:
mkdir -p ~/trees/hg clone https://hg.mozilla.org/mozilla-central/ ~/trees/mozilla-central/Some parts of the harness assume a cleanMercurial clone of the mozilla trees. There is insufficient testing with Git for now - please file an issue if you hit problems with Git repositories of mozilla trees.
If you want to use these scripts to compile SpiderMonkey, install the usual prerequisites forbuilding SpiderMonkey. There areadditional requirements for building with Address Sanitizer.
- InstallMozillaBuild (Using compile_shell for SpiderMonkey requires at least version 3.2).
- InstallGit to clone these funfuzz repositories.
- InstallDebugging Tools for Windows to get cdb.exe and thus stacks from crashes.
- Make sure you install at least Microsoft Visual Studio 2017 (Community Edition is recommended) as per the build instructions above in the Setup section.
- Run
start-shell.batto get a MSYS shell. You can use Git by calling its absolute path, e.g./c/Program\ Files/Git/bin/git.exe.- Run the batch file with administrator privileges to get gflags analysis working correctly.
- If you encounter problems accessing the compiler, try re-running this command:
xcode-select --install
especially after updating major/minor OS versions. This sometimes manifests on Mac OS X Combo updates.
- Install LLVM via Homebrew, to get llvm-symbolizer needed for symbolizing ASan crash stacks.
brew install llvm- To ensure your core dumps don't get mixed up when multiple instances crash at the same time, run:
echo -n 1 | sudo tee /proc/sys/kernel/core_uses_pid- Install 32-bit libraries to compile 32-bit binaries:
- Debian/Ubuntu:
sudo apt-get install lib32z1 gcc-multilib g++-multilib - Fedora: (Fedora is known to work, however the exact library names are unknown for now.)
- Install gdb:
- Debian/Ubuntu:
sudo apt-get install gdb - Fedora: Please ensure that all development packages are installed (see
rpm -qa "*devel"), and runyum install gdb
- Install clang for clang/ASan builds:
- Debian/Ubuntu:
sudo apt-get install clang - Clang is used for 64-bit builds, while GCC is used for some older 32-bit builds
To runonly the js fuzzers which compiles shells with random configurations every 8 hours and tests them:
<python executable> -u funfuzz.loop_bot -b "--random" --target-time 28800 | tee ~/log-loop_botPy.txt
To testa patch (assuming patch is in~/patch.diff) against a specific branch (assumingMercurial mozilla-inbound is in~/trees/mozilla-inbound), using a debug 64-bit deterministic shell configuration, every 8 hours:
<python executable> -u funfuzz.loop_bot -b "--enable-debug -R ~/trees/mozilla-inbound -P ~/patch.diff" --target-time 28800 | tee ~/log-loop_botPy.txt
In js mode, loop_bot makes use of:
- compile_shell
- jsfunfuzz
- compare_jit (if testing deterministic builds)
- randorderfuzz (included in funfuzz, if tests are present in the mozilla repository)
- funbind (Linux-only, included in funfuzz, ifbinaryen can be downloaded)
- autobisectjs (if the mozilla repository is present).
The parameters in-b get passed intocompile_shell andautobisectjs.
You will also need to need a~/.fuzzmanagerconf file, similar to:
[Main]serverhost = <your hostname>serverport = <your port>serverproto = httpsserverauthtoken = <if any>sigdir = /Users/<your username>/sigcache/tool = jsfunfuzzReplace anything between< and> with your desired parameters.
Q: What platforms does funfuzz run on?
A: compile_shell has been tested on:
- Windows 10 withMozillaBuild 3.2
- macOS 10.13 and 10.14
- Ubuntu 18.04 LTS (only LTS versions supported going forward)
Fedora Linux and openSUSE Leap (42.3 and later) have not been tested extensively and there may be a few bugs along the way.
The following operating systems are less common and while they may still work, be prepared toexpect issues along the way:
- Windows 7, 8 / Windows 8.1
- Windows Server 2012 R2
- Ubuntu Linux 16.04 LTS (install Python 3.6 via a PPA)
- Ubuntu Linux 15.10 and prior
Support for the following operating systemshave been removed:
- Windows Vista, Windows XP and earlier
- Mac OS X 10.12 and earlier
- Ubuntu Linux 13.10 and earlier
- Ubuntu (and variants) onARM ODROID boards
Q: What version of Python does funfuzz require?
A: Python 3.6+
About
A collection of fuzzers in a harness for testing the SpiderMonkey JavaScript engine.
Topics
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors15
Uh oh!
There was an error while loading.Please reload this page.