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
e5ae2ce5
Commit
e5ae2ce5
authored
6 years ago
by
Anh Nguyen-Tuong
Browse files
Options
Downloads
Patches
Plain Diff
Make sure block ids are unique
parent
1045fb4d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
afl_transforms/tools/zafl/zafl.cpp
+18
-2
18 additions, 2 deletions
afl_transforms/tools/zafl/zafl.cpp
afl_transforms/tools/zafl/zafl.hpp
+3
-0
3 additions, 0 deletions
afl_transforms/tools/zafl/zafl.hpp
with
21 additions
and
2 deletions
afl_transforms/tools/zafl/zafl.cpp
+
18
−
2
View file @
e5ae2ce5
...
...
@@ -57,6 +57,22 @@ static void create_got_reloc(FileIR_t* fir, pair<DataScoop_t*,int> wrt, Instruct
i
->
GetRelocations
().
insert
(
r
);
}
unsigned
Zafl_t
::
get_blockid
()
{
auto
counter
=
0
;
auto
blockid
=
0
;
while
(
counter
++
<
(
1
<<
18
))
{
blockid
=
rand
()
&
0xFFFF
;
if
(
m_used_blockid
.
find
(
blockid
)
==
m_used_blockid
.
end
())
{
m_used_blockid
.
insert
(
blockid
);
return
blockid
;
}
}
return
blockid
;
}
/*
zafl_trace_bits[zafl_prev_id ^ id]++; │ tmp= insertAssemblyAfter(getFileIR(), tmp," pop r8");
zafl_prev_id = id >> 1;
...
...
@@ -70,7 +86,7 @@ void Zafl_t::afl_instrument_bb(Instruction_t *inst)
tmp
=
insertAssemblyAfter
(
getFileIR
(),
tmp
,
"push rdx"
);
tmp
=
insertAssemblyAfter
(
getFileIR
(),
tmp
,
"pushf"
);
auto
blockid
=
rand
()
&
0xFFFF
;
auto
blockid
=
get_blockid
()
;
/*
0: 48 8b 15 00 00 00 00 mov rdx,QWORD PTR [rip+0x0] # 7 <f+0x7>
...
...
@@ -121,7 +137,7 @@ void Zafl_t::afl_instrument_bb(Instruction_t *inst)
*/
int
Zafl_t
::
execute
()
{
m_stars_analysis_engine
.
do_STARS
(
getFileIR
());
//
m_stars_analysis_engine.do_STARS(getFileIR());
// for all functions
// for all basic blocks
...
...
This diff is collapsed.
Click to expand it.
afl_transforms/tools/zafl/zafl.hpp
+
3
−
0
View file @
e5ae2ce5
...
...
@@ -19,6 +19,8 @@ public:
int
execute
();
void
afl_instrument_bb
(
Instruction_t
*
inst
);
private:
unsigned
get_blockid
();
private:
libIRDB
::
pqxxDB_t
&
m_dbinterface
;
STARS
::
IRDB_Interface_t
m_stars_analysis_engine
;
...
...
@@ -27,6 +29,7 @@ private:
std
::
pair
<
DataScoop_t
*
,
int
>
m_trace_bits
;
// afl shared memory trace map
std
::
pair
<
DataScoop_t
*
,
int
>
m_prev_id
;
// id of previous block
std
::
set
<
unsigned
>
m_used_blockid
;
int
num_bb_instrumented
;
};
...
...
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