Change used sanitizer detection method 70/158370/2
authorDmitriy Nikiforov <d.nikiforov@samsung.com>
Tue, 31 Oct 2017 10:08:59 +0000 (13:08 +0300)
committerMaria Guseva <m.guseva@samsung.com>
Wed, 1 Nov 2017 16:31:50 +0000 (16:31 +0000)
'nm' utility is replaced with 'ldd' which is more precise and reliable way
to determine which sanitizer was used in the target.

This change also makes 'binutils' package dependency no longer necessary and
the corresponding '--install-deps' option for the 'run' command is removed.

Change-Id: Ie8577dc91b8657a7e987e84a2281f55c230f372a

infra/commands/run-all.sh
infra/commands/run.sh

index b1a4df3..784d11e 100755 (executable)
@@ -65,7 +65,7 @@ function start_worker() {
 
     # start fuzzing
     echo "* Starting job on ${worker}: ${job} ..."
-    echo "" | "${COMMANDS_DIR}"/run.sh --install-deps --serial "${worker}" --timeout $((TIMEOUT * 60)) \
+    echo "" | "${COMMANDS_DIR}"/run.sh --serial "${worker}" --timeout $((TIMEOUT * 60)) \
                                ${job} >/dev/null 2>&1 &
 
     # save pid and job
index ed51658..b08bcd6 100755 (executable)
@@ -14,7 +14,6 @@ Options:
   -h, --help                  Prints this message.
   -d, --dump-coverage         Dump accumulated coverage information.
   -m, --merge                 Minimize generated corpus.
-  -i, --install-deps          Install required utilities on device.
   -s, --serial SERIAL_NUMBER  Send all sdb command to device with specified
                               serial number.
   -t, --test-input TEST_INPUT Push specified input to device and use it as
@@ -72,8 +71,6 @@ declare -A LIBFUZZER_COV_OPTS=([close_fd_mask]=3
 declare -A LIB_DIRS=([x86_64]="usr/lib64"
                      [i686]="usr/lib")
 
-INSTALL_DEPS=0
-
 ########################################################
 #               GLOBAL OPTIONS PARSING
 ########################################################
@@ -93,10 +90,6 @@ while [[ ${1} = -* ]]; do
             LIBFUZZER_OPTS[jobs]=1
             shift
             ;;
-        '-i'|'--install-deps')
-            INSTALL_DEPS=1
-            shift
-            ;;
         '-s'|'--serial')
             SDB_CMD="sdb ${1} ${2}"
             shift 2
@@ -150,10 +143,6 @@ LIBFUZZER_OPTS[artifact_prefix]="${artifacts_dir}/"
 
 prepare_device
 
-# check and install, if needed, necessary dependencies
-printf "\nChecking dependencies...\n"
-check_and_install_deps "${INSTALL_DEPS}" 'base' 'binutils'
-
 # get the sanitized libraries directory (used in LD_PRELOAD and LD_LIBRARY_PATH)
 arch=$(sdb_shell_verbose uname -m)
 lib_dir="/sanitized/${LIB_DIRS[$arch]}"
@@ -161,9 +150,9 @@ lib_dir="/sanitized/${LIB_DIRS[$arch]}"
 # check which sanitizer should be used
 detect_sanitizer_sh=/tmp/detect_sanitizer.sh
 sanitizer=$(sdb_shell_verbose echo \
-"if nm -D ${target_bin} | grep __asan_ > /dev/null; then
+"if ldd ${target_bin} | grep libasan.so > /dev/null; then
     echo 'ASan'
-elif nm -D ${target_bin} | grep __ubsan_ > /dev/null; then
+elif ldd ${target_bin} | grep libubsan.so > /dev/null; then
     echo 'UBSan'
 else
     echo ''