Compare commits
3 Commits
fret
...
even_more_
Author | SHA1 | Date | |
---|---|---|---|
202b2c63d7 | |||
cc4c434b17 | |||
05d2eb691b |
@ -1,11 +1,17 @@
|
|||||||
import csv
|
import csv
|
||||||
def_flags="--no-default-features --features std,snapshot_restore,singlecore"
|
def_flags="--no-default-features --features std,snapshot_restore,singlecore"
|
||||||
|
|
||||||
|
rule build_showmap:
|
||||||
|
output:
|
||||||
|
directory("bins/target_showmap")
|
||||||
|
shell:
|
||||||
|
"cargo build --target-dir {output} {def_flags},systemstate"
|
||||||
|
|
||||||
rule build_random:
|
rule build_random:
|
||||||
output:
|
output:
|
||||||
directory("bins/target_random")
|
directory("bins/target_random")
|
||||||
shell:
|
shell:
|
||||||
"cargo build --target-dir {output} {def_flags}"
|
"cargo build --target-dir {output} {def_flags},feed_longest"
|
||||||
|
|
||||||
rule build_feedlongest:
|
rule build_feedlongest:
|
||||||
output:
|
output:
|
||||||
@ -74,6 +80,58 @@ rule run_bench:
|
|||||||
script="export FUZZ_RANDOM=1\n"+script
|
script="export FUZZ_RANDOM=1\n"+script
|
||||||
shell(script)
|
shell(script)
|
||||||
|
|
||||||
|
rule run_showmap:
|
||||||
|
input:
|
||||||
|
"build/{target}.elf",
|
||||||
|
"bins/target_showmap",
|
||||||
|
"timedump/{fuzzer}/{target}.{num}.case"
|
||||||
|
output:
|
||||||
|
"timedump/{fuzzer}/{target}.{num}.trace.ron"
|
||||||
|
run:
|
||||||
|
with open('target_symbols.csv') as csvfile:
|
||||||
|
reader = csv.DictReader(csvfile)
|
||||||
|
line = next((x for x in reader if x['kernel']==wildcards.target), None)
|
||||||
|
if line == None:
|
||||||
|
return False
|
||||||
|
kernel=line['kernel']
|
||||||
|
fuzz_main=line['main_function']
|
||||||
|
fuzz_input=line['input_symbol']
|
||||||
|
fuzz_len=line['input_size']
|
||||||
|
bkp=line['return_function']
|
||||||
|
script="""
|
||||||
|
mkdir -p $(dirname {output})
|
||||||
|
export KERNEL=$(pwd)/{input[0]}
|
||||||
|
export FUZZ_MAIN={fuzz_main}
|
||||||
|
export FUZZ_INPUT={fuzz_input}
|
||||||
|
export FUZZ_INPUT_LEN={fuzz_len}
|
||||||
|
export BREAKPOINT={bkp}
|
||||||
|
export TRACE_DUMP=$(pwd)/{output}
|
||||||
|
export FUZZER=$(pwd)/{input[1]}/debug/fret
|
||||||
|
export DO_SHOWMAP=$(pwd)/{input[2]}
|
||||||
|
set +e
|
||||||
|
../fuzzer.sh
|
||||||
|
exit 0
|
||||||
|
"""
|
||||||
|
if wildcards.fuzzer == 'random':
|
||||||
|
script="export FUZZ_RANDOM=1\n"+script
|
||||||
|
shell(script)
|
||||||
|
|
||||||
|
rule tarnsform_trace:
|
||||||
|
input:
|
||||||
|
"timedump/{fuzzer}/{target}.{num}.trace.ron"
|
||||||
|
output:
|
||||||
|
"timedump/{fuzzer}/{target}.{num}.trace.csv"
|
||||||
|
shell:
|
||||||
|
"$(pwd)/../../../../state2gantt/target/debug/state2gantt {input} > {output[0]}"
|
||||||
|
|
||||||
|
rule trace2gantt:
|
||||||
|
input:
|
||||||
|
"timedump/{fuzzer}/{target}.{num}.trace.csv"
|
||||||
|
output:
|
||||||
|
"timedump/{fuzzer}/{target}.{num}.trace.csv.png"
|
||||||
|
shell:
|
||||||
|
"Rscript --vanilla $(pwd)/../../../../state2gantt/gantt.R {input}"
|
||||||
|
|
||||||
rule all_bins:
|
rule all_bins:
|
||||||
input:
|
input:
|
||||||
"bins/target_random",
|
"bins/target_random",
|
||||||
@ -83,6 +141,10 @@ rule all_bins:
|
|||||||
"bins/target_state",
|
"bins/target_state",
|
||||||
"bins/target_graph"
|
"bins/target_graph"
|
||||||
|
|
||||||
|
rule all_constructed:
|
||||||
|
input:
|
||||||
|
expand("timedump/{fuzzer}/{target}.{num}", fuzzer=['random','afl','state','graph','feedlongest','feedaflnolongest'], target=['tmr'],num=range(0,10))
|
||||||
|
|
||||||
rule all_periodic:
|
rule all_periodic:
|
||||||
input:
|
input:
|
||||||
expand("timedump/{fuzzer}/{target}.{num}", fuzzer=['random','afl','state','graph'], target=['waters'],num=range(0,10))
|
expand("timedump/{fuzzer}/{target}.{num}", fuzzer=['random','afl','state','graph'], target=['waters'],num=range(0,10))
|
||||||
|
@ -2,7 +2,7 @@ library("mosaic")
|
|||||||
args = commandArgs(trailingOnly=TRUE)
|
args = commandArgs(trailingOnly=TRUE)
|
||||||
|
|
||||||
#myolors=c("#339933","#0066ff","#993300") # grün, balu, rot
|
#myolors=c("#339933","#0066ff","#993300") # grün, balu, rot
|
||||||
myolors=c("dark green","dark blue","dark red", "yellow") # grün, balu, rot
|
myolors=c("green","blue","red", "yellow", "pink", "black") # grün, balu, rot
|
||||||
|
|
||||||
if (length(args)==0) {
|
if (length(args)==0) {
|
||||||
runtype="timedump"
|
runtype="timedump"
|
||||||
@ -138,12 +138,14 @@ frame2plot <- function(maxlines,colors=NULL,draw_extreme=TRUE,doint=FALSE,over_n
|
|||||||
|
|
||||||
all_maxlines = c()
|
all_maxlines = c()
|
||||||
for (bn in BASENAMES) {
|
for (bn in BASENAMES) {
|
||||||
runtypefiles <- list.files(file.path(BENCHDIR,bn),pattern="\\.[0-9]$",full.names = TRUE)
|
runtypefiles <- list.files(file.path(BENCHDIR,bn),pattern=sprintf("%s.[0-9]$",target),full.names = TRUE)
|
||||||
|
if (length(runtypefiles) > 0) {
|
||||||
runtypetables = lapply(runtypefiles, function(x) read.table(x, quote="\"", comment.char="", col.names=c(bn)))
|
runtypetables = lapply(runtypefiles, function(x) read.table(x, quote="\"", comment.char="", col.names=c(bn)))
|
||||||
runtypetables = trim_data(runtypetables)
|
runtypetables = trim_data(runtypetables)
|
||||||
list_of_maxlines = data2maxlines(runtypetables)
|
list_of_maxlines = data2maxlines(runtypetables)
|
||||||
mean_maxline<-Reduce(function(a,b) a+b,list_of_maxlines,0)/length(runtypetables)
|
mean_maxline<-Reduce(function(a,b) a+b,list_of_maxlines,0)/length(runtypetables)
|
||||||
all_maxlines=append(all_maxlines,mean_maxline)
|
all_maxlines=append(all_maxlines,mean_maxline)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
min_length <- min(sapply(all_maxlines, length))
|
min_length <- min(sapply(all_maxlines, length))
|
||||||
all_maxlines=lapply(all_maxlines, function(v) v[1:min_length])
|
all_maxlines=lapply(all_maxlines, function(v) v[1:min_length])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user