diff options
author | vanhauser-thc <vh@thc.org> | 2022-05-09 13:18:14 +0200 |
---|---|---|
committer | vanhauser-thc <vh@thc.org> | 2022-05-09 13:18:14 +0200 |
commit | 51942b605d6fcb22d85c1fe1a845b6ec2839e793 (patch) | |
tree | 32434c0f086a175ff9cf6515e3803876f8b78887 /src/afl-sharedmem.c | |
parent | 47dae21f4a0da74e3e454f637285baebf0567491 (diff) | |
download | afl++-51942b605d6fcb22d85c1fe1a845b6ec2839e793.tar.gz |
support post_process's own return buffer
Diffstat (limited to 'src/afl-sharedmem.c')
-rw-r--r-- | src/afl-sharedmem.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/afl-sharedmem.c b/src/afl-sharedmem.c index 9e0d7531..b48c6fb3 100644 --- a/src/afl-sharedmem.c +++ b/src/afl-sharedmem.c @@ -163,34 +163,36 @@ u8 *afl_shm_init(sharedmem_t *shm, size_t map_size, so we do this worse workaround */ snprintf(shm->g_shm_file_path, L_tmpnam, "/afl_%d_%ld", getpid(), random()); -#ifdef SHM_LARGEPAGE_ALLOC_DEFAULT - /* trying to get large memory segment optimised and monitorable separately as such */ + #ifdef SHM_LARGEPAGE_ALLOC_DEFAULT + /* trying to get large memory segment optimised and monitorable separately as + * such */ static size_t sizes[4] = {(size_t)-1}; - static int psizes = 0; - int i; + static int psizes = 0; + int i; if (sizes[0] == (size_t)-1) { psizes = getpagesizes(sizes, 4); } /* very unlikely to fail even if the arch supports only two sizes */ if (likely(psizes > 0)) { - for (i = psizes - 1; shm->g_shm_fd == -1 && i >= 0; --i) { + for (i = psizes - 1; shm->g_shm_fd == -1 && i >= 0; --i) { - if (sizes[i] == 0 || map_size % sizes[i]) { continue; } + if (sizes[i] == 0 || map_size % sizes[i]) { continue; } - shm->g_shm_fd = shm_create_largepage(shm->g_shm_file_path, shmflags, i, - SHM_LARGEPAGE_ALLOC_DEFAULT, DEFAULT_PERMISSION); + shm->g_shm_fd = + shm_create_largepage(shm->g_shm_file_path, shmflags, i, + SHM_LARGEPAGE_ALLOC_DEFAULT, DEFAULT_PERMISSION); - } + } } -#endif + #endif /* create the shared memory segment as if it was a file */ if (shm->g_shm_fd == -1) { - shm->g_shm_fd = shm_open(shm->g_shm_file_path, shmflags | O_CREAT, - DEFAULT_PERMISSION); + shm->g_shm_fd = + shm_open(shm->g_shm_file_path, shmflags | O_CREAT, DEFAULT_PERMISSION); } |