diff options
Diffstat (limited to 'infra')
-rwxr-xr-x | infra/base-images/base-builder/compile | 2 | ||||
-rwxr-xr-x | infra/base-images/base-runner/bad_build_check | 56 | ||||
-rw-r--r--[-rwxr-xr-x] | infra/gcb/build_project.py | 0 | ||||
-rwxr-xr-x | infra/helper.py | 8 | ||||
-rwxr-xr-x | infra/travis/travis_build.py | 10 |
5 files changed, 59 insertions, 17 deletions
diff --git a/infra/base-images/base-builder/compile b/infra/base-images/base-builder/compile index b15d0edf..5e63f0dd 100755 --- a/infra/base-images/base-builder/compile +++ b/infra/base-images/base-builder/compile @@ -24,7 +24,7 @@ fi if [[ $ARCHITECTURE == "i386" ]]; then export CFLAGS="-m32 $CFLAGS" - export CXXFLAGS_EXTRA="-L/usr/i386/lib $CXXFLAGS_EXTRA" + cp -R /usr/i386/lib/* /usr/lib fi if [[ $FUZZING_ENGINE != "none" ]]; then # compile script might override environment, use . to call it. diff --git a/infra/base-images/base-runner/bad_build_check b/infra/base-images/base-runner/bad_build_check index 30aa1232..676035bd 100755 --- a/infra/base-images/base-runner/bad_build_check +++ b/infra/base-images/base-runner/bad_build_check @@ -44,6 +44,12 @@ UBSAN_CALLS_THRESHOLD_FOR_UBSAN_BUILD=170 # a big concern either way as the overhead for them would not be significant. UBSAN_CALLS_THRESHOLD_FOR_NON_UBSAN_BUILD=200 +# ASan builds on i386 generally have about 250 UBSan runtime calls. +if [[ $ARCHITECTURE == 'i386' ]] +then + UBSAN_CALLS_THRESHOLD_FOR_NON_UBSAN_BUILD=280 +fi + # Verify that the given fuzz target has proper coverage instrumentation. function check_instrumentation { @@ -201,18 +207,23 @@ function check_mixed_sanitizers { local FUZZER=$1 local result=0 local CALL_INSN= - case $(uname -m) in + if [[ $ARCHITECTURE == 'i386' ]] + then + CALL_INSN="call\s+[0-9a-f]+\s+<" + else + case $(uname -m) in x86_64) - CALL_INSN="callq\s+[0-9a-f]+\s+<" - ;; + CALL_INSN="callq\s+[0-9a-f]+\s+<" + ;; aarch64) - CALL_INSN="bl\s+[0-9a-f]+\s+<" - ;; + CALL_INSN="bl\s+[0-9a-f]+\s+<" + ;; *) - echo "Error: unsupported machine hardware $(uname -m)" - exit 1 - ;; - esac + echo "Error: unsupported machine hardware $(uname -m)" + exit 1 + ;; + esac + fi local ASAN_CALLS=$(objdump -dC $FUZZER | egrep "${CALL_INSN}__asan" -c) local MSAN_CALLS=$(objdump -dC $FUZZER | egrep "${CALL_INSN}__msan" -c) local UBSAN_CALLS=$(objdump -dC $FUZZER | egrep "${CALL_INSN}__ubsan" -c) @@ -258,6 +269,29 @@ function check_seed_corpus { return 0 } +function check_architecture { + local FUZZER=$1 + local FUZZER_NAME=$(basename $FUZZER) + FILE_OUTPUT=$(file $FUZZER) + if [[ $ARCHITECTURE == "x86_64" ]] + then + echo $FILE_OUTPUT | grep "x86-64" > /dev/null + elif [[ $ARCHITECTURE == "i386" ]] + then + echo $FILE_OUTPUT | grep "80386" > /dev/null + else + echo "UNSUPPORTED ARCHITECTURE" + return 1 + fi + result=$? + if [[ $result != 0 ]] + then + echo "BAD BUILD $FUZZER is not built for architecture: $ARCHITECTURE" + echo "file command output: $FILE_OUTPUT" + echo "check_mixed_sanitizers test will fail." + fi + return $result +} function main { local FUZZER=$1 @@ -268,6 +302,10 @@ function main { result=$? checks_failed=$(( $checks_failed + $result )) + check_architecture $FUZZER + result=$? + checks_failed=$(( $checks_failed + $result )) + check_mixed_sanitizers $FUZZER result=$? checks_failed=$(( $checks_failed + $result )) diff --git a/infra/gcb/build_project.py b/infra/gcb/build_project.py index f02ee06e..f02ee06e 100755..100644 --- a/infra/gcb/build_project.py +++ b/infra/gcb/build_project.py diff --git a/infra/helper.py b/infra/helper.py index dcf87e8e..b994d68f 100755 --- a/infra/helper.py +++ b/infra/helper.py @@ -425,7 +425,7 @@ def build_fuzzers(args): env = [ 'FUZZING_ENGINE=' + args.engine, 'SANITIZER=' + args.sanitizer, - 'ARCHITECTURE=' + args.architecture + 'ARCHITECTURE=' + args.architecture, ] if args.e: env += args.e @@ -491,7 +491,8 @@ def check_build(args): env = [ 'FUZZING_ENGINE=' + args.engine, - 'SANITIZER=' + args.sanitizer + 'SANITIZER=' + args.sanitizer, + 'ARCHITECTURE=' + args.architecture, ] if args.e: env += args.e @@ -794,7 +795,8 @@ def shell(args): env = [ 'FUZZING_ENGINE=' + args.engine, - 'SANITIZER=' + args.sanitizer + 'SANITIZER=' + args.sanitizer, + 'ARCHITECTURE=' + args.architecture, ] if args.e: diff --git a/infra/travis/travis_build.py b/infra/travis/travis_build.py index 9ebaa9a5..eb190ea6 100755 --- a/infra/travis/travis_build.py +++ b/infra/travis/travis_build.py @@ -62,11 +62,13 @@ def build_fuzzers(project, sanitizer, engine, architecture='x86_64'): ]) -def check_build(project, sanitizer, engine): +def check_build(project, sanitizer, engine, architecture='x86_64'): """Execute helper.py's check_build command on |project|, assuming it was most recently built with |sanitizer| and |engine|.""" - execute_helper_command( - ['check_build', project, '--engine', engine, '--sanitizer', sanitizer]) + execute_helper_command([ + 'check_build', project, '--engine', engine, '--sanitizer', sanitizer, + '--architecture', architecture + ]) def build_project(project): @@ -101,7 +103,7 @@ def build_project(project): if 'i386' in project_yaml.get('architectures', []): # i386 builds always use libFuzzer and ASAN. build_fuzzers(project, 'address', 'libfuzzer', 'i386') - check_build(project, 'address', 'libfuzzer') + check_build(project, 'address', 'libfuzzer', 'i386') def main(): |