diff options
author | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2015-02-17 19:32:38 +0100 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2015-03-04 01:52:21 +0000 |
commit | efd53ad5c9d9ab7a04731226a0d1742961f45057 (patch) | |
tree | f600d510cb5be5e4c3967ffd672422611c72b2a5 /tools | |
parent | 763b6d325194a949a51bed7636caeaa7112b5ba3 (diff) | |
download | wireshark-efd53ad5c9d9ab7a04731226a0d1742961f45057.tar.gz |
Fuzz test : Add -a(SAN) option to disable ulimit when fuzzing
from https://code.google.com/p/address-sanitizer/wiki/AddressSanitizer#ulimit_-v
The ulimit -v command makes little sense with ASan-ified binaries because ASan consumes 20 terabytes of virtual memory (plus a bit).
Change-Id: I8c8c77dd51d5440fb2f9bd95f90873e59a64d409
Reviewed-on: https://code.wireshark.org/review/7204
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/fuzz-test.sh | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/fuzz-test.sh b/tools/fuzz-test.sh index b2d2c9e9a1..f31ec987d9 100755 --- a/tools/fuzz-test.sh +++ b/tools/fuzz-test.sh @@ -45,14 +45,18 @@ CONFIG_PROFILE= # Run under valgrind ? VALGRIND=0 +# Run under AddressSanitizer ? +ASAN=0 + # The maximum permitted amount of memory leaked. Eventually this should be # worked down to zero, but right now that would fail on every single capture. # Only has effect when running under valgrind. MAX_LEAK=`expr 1024 \* 100` # To do: add options for file names and limits -while getopts ":2b:C:d:e:gp:P:" OPTCHAR ; do +while getopts "2b:C:d:e:agp:P:" OPTCHAR ; do case $OPTCHAR in + a) ASAN=1 ;; 2) TWO_PASS="-2 " ;; b) BIN_DIR=$OPTARG ;; C) CONFIG_PROFILE="-C $OPTARG " ;; @@ -109,7 +113,7 @@ if [ $FOUND -eq 0 ] ; then cat <<FIN Error: No valid capture files found. -Usage: `basename $0` [-2] [-b bin_dir] [-C config_profile] [-d work_dir] [-e error probability] [-g] [-p passes] capture file 1 [capture file 2]... +Usage: `basename $0` [-2] [-b bin_dir] [-C config_profile] [-d work_dir] [-e error probability] [-g] [-a] [-p passes] capture file 1 [capture file 2]... FIN exit 1 fi @@ -188,9 +192,15 @@ while [ \( $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 \) -a $DONE -ne 1 ] ; do # longer then MAX_CPU_TIME seconds. (ulimit may not be supported # well on some platforms, particularly cygwin.) ( - ulimit -S -t $MAX_CPU_TIME -v $MAX_VMEM -s $MAX_STACK + ulimit -S -t $MAX_CPU_TIME -s $MAX_STACK ulimit -c unlimited + # Don't enable ulimit -v when use ASAN see + # https://code.google.com/p/address-sanitizer/wiki/AddressSanitizer#ulimit_-v + if [ $ASAN -eq 0 ]; then + ulimit -v $MAX_VMEM + fi + "$RUNNER" $COMMON_ARGS $ARGS $TMP_DIR/$TMP_FILE \ > /dev/null 2>> $TMP_DIR/$ERR_FILE ) |