var scope reduction
[trinity.git] / scripts / find.sh
blob4c970c172cd5b46197d93c5c1045cd33a3be597e
1 #!/bin/bash
3 # This is an example of how to search for an interaction between
4 # two syscalls. In the example below I was chasing an oops in
5 # sendmsg that only occurred after connect was called.
8 TRINITY_PATH=${TRINITY_PATH:-.}
9 TRINITY_TMP=$(mktemp -d /tmp/trinity.XXXXXX)
11 check_tainted()
13 if [ "$(cat /proc/sys/kernel/tainted)" != $TAINT ]; then
14 echo ERROR: Taint flag changed $(cat /proc/sys/kernel/tainted)
15 exit
19 chmod 755 $TRINITY_TMP
20 cd $TRINITY_TMP
22 TAINT=$(cat /proc/sys/kernel/tainted)
24 NR_CPUS=`grep ^processor /proc/cpuinfo | /usr/bin/wc -l`
26 while [ 1 ];
30 for sc in $($TRINITY_PATH/trinity -L | grep entrypoint | grep -v AVOID | awk '{ print $3 }' | sort -u)
32 mkdir -p tmp.$i
33 pushd tmp.$i
35 if [ ! -f $TRINITY_PATH/trinity ]; then
36 echo lost!
37 pwd
38 exit
41 $TRINITY_PATH/trinity -q -l off -n -c sendmsg -c $sc -C32 -N 999999
43 popd
45 check_tainted
47 chmod 755 $TRINITY_TMP
49 done
51 done