mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-14 02:58:08 +00:00
code format
This commit is contained in:
@ -70,7 +70,8 @@ typedef struct {
|
||||
enum NyxReturnValue (*nyx_exec)(void *qemu_process);
|
||||
uint8_t *(*nyx_get_bitmap_buffer)(void *qemu_process);
|
||||
size_t (*nyx_get_bitmap_buffer_size)(void *qemu_process);
|
||||
uint32_t (*nyx_get_aux_string)(void *nyx_process, uint8_t *buffer, uint32_t size);
|
||||
uint32_t (*nyx_get_aux_string)(void *nyx_process, uint8_t *buffer,
|
||||
uint32_t size);
|
||||
|
||||
} nyx_plugin_handler_t;
|
||||
|
||||
@ -174,7 +175,7 @@ typedef struct afl_forkserver {
|
||||
void * nyx_runner; /* nyx runner object */
|
||||
u32 nyx_id; /* nyx runner id (0 -> master) */
|
||||
u32 nyx_bind_cpu_id; /* nyx runner cpu id */
|
||||
char* nyx_aux_string;
|
||||
char * nyx_aux_string;
|
||||
#endif
|
||||
|
||||
} afl_forkserver_t;
|
||||
|
@ -7,7 +7,7 @@
|
||||
#define TRACE_BUFFER_SIZE (64)
|
||||
|
||||
#define PAGE_SIZE 0x1000
|
||||
#define MMAP_SIZE(x) ((x & ~(PAGE_SIZE-1)) + PAGE_SIZE)
|
||||
#define MMAP_SIZE(x) ((x & ~(PAGE_SIZE - 1)) + PAGE_SIZE)
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
@ -30,8 +30,9 @@ int main(int argc, char **argv) {
|
||||
/* this is our "bitmap" that is later shared with the fuzzer (you can also
|
||||
* pass the pointer of the bitmap used by compile-time instrumentations in
|
||||
* your target) */
|
||||
uint8_t *trace_buffer = mmap(NULL, MMAP_SIZE(TRACE_BUFFER_SIZE), PROT_READ |
|
||||
PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
|
||||
uint8_t *trace_buffer =
|
||||
mmap(NULL, MMAP_SIZE(TRACE_BUFFER_SIZE), PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
|
||||
memset(trace_buffer, 0,
|
||||
TRACE_BUFFER_SIZE); // makes sure that the bitmap buffer is already
|
||||
// mapped into the guest's memory (alternatively
|
||||
|
@ -1257,9 +1257,12 @@ void afl_fsrv_kill(afl_forkserver_t *fsrv) {
|
||||
|
||||
#ifdef __linux__
|
||||
if (fsrv->nyx_mode) {
|
||||
|
||||
free(fsrv->nyx_aux_string);
|
||||
fsrv->nyx_handlers->nyx_shutdown(fsrv->nyx_runner);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -772,19 +772,22 @@ save_if_interesting(afl_state_t *afl, void *mem, u32 len, u8 fault) {
|
||||
close(fd);
|
||||
|
||||
#ifdef __linux__
|
||||
if(afl->fsrv.nyx_mode && fault == FSRV_RUN_CRASH) {
|
||||
if (afl->fsrv.nyx_mode && fault == FSRV_RUN_CRASH) {
|
||||
|
||||
u8 fn_log[PATH_MAX];
|
||||
|
||||
snprintf(fn_log, PATH_MAX, "%s.log", fn);
|
||||
|
||||
fd = open(fn_log, O_WRONLY | O_CREAT | O_EXCL, DEFAULT_PERMISSION);
|
||||
if (unlikely(fd < 0)) { PFATAL("Unable to create '%s'", fn_log); }
|
||||
|
||||
u32 nyx_aux_string_len = afl->fsrv.nyx_handlers->nyx_get_aux_string(afl->fsrv.nyx_runner, afl->fsrv.nyx_aux_string, 0x1000);
|
||||
u32 nyx_aux_string_len = afl->fsrv.nyx_handlers->nyx_get_aux_string(
|
||||
afl->fsrv.nyx_runner, afl->fsrv.nyx_aux_string, 0x1000);
|
||||
|
||||
ck_write(fd, afl->fsrv.nyx_aux_string, nyx_aux_string_len, fn_log);
|
||||
close(fd);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return keeping;
|
||||
|
@ -468,8 +468,7 @@ nyx_plugin_handler_t *afl_load_libnyx_plugin(u8 *libnyx_binary) {
|
||||
dlsym(handle, "nyx_get_bitmap_buffer_size");
|
||||
if (plugin->nyx_get_bitmap_buffer_size == NULL) { goto fail; }
|
||||
|
||||
plugin->nyx_get_aux_string =
|
||||
dlsym(handle, "nyx_get_aux_string");
|
||||
plugin->nyx_get_aux_string = dlsym(handle, "nyx_get_aux_string");
|
||||
if (plugin->nyx_get_aux_string == NULL) { goto fail; }
|
||||
|
||||
OKF("libnyx plugin is ready!");
|
||||
|
Reference in New Issue
Block a user