aboutsummaryrefslogtreecommitdiff
path: root/frida_mode/src/prefetch.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2022-08-08 15:27:07 +0200
committerGitHub <noreply@github.com>2022-08-08 15:27:07 +0200
commit3e2986dd78dbc45035b47a34eedd7dd1b9a4d0b3 (patch)
tree051a91a2a36a1c768870591634eca83c62e6053c /frida_mode/src/prefetch.c
parenta2f3c3ee519c19935039d1fe1e8b77cdc32fa375 (diff)
parent1f06b55a8b558bd8da0296134c29c21c4849a4bd (diff)
downloadafl++-3e2986dd78dbc45035b47a34eedd7dd1b9a4d0b3.tar.gz
Merge pull request #1489 from AFLplusplus/dev4.02c
push to stable
Diffstat (limited to 'frida_mode/src/prefetch.c')
-rw-r--r--frida_mode/src/prefetch.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/frida_mode/src/prefetch.c b/frida_mode/src/prefetch.c
index 5621a685..905e0ae9 100644
--- a/frida_mode/src/prefetch.c
+++ b/frida_mode/src/prefetch.c
@@ -1,12 +1,11 @@
#include <errno.h>
-#include <sys/shm.h>
-#include <sys/mman.h>
#include "frida-gumjs.h"
#include "entry.h"
#include "intercept.h"
#include "prefetch.h"
+#include "shm.h"
#include "stalker.h"
#include "util.h"
@@ -285,28 +284,7 @@ void prefetch_init(void) {
* with the coverage bitmap region and fork will take care of ensuring both
* the parent and child see the same consistent memory region.
*/
- prefetch_shm_id =
- shmget(IPC_PRIVATE, sizeof(prefetch_data_t), IPC_CREAT | IPC_EXCL | 0600);
- if (prefetch_shm_id < 0) {
-
- FFATAL("prefetch_shm_id < 0 - errno: %d\n", errno);
-
- }
-
- prefetch_data = shmat(prefetch_shm_id, NULL, 0);
- g_assert(prefetch_data != MAP_FAILED);
-
- /*
- * Configure the shared memory region to be removed once the process dies.
- */
- if (shmctl(prefetch_shm_id, IPC_RMID, NULL) < 0) {
-
- FFATAL("shmctl (IPC_RMID) < 0 - errno: %d\n", errno);
-
- }
-
- /* Clear it, not sure it's necessary, just seems like good practice */
- memset(prefetch_data, '\0', sizeof(prefetch_data_t));
+ prefetch_data = shm_create(sizeof(prefetch_data_t));
prefetch_hook_fork();