mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-14 11:08:06 +00:00
try new weighting
This commit is contained in:
@ -590,9 +590,9 @@ typedef struct afl_state {
|
|||||||
|
|
||||||
u32 rand_cnt; /* Random number counter */
|
u32 rand_cnt; /* Random number counter */
|
||||||
|
|
||||||
/* unsigned long rand_seed[3]; would also work */
|
/* unsigned long rand_seed[3]; would also work */
|
||||||
AFL_RAND_RETURN rand_seed[3];
|
AFL_RAND_RETURN rand_seed[3];
|
||||||
s64 init_seed;
|
s64 init_seed;
|
||||||
|
|
||||||
u64 total_cal_us, /* Total calibration time (us) */
|
u64 total_cal_us, /* Total calibration time (us) */
|
||||||
total_cal_cycles; /* Total calibration cycles */
|
total_cal_cycles; /* Total calibration cycles */
|
||||||
|
@ -43,7 +43,8 @@ inline u32 select_next_queue_entry(afl_state_t *afl) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
double compute_weight(afl_state_t *afl, struct queue_entry *q,
|
double compute_weight(afl_state_t *afl, struct queue_entry *q,
|
||||||
double avg_exec_us, double avg_bitmap_size) {
|
double avg_exec_us, double avg_bitmap_size,
|
||||||
|
double avg_top_size) {
|
||||||
|
|
||||||
double weight = 1.0;
|
double weight = 1.0;
|
||||||
|
|
||||||
@ -54,9 +55,9 @@ double compute_weight(afl_state_t *afl, struct queue_entry *q,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
weight *= avg_exec_us / q->exec_us;
|
if (likely(afl->schedule < RARE)) { weight *= (avg_exec_us / q->exec_us); }
|
||||||
weight *= (log(q->bitmap_size) / avg_bitmap_size);
|
weight *= (q->bitmap_size / avg_bitmap_size);
|
||||||
|
weight *= (log(q->tc_ref) / avg_top_size);
|
||||||
if (unlikely(q->favored)) weight *= 5;
|
if (unlikely(q->favored)) weight *= 5;
|
||||||
|
|
||||||
return weight;
|
return weight;
|
||||||
@ -91,6 +92,7 @@ void create_alias_table(afl_state_t *afl) {
|
|||||||
|
|
||||||
double avg_exec_us = 0.0;
|
double avg_exec_us = 0.0;
|
||||||
double avg_bitmap_size = 0.0;
|
double avg_bitmap_size = 0.0;
|
||||||
|
double avg_top_size = 0.0;
|
||||||
u32 active = 0;
|
u32 active = 0;
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
@ -101,7 +103,8 @@ void create_alias_table(afl_state_t *afl) {
|
|||||||
if (likely(!q->disabled)) {
|
if (likely(!q->disabled)) {
|
||||||
|
|
||||||
avg_exec_us += q->exec_us;
|
avg_exec_us += q->exec_us;
|
||||||
avg_bitmap_size += log(q->bitmap_size);
|
avg_bitmap_size += q->bitmap_size;
|
||||||
|
avg_top_size += log(q->tc_ref);
|
||||||
++active;
|
++active;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -110,6 +113,7 @@ void create_alias_table(afl_state_t *afl) {
|
|||||||
|
|
||||||
avg_exec_us /= active;
|
avg_exec_us /= active;
|
||||||
avg_bitmap_size /= active;
|
avg_bitmap_size /= active;
|
||||||
|
avg_top_size /= active;
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
|
|
||||||
@ -117,7 +121,8 @@ void create_alias_table(afl_state_t *afl) {
|
|||||||
|
|
||||||
if (likely(!q->disabled)) {
|
if (likely(!q->disabled)) {
|
||||||
|
|
||||||
q->weight = compute_weight(afl, q, avg_exec_us, avg_bitmap_size);
|
q->weight =
|
||||||
|
compute_weight(afl, q, avg_exec_us, avg_bitmap_size, avg_top_size);
|
||||||
q->perf_score = calculate_score(afl, q);
|
q->perf_score = calculate_score(afl, q);
|
||||||
sum += q->weight;
|
sum += q->weight;
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ void free(void *ptr) {
|
|||||||
len = PTR_L(ptr);
|
len = PTR_L(ptr);
|
||||||
|
|
||||||
total_mem -= len;
|
total_mem -= len;
|
||||||
u8 * ptr_ = ptr;
|
u8 *ptr_ = ptr;
|
||||||
|
|
||||||
if (align_allocations && (len & (ALLOC_ALIGN_SIZE - 1))) {
|
if (align_allocations && (len & (ALLOC_ALIGN_SIZE - 1))) {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user