diff --git a/tools/cgc_protect/is_new_pov.sh b/tools/cgc_protect/is_new_pov.sh index ebb1ecad59693b2836bd527da6ebe1152bbd748e..36f0f2aaa6076e3d06d25dd2e018337c9d79fcb3 100755 --- a/tools/cgc_protect/is_new_pov.sh +++ b/tools/cgc_protect/is_new_pov.sh @@ -1,18 +1,22 @@ #!/bin/bash # +# # Returns success (0) only if the POV results in a new crash point +# Returns > 0 otherwise +# +# /techx_share/techx_umbrella/peasoup/security_transforms/tools/cgc_protect/is_new_pov.sh /home/vagrant/techx_work/0b32aa01_crash_filter/id:000049,sig:11,src:000007,op:arith8,pos:88,val:+9.10288.xml /home/vagrant/techx_work/0b32aa01_crash_filter/0b32aa01_01.crash.summary /home/vagrant/techx_work/0b32aa01_crash_filter/0b32aa01_01 # POV_PATH=$1 # fully qualified path for POV -CRASH_SUMMARY=$2 # input/output: POV-->crash summary file +CRASH_SUMMARY=$2 # crash summary file CGC_BIN=$3 # input cgc binary (@todo: handle multi-cbs) cbtest=$CGC_UMBRELLA_DIR/scripts/techx-cb-test timeout=20 delimiter="###" -log=`pwd`/tmp.log.$$ +log=`pwd`/tmp.log pov_base=`basename ${POV_PATH}` binary=`basename $CGC_BIN` @@ -21,17 +25,17 @@ core=${binary_dir}/core # lookup pov tmp=`grep -F "${pov_base}${delimiter}" ${CRASH_SUMMARY}` -if [ $? -eq 0 ];then - return 1 +if [ $? -eq 0 ]; then + exit 2 fi # cleanup any stale core files if [ -f $core ]; then - sudo rm $core 2>/dev/null + sudo rm $core &>/dev/null fi -echo "sudo -E $cbtest --debug --xml ${pov_base} --timeout $timeout --directory ${binary_dir} --cb ${binary} --log $log" -sudo -E $cbtest --debug --xml ${pov_base} --timeout $timeout --directory ${binary_dir} --cb ${binary} --log $log +echo "sudo -E $cbtest --debug --xml ${POV_PATH} --timeout $timeout --directory ${binary_dir} --cb ${binary} --log $log" +sudo -E $cbtest --debug --xml ${POV_PATH} --timeout $timeout --directory ${binary_dir} --cb ${binary} --log $log grep "core identified" $log if [ $? -eq 0 ]; then if [ -f $core ]; then @@ -39,16 +43,20 @@ if [ $? -eq 0 ]; then sudo chown `whoami` $core eip=`timeout $timeout $PEASOUP_HOME/tools/extract_eip_from_core.sh ${CGC_BIN} $core` if [ $? -eq 0 ]; then - echo "$eip" >> $CRASH_SITES - return 0 + tmp=`grep -F "${delimiter}$eip" ${CRASH_SUMMARY}` + if [ $? -eq 0 ]; then + exit 1 + else + exit 0 + fi else - return 1 + exit 1 fi - sudo rm $core 2>/dev/null + sudo rm $core &>/dev/null else - return 1 + exit 1 fi else - return 1 + exit 1 fi