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, and identifying when regressions were introduced.
Install the required pip packages using
pip 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 clean Mercurial 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 or Firefox, install the usual prerequisites for building Firefox or building SpiderMonkey. There are additional requirements for building with Address Sanitizer.
Windows (only 64-bit supported)
- Install MozillaBuild (Using compile_shell for SpiderMonkey requires at least version 3.2).
- Install Git to clone these funfuzz repositories.
- Install Debugging 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.
start-shell.batto get a MSYS shell. You can use Git by calling its absolute path, e.g.
- 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:
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:
sudo apt-get install lib32z1 gcc-multilib g++-multilib
- Fedora: (Fedora is known to work, however the exact library names are unknown for now.)
** Note that parts of the code which contain
if isLinux and float(platform.linux_distribution()) > 15.04might fail on Fedora, as they assume Ubuntu's versioning scheme. Patches welcome.
- Install gdb:
sudo apt-get install gdb
- Fedora: Please ensure that all development packages are installed (see
rpm -qa "*devel"), and run
yum install gdb
- Install clang for clang/ASan builds:
sudo apt-get install clang
To run only 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 test a patch (assuming patch is in
~/patch.diff) against a specific branch (assuming Mercurial 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 --enable-more-deterministic -R ~/trees/mozilla-inbound -P ~/patch.diff" --target-time 28800 | tee ~/log-loop_botPy.txt
In js mode, loop_bot makes use of:
- compare_jit (if testing deterministic builds)
- randorderfuzz (included in funfuzz, if tests are present in the mozilla repository)
- autobisectjs (if the mozilla repository is present).
You will also need to need a
~/.fuzzmanagerconf file, similar to:
[Main] serverhost = <your hostname> serverport = <your port> serverproto = https serverauthtoken = <if any> sigdir = /Users/<your username>/sigcache/ tool = jsfunfuzz
Replace anything between
> with your desired parameters.
Q: What platforms does funfuzz run on?
A: compile_shell has been tested on:
- Windows 10 and 7, with MozillaBuild 3.2 and using Python 3 only.
- Mac OS X 10.13
- Ubuntu 16.04 LTS and later
- Note: This also seems to work on Ubuntu 14.04 LTS (via Travis)
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 to expect issues along the way:
- Windows 8 / Windows 8.1
- Windows Server 2012 R2
- Mac OS X 10.11 through 10.12
- Ubuntu Linux 15.10 and prior (see note above about 14.04 LTS)
- Ubuntu (and variants) on ARM ODROID boards
Support for the following operating systems have been removed:
- Windows Vista, Windows XP and earlier
- Mac OS X 10.10 and earlier
- Ubuntu Linux 13.10 and earlier
Q: What version of Python does funfuzz require?
A: Python 2.7 or 3.5+. Version 0.5.x will be the last version to support 2.7 on POSIX platforms, Windows already requires Python 3 (found in MozillaBuild).