about summary refs log tree commit diff
path: root/nyx_mode/custom_harness/example.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2022-01-22 00:35:07 +0100
committerGitHub <noreply@github.com>2022-01-22 00:35:07 +0100
commit6d2b8e3ed2704d0a2eae7c3506998ae483159bd9 (patch)
tree7fd36987d35abecefb055c104955b74e345a71cf /nyx_mode/custom_harness/example.c
parent452a4cf5be92be405620af29e81541432b60c1ae (diff)
parent06ee6b1986dc83c65e67d827a4fdecc70942f4d1 (diff)
downloadafl++-6d2b8e3ed2704d0a2eae7c3506998ae483159bd9.tar.gz
Merge pull request #1303 from schumilo/dev
update Nyx mode submodules 
Diffstat (limited to 'nyx_mode/custom_harness/example.c')
-rw-r--r--nyx_mode/custom_harness/example.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/nyx_mode/custom_harness/example.c b/nyx_mode/custom_harness/example.c
index 00b516a2..dd268534 100644
--- a/nyx_mode/custom_harness/example.c
+++ b/nyx_mode/custom_harness/example.c
@@ -4,7 +4,10 @@
 #include <inttypes.h>
 #include "nyx.h"
 
-#define TRACE_BUFFER_SIZE (1024 * 64)
+#define TRACE_BUFFER_SIZE (64)
+
+#define PAGE_SIZE 0x1000
+#define MMAP_SIZE(x) ((x & ~(PAGE_SIZE-1)) + PAGE_SIZE)
 
 int main(int argc, char **argv) {
 
@@ -27,8 +30,8 @@ int main(int argc, char **argv) {
   /* this is our "bitmap" that is later shared with the fuzzer (you can also
    * pass the pointer of the bitmap used by compile-time instrumentations in
    * your target) */
-  uint8_t *trace_buffer = mmap(NULL, TRACE_BUFFER_SIZE, PROT_READ | PROT_WRITE,
-                               MAP_SHARED | MAP_ANONYMOUS, -1, 0);
+  uint8_t *trace_buffer = mmap(NULL, MMAP_SIZE(TRACE_BUFFER_SIZE), PROT_READ | 
+                               PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
   memset(trace_buffer, 0,
          TRACE_BUFFER_SIZE);  // makes sure that the bitmap buffer is already
                               // mapped into the guest's memory (alternatively