def build(): """Build an AFL version and SymCC version of the benchmark""" print("Step 1: Building with AFL") build_directory = os.environ['OUT'] # First build with AFL. src = os.getenv('SRC') work = os.getenv('WORK') with utils.restore_directory(src), utils.restore_directory(work): # Restore SRC to its initial state so we can build again without any # trouble. For some OSS-Fuzz projects, build_benchmark cannot be run # twice in the same directory without this. afl_fuzzer.build() print("Step 2: Completed AFL build") # Copy over AFL artifacts needed by SymCC. shutil.copy("/afl/afl-fuzz", build_directory) shutil.copy("/afl/afl-showmap", build_directory) # Build the SymCC-instrumented target. print("Step 3: Building the benchmark with SymCC") symcc_build_dir = get_symcc_build_dir(os.environ['OUT']) os.mkdir(symcc_build_dir) # Set flags to ensure compilation with SymCC. new_env = os.environ.copy() new_env['CC'] = "/symcc/build/symcc" new_env['CXX'] = "/symcc/build/sym++" new_env['CXXFLAGS'] = new_env['CXXFLAGS'].replace("-stlib=libc++", "") new_env['FUZZER_LIB'] = '/libfuzzer-harness.o' new_env['OUT'] = symcc_build_dir new_env['CXXFLAGS'] += " -fno-sanitize=all " new_env['CFLAGS'] += " -fno-sanitize=all " # Setting this environment variable instructs SymCC to use the # libcxx library compiled with SymCC instrumentation. new_env['SYMCC_LIBCXX_PATH'] = "/libcxx_native_build" # Instructs SymCC to consider no symbolic inputs at runtime. This is needed # if, for example, some tests are run during compilation of the benchmark. new_env['SYMCC_NO_SYMBOLIC_INPUT'] = "1" # Build benchmark. utils.build_benchmark(env=new_env) # Copy over symcc artifacts and symbolic libc++. shutil.copy( "/symcc/build//SymRuntime-prefix/src/SymRuntime-build/libSymRuntime.so", symcc_build_dir) shutil.copy("/usr/lib/libz3.so", os.path.join(symcc_build_dir, "libz3.so")) shutil.copy("/libcxx_native_build/lib/libc++.so.1", symcc_build_dir) shutil.copy("/libcxx_native_build/lib/libc++abi.so.1", symcc_build_dir) shutil.copy("/rust/bin/symcc_fuzzing_helper", symcc_build_dir)
def build(): """Build benchmark.""" afl_fuzzer.build() # Copy Peach binaries to OUT shutil.copytree('/afl/peach-3.0.202-source/output/linux_x86_64_debug/bin', os.environ['OUT'] + '/peach-3.0.202') # Copy supported input models for file in glob.glob('/afl/input_models/*.xml'): print(file) shutil.copy(file, os.environ['OUT'])
def build(): """Build format-specific fuzzer.""" input_model = get_format() if input_model: print('Building {fmt}-fuzzer'.format(fmt=input_model)) subprocess.check_call( ['/bin/bash', '-ex', '/FormatFuzzer/build.sh', input_model], cwd='/FormatFuzzer') # Build benchmark. afl_fuzzer.build() # Copy Format-specific fuzzer to OUT. if input_model: print('[post_build] Copying {fmt}-fuzzer to $OUT directory'.format( fmt=input_model)) shutil.copy('/FormatFuzzer/{fmt}-fuzzer'.format(fmt=input_model), os.environ['OUT']) shutil.copy('/afl/parser.sh', os.environ['OUT'])
def build(): """Build fuzzer.""" afl_fuzzer.build()
def build(): """Build fuzzer.""" afl_fuzzer.build() print('[post_build] Copying libradamsa.so to $OUT directory') shutil.copy('/afl/libradamsa.so', os.environ['OUT'])
def build(): """Build benchmark.""" afl_fuzzer.build()
def build(): # pylint: disable=too-many-branches,too-many-statements """Build benchmark.""" afl_fuzzer.build()