cros_fuzz: Fix issues with coverage
Fix section lookup in elf binary by using byte string.
Disable odr violation to match clusterfuzz.
BUG=None
TEST=cros_fuzz coverage
Change-Id: I5ee62da3701aa2d557cd5567be61d8c801602ffe
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3234784
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Brett Brotherton <bbrotherton@google.com>
Auto-Submit: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Brett Brotherton <bbrotherton@google.com>
Reviewed-by: Chris McDonald <cjmcdonald@chromium.org>
Reviewed-by: Allen Webb <allenwebb@google.com>
diff --git a/scripts/cros_fuzz.py b/scripts/cros_fuzz.py
index d3a5973..9198234 100644
--- a/scripts/cros_fuzz.py
+++ b/scripts/cros_fuzz.py
@@ -406,7 +406,9 @@
extra_options = {}
# log_path must be set because Chrome OS's patched compiler changes it.
- options_dict = {'log_path': 'stderr'}
+ # disable odr violation since many fuzzers hit it and it is also disabled on
+ # clusterfuzz.
+ options_dict = {'log_path': 'stderr', 'detect_odr_violation': '0'}
options_dict.update(extra_options)
sanitizer_options = ':'.join('%s=%s' % x for x in options_dict.items())
sanitizers = ('ASAN', 'MSAN', 'UBSAN')
@@ -553,7 +555,7 @@
"""
with open(binary_path, 'rb') as file_handle:
elf_file = ELFFile(file_handle)
- return elf_file.get_section_by_name('__llvm_covmap') is not None
+ return elf_file.get_section_by_name(b'__llvm_covmap') is not None
def RunFuzzerAndGenerateCoverageReport(fuzzer, corpus, fuzz_args):