summaryrefslogtreecommitdiffstats
path: root/taskcluster/scripts/misc/afl-nyx.patch
blob: 7a8a55b975d815be740026bcd934e8bffdc73345 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
commit 1e1e67d0a7d16db0a4331702af713a163c40b87f
Author: Jesse Schwartzentruber <truber@mozilla.com>
Date:   Fri Jul 14 11:04:04 2023 -0400

    Increase MAP_SIZE for Nyx

diff --git a/include/config.h b/include/config.h
index 988e536e..5e9870c0 100644
--- a/include/config.h
+++ b/include/config.h
@@ -442,7 +442,7 @@
    problems with complex programs). You need to recompile the target binary
    after changing this - otherwise, SEGVs may ensue. */
 
-#define MAP_SIZE_POW2 16
+#define MAP_SIZE_POW2 23
 
 /* Do not change this unless you really know what you are doing. */

commit e46fac6063f7b0b6eca8e140b10c3a107deb0a0f
Author: Christian Holler (:decoder) <choller@mozilla.com>
Date:   Wed Mar 6 10:19:52 2024 +0100

    Fix delayed pcmap writing for code coverage with pc-table

diff --git a/instrumentation/afl-compiler-rt.o.c b/instrumentation/afl-compiler-rt.o.c
index caa3c3a8..76ceb451 100644
--- a/instrumentation/afl-compiler-rt.o.c
+++ b/instrumentation/afl-compiler-rt.o.c
@@ -1837,7 +1837,7 @@ void __sanitizer_cov_pcs_init(const uintptr_t *pcs_beg,

       }

-      if (pc_filter) {
+      if (pc_filter && !mod_info->next) {

         char PcDescr[1024];
         // This function is a part of the sanitizer run-time.
@@ -1864,7 +1864,7 @@ void __sanitizer_cov_pcs_init(const uintptr_t *pcs_beg,

       }

-      if (__afl_filter_pcs && strstr(mod_info->name, __afl_filter_pcs_module)) {
+      if (__afl_filter_pcs && !mod_info->next && strstr(mod_info->name, __afl_filter_pcs_module)) {

         u32 result_index;
         if (locate_in_pcs(PC, &result_index)) {
@@ -1889,7 +1889,11 @@ void __sanitizer_cov_pcs_init(const uintptr_t *pcs_beg,

     }

-    mod_info->mapped = 1;
+    if (__afl_pcmap_ptr) {
+
+      mod_info->mapped = 1;
+
+    }

     if (__afl_debug) {

commit 58206a3180479416e14ea324607be71ee69caa6f
Author: Jesse Schwartzentruber <truber@mozilla.com>
Date:   Wed Apr 17 14:40:41 2024 -0400

    Set explicit visibility on shared memory variables.

diff --git a/src/afl-cc.c b/src/afl-cc.c
index dd4fb4ea..57089ae0 100644
--- a/src/afl-cc.c
+++ b/src/afl-cc.c
@@ -1591,8 +1591,10 @@ void add_defs_persistent_mode(aflcc_state_t *aflcc) {
   insert_param(aflcc,
                "-D__AFL_FUZZ_INIT()="
                "int __afl_sharedmem_fuzzing = 1;"
-               "extern unsigned int *__afl_fuzz_len;"
-               "extern unsigned char *__afl_fuzz_ptr;"
+               "extern __attribute__((visibility(\"default\"))) "
+               "unsigned int *__afl_fuzz_len;"
+               "extern __attribute__((visibility(\"default\"))) "
+               "unsigned char *__afl_fuzz_ptr;"
                "unsigned char __afl_fuzz_alt[1048576];"
                "unsigned char *__afl_fuzz_alt_ptr = __afl_fuzz_alt;");