From 51d5608f69ab5e6ccdead69c54440fe36936c7ab Mon Sep 17 00:00:00 2001 From: Javier Cabrera Date: Thu, 24 Aug 2023 18:13:49 +0200 Subject: [PATCH] Oracles check for md5sum --- .../jobs/dynamic_diversity/oracle_diff_trace_ins.sh | 11 +++++++++-- .../jobs/dynamic_diversity/oracle_diff_trace_mem.sh | 13 ++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/experiments/jobs/dynamic_diversity/oracle_diff_trace_ins.sh b/experiments/jobs/dynamic_diversity/oracle_diff_trace_ins.sh index 13efef6..3ff6f6f 100644 --- a/experiments/jobs/dynamic_diversity/oracle_diff_trace_ins.sh +++ b/experiments/jobs/dynamic_diversity/oracle_diff_trace_ins.sh @@ -5,8 +5,15 @@ wasm=$2 /host_based/tracer/pintool/pin/pin -t /host_based/tracer/pintool/obj-intel64/tracer.so -i 1 -m 0 -c 1 -b 1 -o trace.ins.txt -- tracer $wasm # check if the trace.ins.txt is the same as the trace_file, return 1 if they are the same -if cmp -s "trace.ins.txt" "$trace_file"; then - echo "Different trace" +# check the md5sum of the trace.ins.txt and trace_file +md5sum trace.ins.txt > trace.ins.txt.md5 +md5sum $trace_file > $trace_file.md5 +# remove the file name from the md5sum +sed -i 's/ trace.ins.txt//g' trace.ins.txt.md5 +sed -i 's/ $trace_file//g' $trace_file.md5 +# check if the md5sum is the same +if cmp -s "trace.ins.txt.md5" "$trace_file.md5"; then + echo "Same trace" exit 1 else exit 0 diff --git a/experiments/jobs/dynamic_diversity/oracle_diff_trace_mem.sh b/experiments/jobs/dynamic_diversity/oracle_diff_trace_mem.sh index 8c85d39..7a586f9 100644 --- a/experiments/jobs/dynamic_diversity/oracle_diff_trace_mem.sh +++ b/experiments/jobs/dynamic_diversity/oracle_diff_trace_mem.sh @@ -3,14 +3,21 @@ wasm=$2 echo "$trace_file $wasm" > trace.txt -/host_based/tracer/pintool/pin/pin -t /host_based/tracer/pintool/obj-intel64/tracer.so -i 0 -m 1 -M 0 -c 0 -b 0 -o orig.ins.txt -- tracer $wasm +/host_based/tracer/pintool/pin/pin -t /host_based/tracer/pintool/obj-intel64/tracer.so -i 0 -m 1 -M 0 -c 0 -b 0 -o trace.mem.txt -- tracer $wasm + +md5sum trace.mem.txt > trace.mem.txt.md5 +md5sum $trace_file > $trace_file.md5 +# remove the file name from the md5sum +sed -i 's/ trace.mem.txt//g' trace.mem.txt.md5 +sed -i 's/ $trace_file//g' $trace_file.md5 # check if the trace.ins.txt is the same as the trace_file, return 1 if they are the same -if cmp -s "trace.ins.txt" "$trace_file"; then - echo "Different trace" +if cmp -s "trace.mem.txt.md5" "$trace_file.md5"; then + echo "Same trace" exit 1 else exit 0 fi +