Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve logging for afl-showmap execution. #2210

Merged
merged 7 commits into from
Jan 26, 2021
Merged
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
23 changes: 15 additions & 8 deletions src/python/bot/fuzzers/afl/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,14 +1055,18 @@ def get_file_features(self, input_file_path, showmap_args):
if not os.path.exists(self.showmap_output_path):
if not self.showmap_no_output_logged:
self.showmap_no_output_logged = True
logs.log_error(
('afl-showmap didn\'t output any coverage. Command: {0}\n'
'Return code: {1}\n'
'Time executed: {2}\n'
'Output: {3}').format(
showmap_result.command, showmap_result.return_code,
showmap_result.time_executed, showmap_result.output))

logs.log_error(('afl-showmap didn\'t output any coverage for '
'file {file_path} ({file_size} bytes).\n'
'Command: {command}\n'
'Return code: {return_code}\n'
'Time executed: {time_executed}\n'
'Output: {output}').format(
file_path=input_file_path,
file_size=os.path.getsize(input_file_path),
command=showmap_result.command,
return_code=showmap_result.return_code,
time_executed=showmap_result.time_executed,
output=showmap_result.output))
return None, True

showmap_output = engine_common.read_data_from_file(self.showmap_output_path)
Expand All @@ -1071,6 +1075,9 @@ def get_file_features(self, input_file_path, showmap_args):
for match in re.finditer(self.SHOWMAP_REGEX, showmap_output):
d = match.groupdict()
features.add((int(d['guard']), int(d['hit_count'])))
logs.log('afl-showmap succeedded for '
'file {file_path}: {features} features'.format(
file_path=input_file_path, features=len(features)))
return frozenset(features), False

def merge_corpus(self):
Expand Down