From 740a82c292fe43cb21effadef170bcd6d27254ec Mon Sep 17 00:00:00 2001 From: nkennedy <nkennedy@git.zephyr-software.com> Date: Mon, 22 Jul 2013 11:28:59 +0000 Subject: [PATCH] Fix to script to only analyze subprograms that were successfully exec'd, that exist and are 32-bit ELF executables. ok nkennedy@ ip:peasoup Former-commit-id: 6fb287475a124b42ecd11c5fd43b2c043fa0c08a --- tools/ps_tne_scripts_p2/analyze | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/ps_tne_scripts_p2/analyze b/tools/ps_tne_scripts_p2/analyze index 341204d49..b337b9aa7 100755 --- a/tools/ps_tne_scripts_p2/analyze +++ b/tools/ps_tne_scripts_p2/analyze @@ -121,17 +121,19 @@ python $LOG_COMMAND -n $1 -t "Analyze script" -m "$message_2" python $LOG_COMMAND -n $1 -t "Analyze script" -m "Analysis phase beginning" # Get a list of pathnames of everything $execcmd execs during initialization -EXEC_FILES=( $( $GRACE_HOME/concolic/bin/pgrp-timeout 10 strace -s10240 -f -e trace=execve $execcmd 2>&1 >/dev/null | grep -Po '(?<=execve\(")([^"]+(?="))' | sort | uniq ) ) +EXEC_FILES=( $( $GRACE_HOME/concolic/bin/pgrp-timeout 10 strace -s10240 -f -e trace=execve $execcmd 2>&1 >/dev/null | /bin/grep " = 0$" | /bin/grep -Po '(?<=execve\(")([^"]+(?="))' | sort | uniq ) ) TO_ANALYZE=() # filter out anything that matches execcmd, execcmd_base=`basename $execcmd` for f in "${EXEC_FILES[@]}" do - if [[ `basename $f` != $execcmd_base ]] && [[ $f != /bin/* ]] && [[ $f != /usr/bin/* ]] && [[ $f != /sbin/* ]] && [[ $f != /usr/sbin/* ]] ; - then - python $LOG_COMMAND -n $1 -t "Analyze script" -m "Queueing subprogram for analysis: $f" - TO_ANALYZE+=("$f") + if [[ -x $f ]] && [[ `basename $f` != $execcmd_base ]] && [[ $f != /bin/* ]] && [[ $f != /usr/bin/* ]] && [[ $f != /sbin/* ]] && [[ $f != /usr/sbin/* ]]; then + file $f | /bin/grep "ELF 32" + if [[ $? = 0 ]]; then + python $LOG_COMMAND -n $1 -t "Analyze script" -m "Queueing subprogram for analysis: $f" + TO_ANALYZE+=("$f") + fi else python $LOG_COMMAND -n $1 -t "Analyze script" -m "Skipping subprogram: $f" fi -- GitLab