@@ -60,6 +60,7 @@ inline u32 select_next_queue_entry(afl_state_t *afl) {
60
60
61
61
}
62
62
63
+ #define DEBUG_QUEUE 1
63
64
double compute_weight (afl_state_t * afl , struct queue_entry * q ,
64
65
double avg_exec_us , double avg_bitmap_size ,
65
66
double avg_top_size , double avg_score ) {
@@ -73,15 +74,46 @@ double compute_weight(afl_state_t *afl, struct queue_entry *q,
73
74
74
75
}
75
76
77
+ #ifdef DEBUG_QUEUE
78
+ fprintf (stderr , "WEIGHT id=%u fname=%s start_weight=1.0\n" , q -> id , q -> fname );
79
+ fprintf (stderr , " after step 1: %.2f (log10(hits))\n" , weight );
80
+ #endif
76
81
if (likely (afl -> schedule < RARE )) { weight *= (avg_exec_us / q -> exec_us ); }
82
+ #ifdef DEBUG_QUEUE
83
+ fprintf (stderr , " after step 2: %.2f (exec_us)\n" , weight );
84
+ #endif
77
85
weight *= (log (q -> bitmap_size ) / avg_bitmap_size );
86
+ #ifdef DEBUG_QUEUE
87
+ fprintf (stderr , " after step 3: %.2f (log(bitmap_size))\n" , weight );
88
+ #endif
78
89
weight *= (1 + (q -> tc_ref / avg_top_size ));
79
- if (unlikely (avg_score != 0.0 )) { weight *= (log (q -> score ) / avg_score ); }
90
+ #ifdef DEBUG_QUEUE
91
+ fprintf (stderr , " after step 4: %.2f (top_size)\n" , weight );
92
+ #endif
93
+ if (unlikely (avg_score != 0.0 )) { weight *= (q -> score / avg_score ); }
94
+ #ifdef DEBUG_QUEUE
95
+ fprintf (stderr , " after step 5: %.2f (score)\n" , weight );
96
+ #endif
80
97
81
98
if (unlikely (weight < 0.1 )) { weight = 0.1 ; }
82
- if (unlikely (q -> favored )) { weight *= 5 ; }
83
- if (unlikely (!q -> was_fuzzed )) { weight *= 2 ; }
84
- if (unlikely (q -> fs_redundant )) { weight *= 0.8 ; }
99
+ if (unlikely (q -> favored )) {
100
+
101
+ weight += 1 ;
102
+ weight *= 5 ;
103
+
104
+ }
105
+
106
+ #ifdef DEBUG_QUEUE
107
+ fprintf (stderr , " after step 6: %.2f (favored)\n" , weight );
108
+ #endif
109
+ if (unlikely (!q -> was_fuzzed )) { weight *= 2.5 ; }
110
+ #ifdef DEBUG_QUEUE
111
+ fprintf (stderr , " after step 7: %.2f (was_fuzzed)\n" , weight );
112
+ #endif
113
+ if (unlikely (q -> fs_redundant )) { weight *= 0.75 ; }
114
+ #ifdef DEBUG_QUEUE
115
+ fprintf (stderr , " after final step: %.2f (fs_redundant)\n" , weight );
116
+ #endif
85
117
86
118
return weight ;
87
119
@@ -133,7 +165,7 @@ void create_alias_table(afl_state_t *afl) {
133
165
avg_exec_us += q -> exec_us ;
134
166
avg_bitmap_size += log (q -> bitmap_size );
135
167
avg_top_size += q -> tc_ref ;
136
- if (exploit ) { avg_score += q -> score ; }
168
+ if (exploit ) { avg_score += /*log(*/ q -> score /*)*/ ; }
137
169
++ active ;
138
170
139
171
}
0 commit comments