Merge #20971: test: Work around libFuzzer deadlock

fa39c8a3e8f1090103468780d122a4cf4191bc13 test: Work around libFuzzer deadlock (MarcoFalke)

Pull request description:

  Only required part is `symbolize=0`, but the other changes shouldn't hurt

ACKs for top commit:
  practicalswift:
    cr ACK fa39c8a3e8f1090103468780d122a4cf4191bc13: patch looks correct

Tree-SHA512: 9cddf1de46ad12aea9b8be2c1acb86ba0e07ffdb52f8155d943edf970955551c7cb049a3a6c027846b45dab0dc0966dec42999476ebde50aa761a08dbb751eae
This commit is contained in:
MarcoFalke 2021-01-26 09:56:15 +01:00 committed by Vijay Das Manikpuri
parent 8db2aabee0
commit 720eb7e352
No known key found for this signature in database
GPG Key ID: DB1D81B01DB7C46E

View File

@ -13,6 +13,14 @@ import os
import subprocess
import sys
def get_fuzz_env(*, target):
return {
'FUZZ': target,
'ASAN_OPTIONS': # symbolizer disabled due to https://github.com/google/sanitizers/issues/1364#issuecomment-761072085
'symbolize=0:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1',
}
def main():
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
@ -128,9 +136,7 @@ def main():
os.path.join(config["environment"]["BUILDDIR"], 'src', 'test', 'fuzz', 'fuzz'),
'-help=1',
],
env={
'FUZZ': test_list_selection[0]
},
env=get_fuzz_env(target=test_list_selection[0]),
timeout=20,
check=True,
stderr=subprocess.PIPE,
@ -185,9 +191,7 @@ def generate_corpus_seeds(*, fuzz_pool, build_dir, seed_dir, targets):
' '.join(command),
subprocess.run(
command,
env={
'FUZZ': t
},
env=get_fuzz_env(target=t),
check=True,
stderr=subprocess.PIPE,
universal_newlines=True,
@ -228,9 +232,7 @@ def merge_inputs(*, fuzz_pool, corpus, test_list, build_dir, merge_dir):
output = 'Run {} with args {}\n'.format(t, " ".join(args))
output += subprocess.run(
args,
env={
'FUZZ': t
},
env=get_fuzz_env(target=t),
check=True,
stderr=subprocess.PIPE,
universal_newlines=True,
@ -258,7 +260,12 @@ def run_once(*, fuzz_pool, corpus, test_list, build_dir, use_valgrind):
def job(t, args):
output = 'Run {} with args {}'.format(t, args)
result = subprocess.run(args, env={'FUZZ': t}, stderr=subprocess.PIPE, universal_newlines=True)
result = subprocess.run(
args,
env=get_fuzz_env(target=t),
stderr=subprocess.PIPE,
universal_newlines=True,
)
output += result.stderr
return output, result