Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AFLplusplus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ulf Kargén
AFLplusplus
Commits
a96cdc64
Commit
a96cdc64
authored
2 years ago
by
Sergej Schumilo
Browse files
Options
Downloads
Patches
Plain Diff
switch to latest libnyx API
parent
e2fedce6
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
include/forkserver.h
+17
-8
17 additions, 8 deletions
include/forkserver.h
src/afl-forkserver.c
+35
-19
35 additions, 19 deletions
src/afl-forkserver.c
with
52 additions
and
27 deletions
include/forkserver.h
+
17
−
8
View file @
a96cdc64
...
...
@@ -51,16 +51,23 @@ typedef enum NyxReturnValue {
}
NyxReturnValue
;
typedef
enum
NyxProcessRole
{
StandAlone
,
Parent
,
Child
,
}
NyxProcessRole
;
typedef
struct
{
void
*
(
*
nyx_new
)(
const
char
*
sharedir
,
const
char
*
workdir
,
uint32_t
cpu_id
,
uint32_t
input_buffer_size
,
bool
input_buffer_write_protection
);
void
*
(
*
nyx_new_parent
)(
const
char
*
sharedir
,
const
char
*
workdir
,
uint32_t
cpu_id
,
uint32_t
input_buffer_size
,
bool
input_buffer_write_protection
);
void
*
(
*
nyx_new_child
)(
const
char
*
sharedir
,
const
char
*
workdir
,
uint32_t
cpu_id
,
uint32_t
worker_id
);
void
*
(
*
nyx_config_load
)(
const
char
*
sharedir
);
void
(
*
nyx_config_set_workdir_path
)(
void
*
config
,
const
char
*
workdir
);
void
(
*
nyx_config_set_input_buffer_size
)(
void
*
config
,
uint32_t
input_buffer_size
);
void
(
*
nyx_config_set_input_buffer_write_protection
)(
void
*
config
,
bool
input_buffer_write_protection
);
void
(
*
nyx_config_set_hprintf_fd
)(
void
*
config
,
int32_t
hprintf_fd
);
void
(
*
nyx_config_set_process_role
)(
void
*
config
,
enum
NyxProcessRole
role
);
void
(
*
nyx_config_set_reuse_snapshot_path
)(
void
*
config
,
const
char
*
reuse_snapshot_path
);
void
*
(
*
nyx_new
)(
void
*
config
,
uint32_t
worker_id
);
void
(
*
nyx_shutdown
)(
void
*
qemu_process
);
void
(
*
nyx_option_set_reload_mode
)(
void
*
qemu_process
,
bool
enable
);
void
(
*
nyx_option_set_timeout
)(
void
*
qemu_process
,
uint8_t
timeout_sec
,
...
...
@@ -73,6 +80,8 @@ typedef struct {
uint32_t
(
*
nyx_get_aux_string
)(
void
*
nyx_process
,
uint8_t
*
buffer
,
uint32_t
size
);
bool
(
*
nyx_remove_work_dir
)(
const
char
*
workdir
);
}
nyx_plugin_handler_t
;
/* Imports helper functions to enable Nyx mode (Linux only )*/
...
...
This diff is collapsed.
Click to expand it.
src/afl-forkserver.c
+
35
−
19
View file @
a96cdc64
...
...
@@ -63,14 +63,29 @@ nyx_plugin_handler_t *afl_load_libnyx_plugin(u8 *libnyx_binary) {
handle
=
dlopen
((
char
*
)
libnyx_binary
,
RTLD_NOW
);
if
(
!
handle
)
{
goto
fail
;
}
plugin
->
nyx_new
=
dlsym
(
handle
,
"nyx_new"
);
if
(
plugin
->
nyx_new
==
NULL
)
{
goto
fail
;
}
plugin
->
nyx_config_load
=
dlsym
(
handle
,
"nyx_config_load"
);
if
(
plugin
->
nyx_config_load
==
NULL
)
{
goto
fail
;
}
plugin
->
nyx_config_set_workdir_path
=
dlsym
(
handle
,
"nyx_config_set_workdir_path"
);
if
(
plugin
->
nyx_config_set_workdir_path
==
NULL
)
{
goto
fail
;
}
plugin
->
nyx_config_set_input_buffer_size
=
dlsym
(
handle
,
"nyx_config_set_input_buffer_size"
);
if
(
plugin
->
nyx_config_set_input_buffer_size
==
NULL
)
{
goto
fail
;
}
plugin
->
nyx_config_set_input_buffer_write_protection
=
dlsym
(
handle
,
"nyx_config_set_input_buffer_write_protection"
);
if
(
plugin
->
nyx_config_set_input_buffer_write_protection
==
NULL
)
{
goto
fail
;
}
plugin
->
nyx_
new_parent
=
dlsym
(
handle
,
"nyx_
new_parent
"
);
if
(
plugin
->
nyx_
new_parent
==
NULL
)
{
goto
fail
;
}
plugin
->
nyx_
config_set_hprintf_fd
=
dlsym
(
handle
,
"nyx_
config_set_hprintf_fd
"
);
if
(
plugin
->
nyx_
config_set_hprintf_fd
==
NULL
)
{
goto
fail
;
}
plugin
->
nyx_new_child
=
dlsym
(
handle
,
"nyx_new_child"
);
if
(
plugin
->
nyx_new_child
==
NULL
)
{
goto
fail
;
}
plugin
->
nyx_config_set_process_role
=
dlsym
(
handle
,
"nyx_config_set_process_role"
);
if
(
plugin
->
nyx_config_set_process_role
==
NULL
)
{
goto
fail
;
}
plugin
->
nyx_config_set_reuse_snapshot_path
=
dlsym
(
handle
,
"nyx_config_set_reuse_snapshot_path"
);
if
(
plugin
->
nyx_config_set_reuse_snapshot_path
==
NULL
)
{
goto
fail
;
}
plugin
->
nyx_new
=
dlsym
(
handle
,
"nyx_new"
);
if
(
plugin
->
nyx_new
==
NULL
)
{
goto
fail
;
}
plugin
->
nyx_shutdown
=
dlsym
(
handle
,
"nyx_shutdown"
);
if
(
plugin
->
nyx_shutdown
==
NULL
)
{
goto
fail
;
}
...
...
@@ -101,6 +116,10 @@ nyx_plugin_handler_t *afl_load_libnyx_plugin(u8 *libnyx_binary) {
plugin
->
nyx_get_aux_string
=
dlsym
(
handle
,
"nyx_get_aux_string"
);
if
(
plugin
->
nyx_get_aux_string
==
NULL
)
{
goto
fail
;
}
plugin
->
nyx_remove_work_dir
=
dlsym
(
handle
,
"nyx_remove_work_dir"
);
if
(
plugin
->
nyx_remove_work_dir
==
NULL
)
{
goto
fail
;
}
OKF
(
"libnyx plugin is ready!"
);
return
plugin
;
...
...
@@ -474,27 +493,24 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
}
if
(
fsrv
->
nyx_
st
and
alone
)
{
void
*
nyx_config
=
fsrv
->
nyx_
h
and
lers
->
nyx_config_load
(
fsrv
->
target_path
);
fsrv
->
nyx_runner
=
fsrv
->
nyx_handlers
->
nyx_new
(
fsrv
->
target_path
,
x
,
fsrv
->
nyx_bind_cpu_id
,
MAX_FILE
,
true
);
fsrv
->
nyx_handlers
->
nyx_config_set_workdir_path
(
nyx_config
,
x
);
fsrv
->
nyx_handlers
->
nyx_config_set_input_buffer_size
(
nyx_config
,
MAX_FILE
);
fsrv
->
nyx_handlers
->
nyx_config_set_input_buffer_write_protection
(
nyx_config
,
true
);
if
(
fsrv
->
nyx_standalone
)
{
fsrv
->
nyx_handlers
->
nyx_config_set_process_role
(
nyx_config
,
StandAlone
);
}
else
{
if
(
fsrv
->
nyx_parent
)
{
fsrv
->
nyx_runner
=
fsrv
->
nyx_handlers
->
nyx_new_parent
(
fsrv
->
target_path
,
x
,
fsrv
->
nyx_bind_cpu_id
,
MAX_FILE
,
true
);
fsrv
->
nyx_handlers
->
nyx_config_set_process_role
(
nyx_config
,
Parent
);
}
else
{
fsrv
->
nyx_runner
=
fsrv
->
nyx_handlers
->
nyx_new_child
(
fsrv
->
target_path
,
x
,
fsrv
->
nyx_bind_cpu_id
,
fsrv
->
nyx_id
);
fsrv
->
nyx_handlers
->
nyx_config_set_process_role
(
nyx_config
,
Child
);
}
}
fsrv
->
nyx_runner
=
fsrv
->
nyx_handlers
->
nyx_new
(
nyx_config
,
fsrv
->
nyx_bind_cpu_id
);
ck_free
(
x
);
if
(
fsrv
->
nyx_runner
==
NULL
)
{
FATAL
(
"Something went wrong ..."
);
}
...
...
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