Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions src/fuzz_introspector/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,31 @@ def load_data_files(self,

logger.info("[+] Accummulating profiles")
logger.info("Accummulating using multiprocessing")
manager = multiprocessing.Manager()
semaphore = multiprocessing.Semaphore(10)

return_dict = manager.dict()
result_dict: Dict[Any, Any] = dict()
if parallelise:
manager = multiprocessing.Manager()
semaphore = multiprocessing.Semaphore(10)

jobs = []
idx = 0
for profile in self.profiles:
p = multiprocessing.Process(
target=fuzzer_profile.FuzzerProfile.accummulate_profile,
args=(profile, self.base_folder, return_dict, f"uniq-{idx}",
semaphore))
jobs.append(p)
idx += 1
p.start()
for proc in jobs:
proc.join()
return_dict = manager.dict()

jobs = []
idx = 0
for profile in self.profiles:
p = multiprocessing.Process(
target=fuzzer_profile.FuzzerProfile.accummulate_profile,
args=(profile, self.base_folder, return_dict, f"uniq-{idx}",
semaphore))
jobs.append(p)
idx += 1
p.start()
for proc in jobs:
proc.join()
result_dict = return_dict.copy()
else:
for profile in self.profiles:
fuzzer_profile.FuzzerProfile.accummulate_profile(
profile, self.base_folder, result_dict, f"uniq-{idx}")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idx is unknown here, maybe should count up similar as above?


new_profiles = []
for idx in return_dict:
Expand Down
4 changes: 3 additions & 1 deletion src/fuzz_introspector/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def analyse_end_to_end(arg_language,
correlation_file = ''

try:
is_parallel = os.getenv('FUZZ_INTROSPECTOR_PARALLEL', "true").lower() == "true"
exit_code, return_values2 = run_analysis_on_dir(
target_folder=out_dir,
coverage_url=coverage_url,
Expand All @@ -123,7 +124,8 @@ def analyse_end_to_end(arg_language,
language=language,
out_dir=out_dir,
dump_files=dump_files,
harness_lists=harness_lists)
harness_lists=harness_lists,
parallelise=is_parallel)
for k, v in return_values2.items():
return_values[k] = v
except DataLoaderError:
Expand Down