Skip to content

Commit 93c2710

Browse files
committed
docs: document backend-specific engine usage
Explain how to select LibAFL or libFuzzer and call out the places where their supported options still differ.
1 parent 9ac5b90 commit 93c2710

3 files changed

Lines changed: 60 additions & 15 deletions

File tree

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717

1818
Jazzer.js is a coverage-guided, in-process fuzzer for the
1919
[Node.js](https://nodejs.org) platform developed by
20-
[Code Intelligence](https://www.code-intelligence.com). It is based on
21-
[libFuzzer](https://llvm.org/docs/LibFuzzer.html) and brings many of its
20+
[Code Intelligence](https://www.code-intelligence.com). It supports
21+
[libFuzzer](https://llvm.org/docs/LibFuzzer.html) and
22+
[LibAFL](https://github.com/AFLplusplus/LibAFL) backends and brings
2223
instrumentation-powered mutation features to the JavaScript ecosystem.
2324

2425
## Quickstart
@@ -47,6 +48,9 @@ To use Jazzer.js in your own project follow these few simple steps:
4748
npx jazzer FuzzTarget
4849
```
4950

51+
CLI fuzzing uses the LibAFL backend by default. To run with libFuzzer
52+
instead, add `--engine=libfuzzer`.
53+
5054
4. Enjoy fuzzing!
5155

5256
## Usage

docs/fuzz-settings.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,13 +589,53 @@ JAZZER_FUZZ_ENTRY_POINT=buzz npx jazzer my-fuzz-file
589589
_Note:_ In Jest mode, this option cannot be set via environment variable.
590590
Instead use the native Jest flag `--testNamePattern` as described above.
591591

592+
### `engine` : [string]
593+
594+
Default: `"libafl"` in CLI mode, `"libfuzzer"` in Jest mode
595+
596+
Select the native fuzzing backend.
597+
598+
- `libfuzzer`: use the existing libFuzzer backend.
599+
- `afl` (alias for `libafl`): use the LibAFL backend.
600+
601+
**CLI:** Select the backend with `--engine`, for example:
602+
603+
```bash
604+
npx jazzer my-fuzz-file --engine=afl
605+
```
606+
607+
**Jest:** Set it in `.jazzerjsrc.json`:
608+
609+
```json
610+
{
611+
"engine": "afl"
612+
}
613+
```
614+
615+
LibAFL supports both `fuzzing` and `regression` mode.
616+
592617
### `fuzzerOptions` : [array\<string\>]
593618

594619
Default: []
595620

596-
Pass options to native fuzzing engine (Jazzer.js uses libFuzzer).
621+
Pass options to the selected native fuzzing engine.
622+
623+
For `engine=libfuzzer`, Jazzer.js supports the full libFuzzer-style argument
624+
list.
625+
626+
For `engine=afl`/`engine=libafl`, Jazzer.js currently supports these options:
627+
628+
- `-runs=<N>`
629+
- `-seed=<N>`
630+
- `-max_len=<N>`
631+
- `-max_total_time=<seconds>`
632+
- `-artifact_prefix=<path-prefix>`
633+
- `-dict=<path>`
634+
- non-flag entries interpreted as corpus directories
635+
636+
Unsupported engine-specific flags are rejected with an explicit error.
597637

598-
For a list of available options, see the
638+
For the `libfuzzer` backend, see the
599639
[libFuzzer documentation](https://llvm.org/docs/LibFuzzer.html#options). To get
600640
a quick overview of all available options, call Jazzer.js with the libFuzzer
601641
argument `-help`. Here is an example for the CLI mode:

packages/fuzzer/README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
# @jazzer.js/fuzzer
22

3-
This module provides a native Node.js addon which loads libfuzzer into Node.js.
4-
Users can install it with `npm install`, which tries to download a prebuilt
5-
shared object from GitHub but falls back to compilation on the user's machine if
6-
there is no suitable binary.
7-
8-
Loading the addon initializes libFuzzer and the sanitizer runtime. Users can
9-
then start the fuzzer with the exported `startFuzzing` or `startFuzzingAsync`
10-
functions; see [the test](fuzzer.test.ts) for an example. In sync mode
11-
(`--sync`), the fuzzer runs on the main thread and blocks the event loop. In the
12-
default async mode, libFuzzer runs on a separate native thread and communicates
13-
with the JS event loop via a thread-safe function.
3+
This module provides a native Node.js addon that hosts Jazzer.js fuzzing
4+
backends inside Node.js. Users can install it with `npm install`, which tries to
5+
download a prebuilt shared object from GitHub but falls back to compilation on
6+
the user's machine if there is no suitable binary.
7+
8+
Loading the addon initializes the sanitizer runtime and fuzzing hooks. Users can
9+
start the libFuzzer backend with `startFuzzing` or `startFuzzingAsync`, and the
10+
LibAFL backend with `startLibAfl` or `startLibAflAsync`; see
11+
[the tests](fuzzer.test.ts) for examples. In sync mode (`--sync`), the fuzzer
12+
runs on the main thread and blocks the event loop. In the default async mode,
13+
the native backend runs on a separate thread and communicates with the JS event
14+
loop via a thread-safe function.
1415

1516
## Development
1617

0 commit comments

Comments
 (0)