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

Fixes to makefiles to support more options. Also added ability to ps_analyze...

Fixes to makefiles to support more options.  Also added ability to ps_analyze to turn on/off for dynamically applied transforms (like heaprand).
parent 80b4cb4b
No related branches found
No related tags found
No related merge requests found
......@@ -160,4 +160,5 @@ tools/ps_validate.sh -text
tools/ps_validate_ss.deprecated.sh -text
tools/set_dyna_link.sh -text
tools/test_controller.sh -text
tools/update_env_var.sh -text
tools/validate.sh -text
......@@ -14,6 +14,27 @@ LDFLAGS=
exes=hanoi.protected hanoi_overrun.protected hanoi_heap_overrun.protected hanoi_stack_overrun.protected print_ptr.protected malloc.protected block_copy.protected hello.protected hanoi_overrun_tainted.protected hanoi_overrun_taintedenv.protected memcpy.protected cmd_args_005.protected dumbledore_stdin.protected dumbledore_cmd.protected dumbledore_file.protected
ilr=on
stratafy_with_pc_confine=on
create_binary_script=on
heaprand=on
double_free=on
pc_confine=on
isr=on
meds_static=on
pdb_register=on
pdb_create_tables=on
meds2pdb=on
fill_in_cfg=on
fill_in_indtargs=on
clone=on
fix_calls=on
p1transform=on
integertransform=on
ilr=on
generate_spri=on
spasm=on
all: env_check ${exes}
......@@ -26,7 +47,27 @@ all: env_check ${exes}
${LD} ${LDFLAGS} $< -o $@
.stock.protected:
${PEASOUP_HOME}/tools/ps_analyze.sh $< $@ --step ilr=${ilr}
${PEASOUP_HOME}/tools/ps_analyze.sh $< $@ \
--step ilr=${ilr}\
--step stratafy_with_pc_confine=${stratafy_with_pc_confine}\
--step create_binary_script=${create_binary_script}\
--step heaprand=${heaprand}\
--step double_free=${double_free}\
--step pc_confine=${pc_confine}\
--step isr=${isr}\
--step meds_static=${meds_static}\
--step pdb_register=${pdb_register}\
--step pdb_create_tables=${pdb_create_tables}\
--step meds2pdb=${meds2pdb}\
--step fill_in_cfg=${fill_in_cfg}\
--step fill_in_indtargs=${fill_in_indtargs}\
--step clone=${clone}\
--step fix_calls=${fix_calls}\
--step p1transform=${p1transform}\
--step integertransform=${integertransform}\
--step generate_spri=${generate_spri}\
--step spasm=${spasm}\
.c.o:
${PEASOUP_HOME}/tools/ps_comp.sh $<
......
......@@ -12,6 +12,26 @@ LD=DO_NOT_USE
exes=hanoi.protected hanoi_overrun.protected hanoi_heap_overrun.protected hanoi_stack_overrun.protected print_ptr.protected malloc.protected block_copy.protected hello.protected hanoi_overrun_tainted.protected hanoi_overrun_taintedenv.protected memcpy.protected cmd_args_005.protected dumbledore_stdin.protected dumbledore_cmd.protected dumbledore_file.protected
ilr=on
stratafy_with_pc_confine=on
create_binary_script=on
heaprand=on
double_free=on
pc_confine=on
isr=on
meds_static=on
pdb_register=on
pdb_create_tables=on
meds2pdb=on
fill_in_cfg=on
fill_in_indtargs=on
clone=on
fix_calls=on
p1transform=on
integertransform=on
ilr=on
generate_spri=on
spasm=on
all: env_check ${exes}
......@@ -21,7 +41,27 @@ all: env_check ${exes}
${PEASOUP_HOME}/tools/ps_link.sh $< -o $@
.stock.protected:
${PEASOUP_HOME}/tools/ps_analyze.sh $< $@ --step ilr=${ilr}
${PEASOUP_HOME}/tools/ps_analyze.sh $< $@ \
--step ilr=${ilr}\
--step stratafy_with_pc_confine=${stratafy_with_pc_confine}\
--step create_binary_script=${create_binary_script}\
--step heaprand=${heaprand}\
--step double_free=${double_free}\
--step pc_confine=${pc_confine}\
--step isr=${isr}\
--step meds_static=${meds_static}\
--step pdb_register=${pdb_register}\
--step pdb_create_tables=${pdb_create_tables}\
--step meds2pdb=${meds2pdb}\
--step fill_in_cfg=${fill_in_cfg}\
--step fill_in_indtargs=${fill_in_indtargs}\
--step clone=${clone}\
--step fix_calls=${fix_calls}\
--step p1transform=${p1transform}\
--step integertransform=${integertransform}\
--step generate_spri=${generate_spri}\
--step spasm=${spasm}\
.c.o:
${PEASOUP_HOME}/tools/ps_comp.sh $<
......
......@@ -2,12 +2,33 @@
CC=gcc
CXX=g++
CFLAGS=-O2
ilr=on
.SUFFIXES: .stock .protected
protected_exes=awk.protected bzip2.protected cal.protected cat.protected clear.protected date.protected df.protected diff.protected du.protected expr.protected find.protected grep.protected hostname.protected ipcs.protected less.protected ls.protected nasm.protected objdump.protected ps.protected sdiff.protected wc.protected whoami.protected xeyes.protected xcalc.protected
ilr=on
stratafy_with_pc_confine=on
create_binary_script=on
heaprand=on
double_free=on
pc_confine=on
isr=off
meds_static=on
pdb_register=on
pdb_create_tables=on
meds2pdb=on
fill_in_cfg=on
fill_in_indtargs=on
clone=on
fix_calls=on
p1transform=on
integertransform=on
ilr=on
generate_spri=on
spasm=on
all: env_check ${protected_exes}
.PHONY: env_check
......@@ -15,10 +36,30 @@ all: env_check ${protected_exes}
.stock.protected: .PHONY
${PEASOUP_HOME}/tools/ps_analyze.sh $< $@ --step ilr=${ilr}
${PEASOUP_HOME}/tools/ps_analyze.sh $< $@ \
--step ilr=${ilr}\
--step stratafy_with_pc_confine=${stratafy_with_pc_confine}\
--step create_binary_script=${create_binary_script}\
--step heaprand=${heaprand}\
--step double_free=${double_free}\
--step pc_confine=${pc_confine}\
--step isr=${isr}\
--step meds_static=${meds_static}\
--step pdb_register=${pdb_register}\
--step pdb_create_tables=${pdb_create_tables}\
--step meds2pdb=${meds2pdb}\
--step fill_in_cfg=${fill_in_cfg}\
--step fill_in_indtargs=${fill_in_indtargs}\
--step clone=${clone}\
--step fix_calls=${fix_calls}\
--step p1transform=${p1transform}\
--step integertransform=${integertransform}\
--step generate_spri=${generate_spri}\
--step spasm=${spasm}\
$(protected_exes): ${STRATA}/lib/x86_linux/libstrata.a
$(protected_exes): ${STRATA}/lib/x86_linux/libstrata.a .PHONY
......@@ -40,6 +81,9 @@ env_check:
echo STRATA_HOME environment variable should be set.; \
exit -1;\
fi ;
@echo ----------------------------------------------------------
@echo -------- Note that ISR is off by default here ------------
@echo ----------------------------------------------------------
clean:
......
......@@ -8,6 +8,8 @@ peasoup_binary=$name.sh
echo "#!/bin/sh" >> $peasoup_binary
echo "" >> $peasoup_binary
echo "$PEASOUP_HOME/tools/ps_run.sh $current_dir \"\$@\"" >> $peasoup_binary
echo "$current_dir/ps_run.sh $current_dir \"\$@\"" >> $peasoup_binary
chmod +x $peasoup_binary
cp $PEASOUP_HOME/tools/ps_run.sh $current_dir
......@@ -43,7 +43,6 @@ check_options()
while true ; do
case "$1" in
-s|--step)
echo "found option --step with argument $2"
check_step_option $2
phases_off=" $phases_off $2 "
shift 2
......@@ -216,11 +215,12 @@ report_logs()
for i in $all_logs
do
stepname=`basename $i .log`
echo >> $logfile
echo ------------------------------------------------------- >> $logfile
echo ----- From $i ------------------- >> $logfile
echo ------------------------------------------------------- >> $logfile
cat $i |sed "s/^# ATTRIBUTE */# ATTRIBUTE renamed_for_ps/" >> $logfile
cat $i |sed "s/^# ATTRIBUTE */# ATTRIBUTE ps_$i_/" >> $logfile
echo ------------------------------------------------------- >> $logfile
echo >> $logfile
done
......@@ -291,7 +291,7 @@ fi
# set the threshold value. if a step errors with a more severe error (1=most severe, >1 lesser severe)
# than the error_threshold, we exit.
#
error_threshold=1
error_threshold=0
#
# record when we started processing:
......@@ -370,6 +370,16 @@ perform_step stratafy_with_pc_confine sh $STRATA_HOME/tools/pc_confinement/strat
# This binary will really be a shell script that calls the newly stratafied binary
#
perform_step create_binary_script $PEASOUP_HOME/tools/do_makepeasoupbinary.sh $name
perform_step heaprand $PEASOUP_HOME/tools/update_env_var.sh STRATA_HEAPRAND 1
perform_step double_free $PEASOUP_HOME/tools/update_env_var.sh STRATA_DOUBLE_FREE 1
perform_step pc_confine $PEASOUP_HOME/tools/update_env_var.sh STRATA_PC_CONFINE 1
perform_step isr $PEASOUP_HOME/tools/update_env_var.sh STRATA_PC_CONFINE_XOR 1
STRATA_DOUBLE_FREE=0
STRATA_HEAPRAND=0
STRATA_PC_CONFINE=0
STRATA_PC_CONFINE_XOR=0
#
......
......@@ -21,23 +21,26 @@ fi
# Run the program with the proper env. vars set., and the arguments to the program specified
#
command="
STRATA_DOUBLE_FREE=0
STRATA_HEAPRAND=0
STRATA_PC_CONFINE=0
STRATA_PC_CONFINE_XOR=0
STRATA_PC_CONFINE_XOR_KEY_LENGTH=1024
STRATA_ANNOT_FILE=$datapath/a.ncexe.annot
STRATA_SIEVE=1
STRATA_RC=1
STRATA_PARTIAL_INLINING=0
STRATA_LOG=detectors
STRATA_OUTPUT_FILE=$datapath/diagnostics.out
$datapath/a.stratafied"
if [ ! -z $VERBOSE ]; then
echo STRATA_SPRI_FILE=$STRATA_SPRI_FILE STRATA_DOUBLE_FREE=1 STRATA_HEAPRAND=1 STRATA_PC_CONFINE=1 STRATA_PC_CONFINE_XOR=0 STRATA_PC_CONFINE_XOR_KEY_LENGTH=1024 STRATA_ANNOT_FILE=$datapath/a.ncexe.annot STRATA_SIEVE=1 STRATA_RC=1 STRATA_PARTIAL_INLINING=0 STRATA_LOG=detectors STRATA_OUTPUT_FILE=$datapath/diagnostics.out $datapath/a.stratafied "$@"
echo $command
fi
STRATA_DOUBLE_FREE=1 \
STRATA_HEAPRAND=1 \
STRATA_PC_CONFINE=1 \
STRATA_PC_CONFINE_XOR=0 \
STRATA_PC_CONFINE_XOR_KEY_LENGTH=1024 \
STRATA_ANNOT_FILE=$datapath/a.ncexe.annot \
STRATA_SIEVE=1 \
STRATA_RC=1 \
STRATA_PARTIAL_INLINING=0 \
STRATA_LOG=detectors \
STRATA_OUTPUT_FILE=$datapath/diagnostics.out \
$datapath/a.stratafied "$@"
eval $command "$@"
SAVE_EXIT_CODE=$?
......
#!/bin/sh
var=$1
value=$2
cat ps_run.sh |sed "s/$1=.*$/$1=$2/" > ps_run.sav
mv ps_run.sav ps_run.sh
chmod +x ps_run.sh
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