persistent mode: shared memory test case transfer

This commit is contained in:
van Hauser
2020-05-25 16:40:55 +02:00
parent 4c394a9d7b
commit 707145c491
13 changed files with 341 additions and 31 deletions

View File

@ -2153,6 +2153,30 @@ void check_binary(afl_state_t *afl, u8 *fname) {
OKF(cPIN "Persistent mode binary detected.");
setenv(PERSIST_ENV_VAR, "1", 1);
afl->persistent_mode = 1;
// do not fail if we can not get the fuzzing shared mem
if ((afl->shm_fuzz = calloc(1, sizeof(sharedmem_t)))) {
// we need to set the dumb mode to not overwrite the SHM_ENV_VAR
if ((afl->fsrv.shdmem_fuzz = afl_shm_init(afl->shm_fuzz, MAX_FILE, 1))) {
#ifdef USEMMAP
setenv(SHM_FUZZ_ENV_VAR, afl->shm_fuzz->g_shm_file_path, 1);
#else
u8 *shm_str;
shm_str = alloc_printf("%d", afl->shm_fuzz->shm_id);
setenv(SHM_FUZZ_ENV_VAR, shm_str, 1);
ck_free(shm_str);
#endif
afl->fsrv.support_shdmen_fuzz = 1;
} else {
free(afl->shm_fuzz);
afl->shm_fuzz = NULL;
}
}
} else if (getenv("AFL_PERSISTENT")) {