Skip to content

Commit

Permalink
driver: Do not prepare for a subprocess for -fork=0
Browse files Browse the repository at this point in the history
`-fork=0` and similar flags disable the respective libFuzzer modes and
thus should not lead Jazzer to prepare for being run in a subprocess,
e.g., not set `-seed`.
  • Loading branch information
fmeum committed Jun 6, 2023
1 parent 0615190 commit c29e73c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/com/code_intelligence/jazzer/Jazzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ private static void start(List<String> args) throws IOException, InterruptedExce
// In LibFuzzer's fork mode, the subprocesses created continuously by the main libFuzzer
// process do not create further subprocesses. Creating a wrapper script for each subprocess
// is an unnecessary overhead.
final boolean spawnsSubprocesses = args.stream().anyMatch(
arg -> arg.startsWith("-fork=") || arg.startsWith("-jobs=") || arg.startsWith("-merge="));
final boolean spawnsSubprocesses = args.stream().anyMatch(arg
-> (arg.startsWith("-fork=") && !arg.equals("-fork=0"))
|| (arg.startsWith("-jobs=") && !arg.equals("-jobs=0"))
|| (arg.startsWith("-merge=") && !arg.equals("-merge=0")));
// argv0 is printed by libFuzzer during reproduction, so have it contain "jazzer".
String arg0 = spawnsSubprocesses ? prepareArgv0(new HashMap<>()) : "jazzer";
args = Stream.concat(Stream.of(arg0), args.stream()).collect(toList());
Expand Down

0 comments on commit c29e73c

Please sign in to comment.