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
cdec4360
Commit
cdec4360
authored
6 years ago
by
Anh Nguyen-Tuong
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup and fix test
parent
45474c7e
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/zuntracer.cpp
+19
-25
19 additions, 25 deletions
afl_transforms/tools/zax/zuntracer.cpp
test/bc.fixed_map/test_bc.sh
+6
-4
6 additions, 4 deletions
test/bc.fixed_map/test_bc.sh
with
25 additions
and
29 deletions
afl_transforms/tools/zax/zuntracer.cpp
+
19
−
25
View file @
cdec4360
...
...
@@ -107,6 +107,22 @@ void ZUntracer_t::_afl_instrument_bb(Instruction_t *p_inst, const bool p_redZone
auto
inserted_before
=
false
;
auto
honorRedZone
=
p_redZoneHint
;
const
auto
do_insert
=
[
&
](
const
string
&
insn_str
)
->
void
{
if
(
inserted_before
)
{
tmp
=
insertAssemblyAfter
(
tmp
,
insn_str
);
block_record
.
push_back
(
tmp
);
}
else
{
const
auto
orig
=
insertAssemblyBefore
(
tmp
,
insn_str
);
inserted_before
=
true
;
block_record
.
push_back
(
orig
);
}
};
// if we have a free register, we don't muck with the stack ==> no need to honor red zone
if
(
found_tracemap_free_register
)
{
...
...
@@ -115,26 +131,13 @@ void ZUntracer_t::_afl_instrument_bb(Instruction_t *p_inst, const bool p_redZone
if
(
honorRedZone
)
{
orig
=
insertAssemblyBefore
(
tmp
,
"lea rsp, [rsp-128]"
);
inserted_before
=
true
;
block_record
.
push_back
(
orig
);
do_insert
(
"lea rsp, [rsp-128]"
);
}
// we did not find a free register, save rcx and then use it for the tracemap
if
(
!
found_tracemap_free_register
)
{
if
(
inserted_before
)
{
tmp
=
insertAssemblyAfter
(
tmp
,
"push rcx"
);
block_record
.
push_back
(
tmp
);
}
else
{
orig
=
insertAssemblyBefore
(
tmp
,
"push rcx"
);
inserted_before
=
true
;
block_record
.
push_back
(
orig
);
}
do_insert
(
"push rcx"
);
reg_trace_map
=
strdup
(
"rcx"
);
}
...
...
@@ -142,16 +145,7 @@ void ZUntracer_t::_afl_instrument_bb(Instruction_t *p_inst, const bool p_redZone
// load address trace map into rcx
sprintf
(
buf
,
"T%d: mov %s, QWORD [rel T%d]"
,
labelid
,
reg_trace_map
,
labelid
);
if
(
inserted_before
)
{
tmp
=
insertAssemblyAfter
(
tmp
,
buf
);
block_record
.
push_back
(
tmp
);
}
else
{
orig
=
insertAssemblyBefore
(
tmp
,
buf
);
block_record
.
push_back
(
orig
);
}
do_insert
(
buf
);
create_got_reloc
(
getFileIR
(),
m_trace_map
,
tmp
);
// update trace map
...
...
This diff is collapsed.
Click to expand it.
test/bc.fixed_map/test_bc.sh
+
6
−
4
View file @
cdec4360
...
...
@@ -30,6 +30,8 @@ fuzz_with_zafl()
{
bc_zafl
=
$1
env
|
grep
ZAFL
# setup AFL directories
mkdir
zafl_in
echo
"1"
>
zafl_in/1
...
...
@@ -57,9 +59,9 @@ fuzz_with_zafl()
mkdir
-p
$session
pushd
$session
# Fix map at 0x1
2
000
trace_map_address
=
"0x12000"
export
ZAFL_TRACE_MAP_FIXED_ADDRESS
=
"
$
trace_map_address
"
# Fix map at 0x1
0
000
# Should match value in env. var ZAFL_TRACE_MAP_FIXED_ADDRESS
trace_map_address
=
"0x10000
"
# build ZAFL version of bc executable with fixed map
...
...
@@ -69,7 +71,7 @@ if [ $? -eq 0 ]; then
else
log_error
"build bc.fixed.zafl"
fi
grep
ATTR analysis.bc.fixed.zafl/logs/za
fl
.log
grep
ATTR analysis.bc.fixed.zafl/logs/za
x
.log
log_message
"Fuzz for
$AFL_TIMEOUT
secs"
fuzz_with_zafl
$(
realpath
./bc.fixed.zafl
)
...
...
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