about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2024-06-05 20:21:51 +0200
committerGitHub <noreply@github.com>2024-06-05 20:21:51 +0200
commit69630338ff43dbea2b694f922d1a2d909ba68fc7 (patch)
treef52ab9b2ffbcb96ff7b03848a1f352c05c6b1bf3
parent112759cd39fd31c227c03d5dca866952e5f07b7e (diff)
parentf8767c397bbc97a8729bacdd5f40ee00031742c4 (diff)
downloadafl++-69630338ff43dbea2b694f922d1a2d909ba68fc7.tar.gz
Merge pull request #2114 from WorksButNotTested/frida-rlimit
Fix issue for setrlimit
-rw-r--r--frida_mode/src/instrument/instrument_x64_cache.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/frida_mode/src/instrument/instrument_x64_cache.c b/frida_mode/src/instrument/instrument_x64_cache.c
index ef10e133..90a7045d 100644
--- a/frida_mode/src/instrument/instrument_x64_cache.c
+++ b/frida_mode/src/instrument/instrument_x64_cache.c
@@ -49,14 +49,23 @@ void instrument_cache_init(void) {
 
   if (setrlimit(RLIMIT_AS, &data_limit) != 0) {
 
-    FFATAL("Failed to setrlimit: %d", errno);
+    FWARNF("Failed to setrlimit: %d, you may need root or CAP_SYS_RESOURCE",
+           errno);
 
   }
 
   map_base =
       gum_memory_allocate(NULL, instrument_cache_size, instrument_cache_size,
                           GUM_PAGE_READ | GUM_PAGE_WRITE);
-  if (map_base == MAP_FAILED) { FFATAL("Failed to map segment: %d", errno); }
+  if (map_base == MAP_FAILED) {
+
+    FFATAL(
+        "Failed to map segment: %d. This can be caused by failure to setrlimit."
+        "Disabling or reducing the size of the allocation using "
+        "AFL_FRIDA_INST_NO_CACHE or AFL_FRIDA_INST_CACHE_SIZE may help",
+        errno);
+
+  }
 
   FOKF(cBLU "Instrumentation" cRST " - " cGRN "cache addr:" cYEL " [0x%016lX]",
        GUM_ADDRESS(map_base));