Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libzafl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
libzafl
Commits
efda6aa6
Commit
efda6aa6
authored
6 years ago
by
Anh Nguyen-Tuong
Browse files
Options
Downloads
Patches
Plain Diff
ZUntracer instrumentation
parent
871aced4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/libzafl.c
+22
-2
22 additions, 2 deletions
src/libzafl.c
with
22 additions
and
2 deletions
src/libzafl.c
+
22
−
2
View file @
efda6aa6
...
...
@@ -30,8 +30,8 @@
#include
"config.h"
// externally visible so that Zipr transformations can access directly
u8
*
zafl_trace_map
;
unsigned
short
zafl_prev_id
;
u8
*
zafl_trace_map
=
NULL
;
unsigned
short
zafl_prev_id
=
0
;
static
s32
shm_id
;
static
int
__afl_temp_data
;
...
...
@@ -50,6 +50,8 @@ void __attribute__((constructor)) zafl_initAflForkServer();
void
__attribute__
((
constructor
))
zafl_setupSharedMemory
();
#endif
void
__attribute__
((
destructor
))
zafl_dumpTracemap
();
// always setup a trace map so that an instrumented applicatin will run
// even if not running under AFL
static
void
zafl_setupSharedMemory
()
...
...
@@ -90,6 +92,8 @@ void zafl_initAflForkServer()
if
(
getenv
(
"ZAFL_DEBUG"
))
debug
=
1
;
zafl_setupSharedMemory
();
if
(
debug
)
printf
(
"libzafl: map is at 0x%x
\n
"
,
zafl_trace_map
);
if
(
!
zafl_trace_map
)
{
zafl_trace_map
=
(
u8
*
)
malloc
(
MAP_SIZE
);
...
...
@@ -141,3 +145,19 @@ void zafl_bbInstrument(unsigned short id) {
zafl_trace_map
[
zafl_prev_id
^
id
]
++
;
zafl_prev_id
=
id
>>
1
;
}
void
zafl_dumpTracemap
()
{
if
(
!
debug
)
return
;
PRINT_DEBUG
(
"zafl_dumpTracemap(): enter
\n
"
);
if
(
!
zafl_trace_map
)
return
;
printf
(
"tracemap at: 0x%x
\n
"
,
zafl_trace_map
);
for
(
int
i
=
0
;
i
<
0xFFFF
;
++
i
)
{
if
(
zafl_trace_map
[
i
]
!=
0
)
printf
(
"%x:%d
\n
"
,
i
,
zafl_trace_map
[
i
]);
}
PRINT_DEBUG
(
"zafl_dumpTracemap(): exit
\n
"
);
}
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