Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit 1121ebc

Browse files
authored
fix issue specifying target_options for libfuzzer targets (#1066)
1 parent 32d886a commit 1121ebc

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,10 @@ jobs:
357357
cp integration-test.py artifacts/
358358
359359
mkdir -p artifacts/linux-libfuzzer
360+
mkdir -p artifacts/linux-libfuzzer-with-options
360361
(cd libfuzzer ; make )
361362
cp -r libfuzzer/fuzz.exe libfuzzer/seeds artifacts/linux-libfuzzer
363+
cp -r libfuzzer/fuzz.exe libfuzzer/seeds artifacts/linux-libfuzzer-with-options
362364
363365
mkdir -p artifacts/linux-libfuzzer-regression
364366
(cd libfuzzer-regression ; make )

src/cli/onefuzz/templates/libfuzzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def _create_tasks(
152152
#
153153
# For now, locally extend the `target_options` for this task only, to ensure that
154154
# test case invocations work as expected.
155-
coverage_target_options = target_options or []
155+
coverage_target_options = target_options.copy() if target_options else []
156156
coverage_target_options.append("{input}")
157157

158158
# Opposite precedence to `effective_crash_report_timeout`.

src/integration-tests/integration-test.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class Integration(BaseModel):
6868
disable_check_debugger: Optional[bool] = Field(default=False)
6969
reboot_after_setup: Optional[bool] = Field(default=False)
7070
test_repro: Optional[bool] = Field(default=True)
71+
target_options: Optional[List[str]]
7172

7273

7374
TARGETS: Dict[str, Integration] = {
@@ -90,6 +91,19 @@ class Integration(BaseModel):
9091
},
9192
reboot_after_setup=True,
9293
),
94+
"linux-libfuzzer-with-options": Integration(
95+
template=TemplateType.libfuzzer,
96+
os=OS.linux,
97+
target_exe="fuzz.exe",
98+
inputs="seeds",
99+
wait_for_files={
100+
ContainerType.unique_reports: 1,
101+
ContainerType.coverage: 1,
102+
ContainerType.inputs: 2,
103+
},
104+
reboot_after_setup=True,
105+
target_options=["-runs=1000"],
106+
),
93107
"linux-libfuzzer-dlopen": Integration(
94108
template=TemplateType.libfuzzer,
95109
os=OS.linux,
@@ -264,6 +278,7 @@ def launch(
264278
duration=duration,
265279
vm_count=1,
266280
reboot_after_setup=config.reboot_after_setup or False,
281+
target_options=config.target_options,
267282
)
268283
elif config.template == TemplateType.libfuzzer_dotnet:
269284
if setup is None:
@@ -278,6 +293,7 @@ def launch(
278293
setup_dir=setup,
279294
duration=duration,
280295
vm_count=1,
296+
target_options=config.target_options,
281297
)
282298
elif config.template == TemplateType.libfuzzer_qemu_user:
283299
job = self.of.template.libfuzzer.qemu_user(
@@ -289,6 +305,7 @@ def launch(
289305
target_exe=target_exe,
290306
duration=duration,
291307
vm_count=1,
308+
target_options=config.target_options,
292309
)
293310
elif config.template == TemplateType.radamsa:
294311
job = self.of.template.radamsa.basic(
@@ -315,6 +332,7 @@ def launch(
315332
setup_dir=setup,
316333
duration=duration,
317334
vm_count=1,
335+
target_options=config.target_options,
318336
)
319337
else:
320338
raise NotImplementedError

0 commit comments

Comments
 (0)