aboutsummaryrefslogtreecommitdiff
path: root/frida_mode
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2024-06-09 19:09:17 +0200
committerGitHub <noreply@github.com>2024-06-09 19:09:17 +0200
commit9f6b012fbfc8b79dda83e73a208e429aaf25e7ee (patch)
tree7f729cd9133553252979386a910c4072e59293d9 /frida_mode
parentfd713413e85a45a18c51712f55d5742356f00730 (diff)
parentec0b83f127702fe23da72f4d424bc13a5bacfae9 (diff)
downloadafl++-9f6b012fbfc8b79dda83e73a208e429aaf25e7ee.tar.gz
Merge pull request #2117 from AFLplusplus/devv4.21c
push to stable
Diffstat (limited to 'frida_mode')
-rw-r--r--frida_mode/src/instrument/instrument_x64_cache.c13
-rw-r--r--frida_mode/src/ranges.c31
2 files changed, 26 insertions, 18 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));
diff --git a/frida_mode/src/ranges.c b/frida_mode/src/ranges.c
index 269ba59b..714fd9be 100644
--- a/frida_mode/src/ranges.c
+++ b/frida_mode/src/ranges.c
@@ -194,24 +194,23 @@ static gboolean print_ranges_callback(const GumRangeDetails *details,
if (details->file == NULL) {
- FVERBOSE("\t0x%016" G_GINT64_MODIFIER "x-0x%016" G_GINT64_MODIFIER
- "X %c%c%c",
- details->range->base_address,
- details->range->base_address + details->range->size,
- details->protection & GUM_PAGE_READ ? 'R' : '-',
- details->protection & GUM_PAGE_WRITE ? 'W' : '-',
- details->protection & GUM_PAGE_EXECUTE ? 'X' : '-');
+ OKF("\t0x%016" G_GINT64_MODIFIER "x-0x%016" G_GINT64_MODIFIER "X %c%c%c",
+ details->range->base_address,
+ details->range->base_address + details->range->size,
+ details->protection & GUM_PAGE_READ ? 'R' : '-',
+ details->protection & GUM_PAGE_WRITE ? 'W' : '-',
+ details->protection & GUM_PAGE_EXECUTE ? 'X' : '-');
} else {
- FVERBOSE("\t0x%016" G_GINT64_MODIFIER "x-0x%016" G_GINT64_MODIFIER
- "X %c%c%c %s(0x%016" G_GINT64_MODIFIER "x)",
- details->range->base_address,
- details->range->base_address + details->range->size,
- details->protection & GUM_PAGE_READ ? 'R' : '-',
- details->protection & GUM_PAGE_WRITE ? 'W' : '-',
- details->protection & GUM_PAGE_EXECUTE ? 'X' : '-',
- details->file->path, details->file->offset);
+ OKF("\t0x%016" G_GINT64_MODIFIER "x-0x%016" G_GINT64_MODIFIER
+ "X %c%c%c %s(0x%016" G_GINT64_MODIFIER "x)",
+ details->range->base_address,
+ details->range->base_address + details->range->size,
+ details->protection & GUM_PAGE_READ ? 'R' : '-',
+ details->protection & GUM_PAGE_WRITE ? 'W' : '-',
+ details->protection & GUM_PAGE_EXECUTE ? 'X' : '-', details->file->path,
+ details->file->offset);
}
@@ -581,7 +580,7 @@ static GArray *merge_ranges(GArray *a) {
void ranges_print_debug_maps(void) {
- FVERBOSE("Maps");
+ OKF("Maps");
gum_process_enumerate_ranges(GUM_PAGE_NO_ACCESS, print_ranges_callback, NULL);
}