mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-27 17:41:40 +00:00
libghostty-vt parser fuzzing, generic fuzz harness, using AFL++ (#11089)
This adds a `test/fuzz-libghostty` which is a standalone `zig build` target for building an AFL++ instrumented executable for fuzzing the libghostty-vt parser. I also added a `pkg/afl++` (based on zig-afl-kit) so instrumenting objects and using AFL++ is a bit easier. Fuzzing `libghostty-vt`'s parser is as easy as `zig build run`, but see the README for a lot more details. I ran the fuzzer for ~14 hours total and only found one crash #11088. I'm pretty confident at this point our Parser layer isn't obviously crash-able, but need to instrument more places to fuzz. We don't use Zig's built-in fuzzing yet because as of 0.15 (our current stable), it isn't ready and AFL++ is an industry proven tool to do this.
This commit is contained in:
46
.github/workflows/test.yml
vendored
46
.github/workflows/test.yml
vendored
@@ -102,6 +102,7 @@ jobs:
|
||||
- test-gtk
|
||||
- test-sentry-linux
|
||||
- test-i18n
|
||||
- test-fuzz-libghostty
|
||||
- test-macos
|
||||
- pinact
|
||||
- prettier
|
||||
@@ -1010,6 +1011,51 @@ jobs:
|
||||
run: |
|
||||
nix develop -c zig build -Di18n=${{ matrix.i18n }}
|
||||
|
||||
test-fuzz-libghostty:
|
||||
name: Build test/fuzz-libghostty
|
||||
runs-on: namespace-profile-ghostty-sm
|
||||
needs: test
|
||||
env:
|
||||
ZIG_LOCAL_CACHE_DIR: /zig/local-cache
|
||||
ZIG_GLOBAL_CACHE_DIR: /zig/global-cache
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Setup Cache
|
||||
uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9 # v1.4.2
|
||||
with:
|
||||
path: |
|
||||
/nix
|
||||
/zig
|
||||
|
||||
# Install Nix and use that to run our tests so our environment matches exactly.
|
||||
- uses: cachix/install-nix-action@2126ae7fc54c9df00dd18f7f18754393182c73cd # v31.9.1
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
- uses: cachix/cachix-action@3ba601ff5bbb07c7220846facfa2cd81eeee15a1 # v16
|
||||
with:
|
||||
name: ghostty
|
||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||
|
||||
- name: Install AFL++ and LLVM
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y afl++ llvm
|
||||
|
||||
- name: Verify AFL++ and LLVM are available
|
||||
run: |
|
||||
afl-cc --version
|
||||
if command -v llvm-config >/dev/null 2>&1; then
|
||||
llvm-config --version
|
||||
else
|
||||
llvm-config-18 --version
|
||||
fi
|
||||
|
||||
- name: Build fuzzer harness
|
||||
run: |
|
||||
nix develop -c sh -c 'cd test/fuzz-libghostty && zig build'
|
||||
|
||||
zig-fmt:
|
||||
if: github.repository == 'ghostty-org/ghostty' && needs.skip.outputs.skip != 'true' && needs.skip.outputs.zig == 'true'
|
||||
needs: skip
|
||||
|
||||
Reference in New Issue
Block a user