Skip to content
Snippets Groups Projects
Commit d5420378 authored by jdh8d's avatar jdh8d
Browse files

Added dumbledore and dumbledore_cmd examples for testing concolic engine.

parent 27d46cc7
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,8 @@ examples/Makefile -text
examples/block_copy.c -text
examples/cmd_args_005.c -text
examples/concolic_test_handshake.c -text
examples/dumbledore.c -text
examples/dumbledore_cmd.c -text
examples/fptest.c -text
examples/globalfield.c -text
examples/hanoi.c -text
......
......@@ -162,6 +162,14 @@ cmd_args_005: cmd_args_005.o ${STRATA}/lib/x86_linux/libstrata_normal.a .PHONY
${PEASOUP_HOME}/tools/peasoup_link++ cmd_args_005.o -o cmd_args_005
${SMPSA_HOME}/SMP-analyze.sh cmd_args_005.ncexe
dumbledore: dumbledore.o ${STRATA}/lib/x86_linux/libstrata_normal.a .PHONY
${PEASOUP_HOME}/tools/peasoup_link++ dumbledore.o -o dumbledore
${SMPSA_HOME}/SMP-analyze.sh dumbledore.ncexe
dumbledore_cmd: dumbledore_cmd.o ${STRATA}/lib/x86_linux/libstrata_normal.a .PHONY
${PEASOUP_HOME}/tools/peasoup_link++ dumbledore_cmd.o -o dumbledore_cmd
${SMPSA_HOME}/SMP-analyze.sh dumbledore_cmd.ncexe
.PHONY: env_check
.c.o:
......@@ -199,10 +207,11 @@ double_free_suite:
cd double_free_tests; make
clean:
rm -f *.o *.syms *.map chopzero hanoi hanoi_overrun hanoi_heap_overrun malloc block_copy print_ptr hanoi_stack_overrun
rm -f *.o *.syms *.map chopzero hanoi hanoi_overrun hanoi_heap_overrun malloc block_copy print_ptr hanoi_stack_overrun dumbledore a.out memcpy hanoi_overrun_taintedenv dumbledore_cmd hanoi_overrun_tainted hello cmd_args_005
rm -f *.exe *.dis *.data *.idb *.log *.ncexe *.annot *.readelf temp.* *.temp *.stratafied *.asm *.SMPobjdump *.id0 *.id1 *.til *.nam
rm -Rf concolic.files_*
rm -f strata.log.*
rm -f *.sym
concclean:
rm -Rf concolic.files_*
......
#include <stdio.h>
#include <sys/mman.h>
#include <string.h>
#include <stdlib.h>
enum {BUFSIZE = 98};
char grade = 'D';
char Name[BUFSIZE];
FILE *f;
void readString(char *s) {
char buf[BUFSIZE];
int i = 0;
int c;
for (;;)
{
c = getchar();
if ((c == EOF) || (c == '\n'))
break;
buf[i] = c;
i++;
}
buf[i] = '\0';
for (i = 0; i < BUFSIZE; i++)
s[i] = buf[i];
}
int main(void)
{
readString(Name);
if (strcmp(Name, "Wizard in Training") == 0)
grade = 'B';
printf("Thank you, %s.\n", Name);
printf("I recommend that you get a grade of %c on this assignment.\n", grade);
exit(0);
}
#include <stdio.h>
#include <sys/mman.h>
#include <string.h>
#include <stdlib.h>
enum {BUFSIZE = 24};
char grade = 'D';
char Name[BUFSIZE];
void readString(char *in, char *s) {
char buf[BUFSIZE];
int i = 0;
int c;
for (;;)
{
c = in[i];
if ((c == '\0') || (c == '\n'))
break;
buf[i] = c;
i++;
}
buf[i] = '\0';
for (i = 0; i < BUFSIZE; i++)
s[i] = buf[i];
}
int main(int argc, char * argv[])
{
if (argc == 2)
readString(argv[1], Name);
if (strcmp(Name, "Wizard in Training") == 0)
grade = 'B';
printf("Thank you, %s.\n", Name);
printf("I recommend that you get a grade of %c on this assignment.\n", grade);
return 0;
}
......@@ -5,9 +5,19 @@ shift
extra_args=$*
strata_exe=$exe.stratafied
annot=$exe.ncexe.annot
sym=$exe.sym
whoami=`whoami`
#
# simple error checking
#
if [ $GRACE_HOME"X" = "X" ]; then echo Failed to set GRACE_HOME; exit 2; fi
if [ ! -f $GRACE_HOME/concolic/src/util/linux/meds_annot_to_grace ]; then
echo "Failed to set GRACE_HOME properly (i.e. wrong path)"
exit 3
fi
# get a starting pc
line=`cat $annot|egrep " FUNC GLOBAL main"|sed "s/ */ /g"`
......@@ -17,12 +27,19 @@ start_ea=`echo $line |cut -d" " -f1`
line=`cat $annot|egrep " FUNC GLOBAL exit"|sed "s/ */ /g"`
stop_ea=`echo $line |cut -d" " -f1`
# assume grace_home env is set.
$GRACE_HOME/concolic/src/util/linux/meds_annot_to_grace $annot
if [ ! -f $sym ]; then
echo Failed to produce .sym file
exit 1;
fi
echo Removing all ipc queues.
for i in `ipcs -q|grep $whoami |cut -d" " -f 2`;
do
ipcrm -q $i
done
STRATA_GRACE=1 controller $extra_args --start $start_ea --stop $stop_ea $strata_exe
STRATA_GRACE=1 controller $extra_args --start $start_ea --stop $stop_ea $strata_exe --symbols $sym
echo cleaning up
killall -q controller
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment