remove unnecessary map_size variables
MODIFY
include/afl-fuzz.h
include/afl-fuzz.h
@@ -325,8 +325,6 @@ typedef struct afl_env_vars {
*afl_python_module, *afl_path, *afl_hang_tmout, *afl_skip_crashes,
*afl_preload;
- uint32_t map_size;
-
} afl_env_vars_t;
struct afl_pass_stat {

MODIFY
include/sharedmem.h
include/sharedmem.h
@@ -44,8 +44,7 @@ typedef struct sharedmem {
u8 *map; /* shared memory region */
- size_t size_alloc; /* actual allocated size */
- size_t size_used; /* in use by shmem app */
+ size_t map_size; /* actual allocated size */
int cmplog_mode;
struct cmp_map *cmp_map;

MODIFY
llvm_mode/afl-clang-fast.c
llvm_mode/afl-clang-fast.c
@@ -223,11 +223,13 @@ static void edit_params(u32 argc, char **argv, char **envp) {
}
- if ((!(getenv("AFL_LLVM_LTO_AUTODICTIONARY") // disabled when autodictionary
- && instrument_mode != INSTRUMENT_LTO)) // and lto_mode is used
- && (getenv("LAF_TRANSFORM_COMPARES") ||
+ if (getenv("LAF_TRANSFORM_COMPARES") ||
getenv("AFL_LLVM_LAF_TRANSFORM_COMPARES"))) {
+ if (!be_quiet && getenv("AFL_LLVM_LTO_AUTODICTIONARY") &&
+ instrument_mode != INSTRUMENT_LTO))
+ WARNF("using AFL_LLVM_LAF_TRANSFORM_COMPARES together with AFL_LLVM_LTO_AUTODICTIONARY makes no sense. Use only AFL_LLVM_LTO_AUTODICTIONARY.");
+
cc_params[cc_par_cnt++] = "-Xclang";
cc_params[cc_par_cnt++] = "-load";
cc_params[cc_par_cnt++] = "-Xclang";

MODIFY
src/afl-fuzz-state.c
src/afl-fuzz-state.c
@@ -81,7 +81,7 @@ void afl_state_init(afl_state_t *afl, uint32_t map_size) {
and out_size are NULL/0 by default. */
memset(afl, 0, sizeof(afl_state_t));
- if (!map_size) map_size = MAP_SIZE;
+ if (!map_size) afl->shm.map_size = MAP_SIZE;
afl->w_init = 0.9;
afl->w_end = 0.3;

MODIFY
src/afl-fuzz.c
src/afl-fuzz.c
@@ -264,7 +264,7 @@ int main(int argc, char **argv_orig, char **envp) {
afl_fsrv_init(&afl->fsrv);
read_afl_environment(afl, envp);
- if (afl->afl_env.map_size) afl->fsrv.map_size = afl->afl_env.map_size;
+ if (afl->shm.map_size) afl->fsrv.map_size = afl->shm.map_size;
exit_1 = !!afl->afl_env.afl_bench_just_one;
SAYF(cCYA "afl-fuzz" VERSION cRST

MODIFY
src/afl-sharedmem.c
src/afl-sharedmem.c
@@ -72,7 +72,7 @@ void afl_shm_deinit(sharedmem_t *shm) {
#ifdef USEMMAP
if (shm->map != NULL) {
- munmap(shm->map, shm->size_alloc);
+ munmap(shm->map, shm->map_size);
shm->map = NULL;
}
@@ -99,7 +99,7 @@ void afl_shm_deinit(sharedmem_t *shm) {
u8 *afl_shm_init(sharedmem_t *shm, size_t map_size, unsigned char dumb_mode) {
- shm->size_alloc = shm->size_used = map_size;
+ shm->map_size = map_size;
shm->map = NULL;

remove unnecessary map_size variables