about summary refs log tree commit diff
path: root/frida_mode/src/entry.c
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-08-20 17:28:40 +0100
committerYour Name <you@example.com>2021-08-20 17:28:40 +0100
commit028f8ced8f772d82a7efc522ec629bf4a5fff32d (patch)
treef5440087d2779984812b5e8c50f1fda6bdbb489b /frida_mode/src/entry.c
parent3513ba2e51222151945e8ae87236bb9d2f07f37a (diff)
downloadafl++-028f8ced8f772d82a7efc522ec629bf4a5fff32d.tar.gz
Fixed coverage on OSX (dependency on pipe2)
Removed use of 'realpath' in makefiles to fix OSX incompatibility
Fixed handling of when prefetching should be enabled
Snap the main binary during initialization to avoid stability issues with lazy loading
Add support for configurable inline cache entries for FRIDA on x86/x64
Support for prefetching FRIDA backpatches on x86/x64
Improved stats support on x86/x64/aarch64
Diffstat (limited to 'frida_mode/src/entry.c')
-rw-r--r--frida_mode/src/entry.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/frida_mode/src/entry.c b/frida_mode/src/entry.c
index 0b5f61ec..3ec8f5be 100644
--- a/frida_mode/src/entry.c
+++ b/frida_mode/src/entry.c
@@ -1,3 +1,5 @@
+#include <dlfcn.h>
+
 #include "frida-gumjs.h"
 
 #include "debug.h"
@@ -13,7 +15,8 @@
 extern void __afl_manual_init();
 
 guint64  entry_point = 0;
-gboolean entry_reached = FALSE;
+gboolean entry_compiled = FALSE;
+gboolean entry_run = FALSE;
 
 static void entry_launch(void) {
 
@@ -21,7 +24,7 @@ static void entry_launch(void) {
   __afl_manual_init();
 
   /* Child here */
-  entry_reached = TRUE;
+  entry_run = TRUE;
   instrument_on_fork();
   stats_on_fork();
 
@@ -37,6 +40,8 @@ void entry_init(void) {
 
   OKF("entry_point: 0x%016" G_GINT64_MODIFIER "X", entry_point);
 
+  if (dlopen(NULL, RTLD_NOW) == NULL) { FATAL("Failed to dlopen: %d", errno); }
+
 }
 
 void entry_start(void) {
@@ -49,6 +54,7 @@ static void entry_callout(GumCpuContext *cpu_context, gpointer user_data) {
 
   UNUSED_PARAMETER(cpu_context);
   UNUSED_PARAMETER(user_data);
+  entry_compiled = TRUE;
   entry_launch();
 
 }