aboutsummaryrefslogtreecommitdiff
path: root/frida_mode/src/prefetch.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2021-07-19 10:54:12 +0200
committerGitHub <noreply@github.com>2021-07-19 10:54:12 +0200
commit815161827689c339d335233b7b232ac9b120b79b (patch)
tree4e686574ccf1f47cea79fc24514c8455e3a1fbc1 /frida_mode/src/prefetch.c
parent9321a24e682b5c8bf6278961bd014cb883b87295 (diff)
parentcc57cc5f463e9b79980c2087d19b4a1e1360ec52 (diff)
downloadafl++-815161827689c339d335233b7b232ac9b120b79b.tar.gz
Merge branch 'release' into stable
Diffstat (limited to 'frida_mode/src/prefetch.c')
-rw-r--r--frida_mode/src/prefetch.c37
1 files changed, 7 insertions, 30 deletions
diff --git a/frida_mode/src/prefetch.c b/frida_mode/src/prefetch.c
index 50d10c9e..65c09fba 100644
--- a/frida_mode/src/prefetch.c
+++ b/frida_mode/src/prefetch.c
@@ -2,11 +2,10 @@
#include <sys/shm.h>
#include <sys/mman.h>
-#include "frida-gumjs.h"
+#include "frida-gum.h"
#include "debug.h"
-#include "intercept.h"
#include "prefetch.h"
#include "stalker.h"
@@ -21,10 +20,9 @@ typedef struct {
} prefetch_data_t;
-gboolean prefetch_enable = TRUE;
-
static prefetch_data_t *prefetch_data = NULL;
-static int prefetch_shm_id = -1;
+
+static int prefetch_shm_id = -1;
/*
* We do this from the transformer since we need one anyway for coverage, this
@@ -74,33 +72,14 @@ void prefetch_read(void) {
}
-void prefetch_config(void) {
-
- prefetch_enable = (getenv("AFL_FRIDA_INST_NO_PREFETCH") == NULL);
-
-}
-
-static int prefetch_on_fork(void) {
-
- prefetch_read();
- return fork();
-
-}
-
-static void prefetch_hook_fork(void) {
-
- void *fork_addr =
- GSIZE_TO_POINTER(gum_module_find_export_by_name(NULL, "fork"));
- intercept_hook(fork_addr, prefetch_on_fork, NULL);
-
-}
-
void prefetch_init(void) {
g_assert_cmpint(sizeof(prefetch_data_t), ==, PREFETCH_SIZE);
- OKF("Instrumentation - prefetch [%c]", prefetch_enable ? 'X' : ' ');
+ gboolean prefetch = (getenv("AFL_FRIDA_INST_NO_PREFETCH") == NULL);
- if (!prefetch_enable) { return; }
+ OKF("Instrumentation - prefetch [%c]", prefetch ? 'X' : ' ');
+
+ if (!prefetch) { return; }
/*
* Make our shared memory, we can attach before we fork, just like AFL does
* with the coverage bitmap region and fork will take care of ensuring both
@@ -129,7 +108,5 @@ void prefetch_init(void) {
/* Clear it, not sure it's necessary, just seems like good practice */
memset(prefetch_data, '\0', sizeof(prefetch_data_t));
- prefetch_hook_fork();
-
}