From 1f42ff13b8445bba3f0c3d5d00f329599a70b8f1 Mon Sep 17 00:00:00 2001 From: an7s <an7s@git.zephyr-software.com> Date: Sat, 23 May 2015 14:24:32 +0000 Subject: [PATCH] Get core files from crash_dir Former-commit-id: 9e7f759370cc5c3057bf22d698d0e0c6cc2ddcf1 --- tools/cgc_protect/pov_to_cso.sh | 37 +++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/tools/cgc_protect/pov_to_cso.sh b/tools/cgc_protect/pov_to_cso.sh index 332f6787b..86036ab8d 100755 --- a/tools/cgc_protect/pov_to_cso.sh +++ b/tools/cgc_protect/pov_to_cso.sh @@ -11,7 +11,9 @@ CGC_CSID=$2 # cgc name POV_DIR=$3 # directory containing POVs CSO_FILE=$4 # output: CSO warning file suitable for sandboxing step POV_CRASH_SUMMARY_FILE=$5 # input/output: POV-->crash summary file +CRASH_DIR=$6 # optional +timeout=20 local_crash_summary=tmp.crash.summary.$$ log=tmp.log.$$ @@ -21,10 +23,14 @@ delimiter="###" CRASH_SITES=tmp.crashes.$$ +ulimit -c unlimited + # copy the crash summary file locally cp $POV_CRASH_SUMMARY_FILE $local_crash_summary # run cb-test on each POV invidually +if [ -d ${POV_DIR} ]; then + for i in `ls ${POV_DIR}/*.xml` do echo "" @@ -56,13 +62,13 @@ do sudo rm $core 2>/dev/null fi - echo "sudo $cbtest --debug --xml ${one_pov} --timeout 20 --directory ${binary_dir} --cb ${binary} --log $log" - sudo $cbtest --debug --xml ${one_pov} --timeout 20 --directory ${binary_dir} --cb ${binary} --log $log + echo "sudo $cbtest --debug --xml ${one_pov} --timeout $timeout --directory ${binary_dir} --cb ${binary} --log $log" + sudo $cbtest --debug --xml ${one_pov} --timeout $timeout --directory ${binary_dir} --cb ${binary} --log $log grep "core identified" $log if [ $? -eq 0 ]; then if [ -f $core ]; then sudo chown `whoami` $core - eip=`timeout 20 $PEASOUP_HOME/tools/extract_eip_from_core.sh ${CGC_BIN} $core` + eip=`timeout $timeout $PEASOUP_HOME/tools/extract_eip_from_core.sh ${CGC_BIN} $core` if [ $? -eq 0 ]; then echo "$eip" >> $CRASH_SITES echo "${pov_base}${delimiter}${eip}" >> $local_crash_summary @@ -77,9 +83,32 @@ do else echo "${pov_base}${delimiter}0x0" >> $local_crash_summary fi +done +fi -done +# +# Extract crash sites from crashing input dir (if any) +# +if [ -d $CRASH_DIR ]; then + echo "crash directory was specified: $CRASH_DIR" + for i in `ls ${CRASH_DIR}/*` + do + rm core &> /dev/null + echo "cmd: timeout $timeout ${CGC_BIN} < $i &>/dev/null" +# timeout $timeout ${CGC_BIN} < "${i}" &>/dev/null + ${CGC_BIN} < "${i}" &>/dev/null + if [ -f core ]; then + echo "core detected for: $i" + eip=`${PEASOUP_HOME}/tools/extract_eip_from_core.sh ${CGC_BIN} core` + if [ $? -eq 0 ]; then + echo $eip >> $CRASH_SITES + fi + else + echo "no core detected for: $i" + fi + done +fi # # generate policy file for input to sandboxing step -- GitLab