Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zafl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Source Software
zafl
Commits
71658c2f
Commit
71658c2f
authored
6 years ago
by
Anh Nguyen-Tuong
Browse files
Options
Downloads
Patches
Plain Diff
Add random seed option
parent
e78ccc30
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
afl_transforms/tools/zax/zax_driver.cpp
+9
-1
9 additions, 1 deletion
afl_transforms/tools/zax/zax_driver.cpp
bin/zafl.sh
+14
-4
14 additions, 4 deletions
bin/zafl.sh
with
23 additions
and
5 deletions
afl_transforms/tools/zax/zax_driver.cpp
+
9
−
1
View file @
71658c2f
...
...
@@ -52,6 +52,7 @@ static void usage(char* name)
cerr
<<
"
\t
[--disable-floating-instrumentation|-I] Instrument first instruction in basic blocks"
<<
endl
;
cerr
<<
"
\t
[--enable-context-sensitivity <style>] Use calling context sensitivity, style={callsite,function}"
<<
endl
;
cerr
<<
"
\t
[--disable-context-sensitivity] Disable calling context sensitivity"
<<
endl
;
cerr
<<
"
\t
[--random-seed|r <value>] Specify random seed"
<<
endl
;
}
int
main
(
int
argc
,
char
**
argv
)
...
...
@@ -77,6 +78,7 @@ int main(int argc, char **argv)
auto
breakup_critical_edges
=
false
;
auto
floating_instrumentation
=
false
;
auto
context_sensitivity
=
ContextSensitivity_None
;
auto
random_seed
=
0U
;
set
<
string
>
exitpoints
;
srand
(
getpid
()
+
time
(
NULL
));
...
...
@@ -104,9 +106,10 @@ int main(int argc, char **argv)
{
"enable-floating-instrumentation"
,
no_argument
,
0
,
'i'
},
{
"disable-floating-instrumentation"
,
no_argument
,
0
,
'I'
},
{
"enable-context-sensitivity"
,
required_argument
,
0
,
'z'
},
{
"random-seed"
,
required_argument
,
0
,
'r'
},
{
0
,
0
,
0
,
0
}
};
const
char
*
short_opts
=
"z:e:E:w:sv?hagGdDfFucCiI"
;
const
char
*
short_opts
=
"
r:
z:e:E:w:sv?hagGdDfFucCiI"
;
while
(
true
)
{
...
...
@@ -184,6 +187,11 @@ int main(int argc, char **argv)
else
context_sensitivity
=
ContextSensitivity_None
;
break
;
case
'r'
:
random_seed
=
strtoul
(
optarg
,
NULL
,
0
);
srand
(
random_seed
);
cout
<<
"Setting random seed to: "
<<
random_seed
<<
endl
;
break
;
default:
break
;
}
...
...
This diff is collapsed.
Click to expand it.
bin/zafl.sh
+
14
−
4
View file @
71658c2f
...
...
@@ -37,6 +37,7 @@ usage()
echo
" -i, --enable-floating-instrumentation Select best instrumentation point within basic block"
echo
" -I, --disable-floating-instrumentation Use first instruction for instrumentation in basic blocks (default)"
echo
" --enable-context-sensitivity <style> style={callsite,function} only function supported currently (off by default)"
echo
" -r, --random-seed <value> Specify random seed"
# echo " -l, --enable-locality Maintain code locality (best effort) when instrumenting binary"
# echo " -L, --disable-locality Randomized layout when instrumenting binary"
echo
" -v Verbose mode"
...
...
@@ -50,6 +51,8 @@ other_args=""
float_opt
=
""
context_sensitivity_opt
=
""
trace_opt
=
""
zipr_opt
=
""
random_seed
=
""
me
=
$(
whoami
)
...
...
@@ -197,11 +200,11 @@ parse_args()
shift
case
$1
in
function
)
context_sensitivity
_opt
=
" -o zax:
\"
--enable-context-sensitivity function
\"
"
zax
_opt
=
" -o zax:
\"
--enable-context-sensitivity function
\"
"
shift
;;
callsite
)
context_sensitivity
_opt
=
" -o zax:--enable-context-sensitivity callsite "
zax
_opt
=
" -o zax:
\"
--enable-context-sensitivity callsite
\"
"
echo
"Error: context sensitivity <callsite> currently unsupported"
exit
1
;;
...
...
@@ -211,6 +214,13 @@ parse_args()
;;
esac
;;
-r
|
--random-seed
)
shift
random_seed
=
"
$1
"
zax_opt
=
"
$zax_opt
-o zax:
\"
--random-seed
$random_seed
\"
"
zipr_opt
=
"
$zipr_opt
--step-option zipr:
\"
--zipr:seed
$random_seed
\"
"
shift
;;
-l
|
--enable-locality
)
trace_opt
=
" --step-option zipr:--traceplacement:on --step-option zipr:true "
shift
...
...
@@ -324,8 +334,8 @@ fi
#
log_msg
"Transforming input binary
$input_binary
into
$output_zafl_binary
"
zax_opt
=
"
$zax_opt
$float_opt
$context_sensitivity_opt
"
cmd
=
"
$ZAFL_TM_ENV
$PSZ
$input_binary
$output_zafl_binary
$ida_or_rida_opt
-c move_globals=on -c zax=on -o move_globals:--elftables-only
$stars_opt
$zax_opt
$verbose_opt
$options
$other_args
$trace_opt
"
zax_opt
=
"
$zax_opt
$float_opt
"
cmd
=
"
$ZAFL_TM_ENV
$PSZ
$input_binary
$output_zafl_binary
$ida_or_rida_opt
-c move_globals=on -c zax=on -o move_globals:--elftables-only
$stars_opt
$zax_opt
$verbose_opt
$options
$other_args
$trace_opt
$zipr_opt
"
if
[
!
-z
"
$ZAFL_TM_ENV
"
]
;
then
log_msg
"Trace map will be expected at fixed address"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment