To be able to test system calls, syzkaller needs descriptions of the system calls for each target OS. The descriptions are stored in .txt files inside the sys folder of syzkaller. For FreeBSD the folder is <syzkaller>/sys/freebsd/.
Modifications of these files require three steps in order to integrate it into syzkaller.
Step 1: Generate .const files from .txt files.
This requires FreeBSD source files on the host. I copied them to ~/freebsd/usr/src.
make extract TARGETOS=freebsd SOURCEDIR=~/freebsd/usr/src
Step 2: Generate Go code for syzkaller based on the .txt and .const files
This requires clang-format. If not already installed
sudo apt install clang-format
After that, run
make generate
Step 3: Build syzkaller on host and syz-executor on FreeBSD VM
See build_syzkaller
Since syzkaller uses a github repository, contributions are possible by a pull request.
cd ~/gopath/src/github.com mv syzkaller syzkaller-old git clone https://github.com/msvoelker/syzkaller cd syzkaller
git remote add google https://github.com/google/syzkaller.git
git checkout -b freebsd-sctp
make presubmit
git checkout master git fetch google git rebase google/master git checkout freebsd-sctp git rebase master
git push --set-upstream origin freebsd-sctp