aboutsummaryrefslogtreecommitdiff
path: root/frida_mode/src/prefetch.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2022-08-06 09:02:02 +0200
committerGitHub <noreply@github.com>2022-08-06 09:02:02 +0200
commit94fe62ad8db938757a3052f2041aef390e19c9a1 (patch)
treeff645a8bd0a5d81e3f6f825efebf87845b463436 /frida_mode/src/prefetch.c
parent4b9c560b07e1ea42633b59e0eb94f7a3f0fe0c58 (diff)
parent608ea5f8abbfce9c309d452e2ee3dbb014dc511a (diff)
downloadafl++-94fe62ad8db938757a3052f2041aef390e19c9a1.tar.gz
Merge pull request #1467 from WorksButNotTested/droid
Android Fixes
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();