@@ -69,6 +69,10 @@ def _create_tasks(
6969 expect_crash_on_failure : bool = False ,
7070 minimized_stack_depth : Optional [int ] = None ,
7171 coverage_filter : Optional [str ] = None ,
72+ analyzer_exe : Optional [str ] = None ,
73+ analyzer_options : Optional [List [str ]] = None ,
74+ analyzer_env : Optional [Dict [str , str ]] = None ,
75+ tools : Optional [Container ] = None ,
7276 ) -> None :
7377 target_options = target_options or []
7478
@@ -247,6 +251,43 @@ def _create_tasks(
247251 minimized_stack_depth = minimized_stack_depth ,
248252 )
249253
254+ if analyzer_exe is not None :
255+ self .logger .info ("creating custom analysis" )
256+
257+ if tools is None :
258+ self .logger .error (
259+ "tools container cannot be empty when specifying a custom analyzer"
260+ )
261+ return None
262+
263+ analysis_containers = [
264+ (ContainerType .setup , containers [ContainerType .setup ]),
265+ (ContainerType .tools , tools ),
266+ (ContainerType .analysis , containers [ContainerType .analysis ]),
267+ (ContainerType .crashes , containers [ContainerType .crashes ]),
268+ ]
269+
270+ self .onefuzz .tasks .create (
271+ job .job_id ,
272+ TaskType .generic_analysis ,
273+ target_exe ,
274+ analysis_containers ,
275+ duration = duration ,
276+ pool_name = pool_name ,
277+ vm_count = vm_count ,
278+ reboot_after_setup = reboot_after_setup ,
279+ target_options = target_options ,
280+ target_env = target_env ,
281+ analyzer_exe = analyzer_exe ,
282+ analyzer_options = analyzer_options ,
283+ analyzer_env = analyzer_env ,
284+ tags = tags ,
285+ prereq_tasks = [fuzzer_task .task_id ],
286+ colocate = colocate_all_tasks or colocate_secondary_tasks ,
287+ debug = debug ,
288+ target_timeout = target_timeout ,
289+ )
290+
250291 def basic (
251292 self ,
252293 project : str ,
@@ -283,6 +324,10 @@ def basic(
283324 expect_crash_on_failure : bool = False ,
284325 minimized_stack_depth : Optional [int ] = None ,
285326 coverage_filter : Optional [File ] = None ,
327+ analyzer_exe : Optional [str ] = "powershell.exe" ,
328+ analyzer_options : Optional [List [str ]] = None ,
329+ analyzer_env : Optional [Dict [str , str ]] = None ,
330+ tools : Optional [Container ] = None ,
286331 ) -> Optional [Job ]:
287332 """
288333 Basic libfuzzer job
@@ -340,6 +385,9 @@ def basic(
340385 self .onefuzz .containers .get (readonly_inputs )
341386 helper .containers [ContainerType .readonly_inputs ] = readonly_inputs
342387
388+ if analyzer_exe is not None :
389+ helper .define_containers (ContainerType .analysis )
390+
343391 helper .create_containers ()
344392 helper .setup_notifications (notification_config )
345393
@@ -380,6 +428,10 @@ def basic(
380428 expect_crash_on_failure = expect_crash_on_failure ,
381429 minimized_stack_depth = minimized_stack_depth ,
382430 coverage_filter = coverage_filter_blob_name ,
431+ analyzer_exe = analyzer_exe ,
432+ analyzer_options = analyzer_options ,
433+ analyzer_env = analyzer_env ,
434+ tools = tools ,
383435 )
384436
385437 self .logger .info ("done creating tasks" )
0 commit comments