diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/afl-fuzz.h | 26 | ||||
-rwxr-xr-x | include/android-ashmem.h | 4 | ||||
-rw-r--r-- | include/config.h | 9 |
3 files changed, 28 insertions, 11 deletions
diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h index 90f3b419..8717519b 100644 --- a/include/afl-fuzz.h +++ b/include/afl-fuzz.h @@ -163,7 +163,8 @@ enum { /* 15 */ STAGE_HAVOC, /* 16 */ STAGE_SPLICE, /* 17 */ STAGE_PYTHON, - /* 18 */ STAGE_CUSTOM_MUTATOR + /* 18 */ STAGE_RADAMSA, + /* 19 */ STAGE_CUSTOM_MUTATOR }; @@ -288,6 +289,9 @@ extern char* power_names[POWER_SCHEDULES_NUM]; extern u8 schedule; /* Power schedule (default: EXPLORE)*/ extern u8 havoc_max_mult; +extern u8 use_radamsa; +extern size_t (*radamsa_mutate_ptr)(u8*, size_t, u8*, size_t, u32); + extern u8 skip_deterministic, /* Skip deterministic stages? */ force_deterministic, /* Force deterministic stages? */ use_splicing, /* Recombine input files? */ @@ -404,6 +408,9 @@ extern u64 stage_finds[32], /* Patterns found per fuzz stage */ extern u32 rand_cnt; /* Random number counter */ #endif +extern u32 rand_seed[2]; +extern s64 init_seed; + extern u64 total_cal_us, /* Total calibration time (us) */ total_cal_cycles; /* Total calibration cycles */ @@ -545,7 +552,7 @@ u8 has_new_bits(u8*); u32 count_bits(u8*); u32 count_bytes(u8*); u32 count_non_255_bytes(u8*); -#ifdef __x86_64__ +#ifdef WORD_SIZE_64 void simplify_trace(u64*); void classify_counts(u64*); #else @@ -647,11 +654,9 @@ static inline u32 UR(u32 limit) { #else if (!fixed_seed && unlikely(!rand_cnt--)) { - u32 seed[2]; - - ck_read(dev_urandom_fd, &seed, sizeof(seed), "/dev/urandom"); - srandom(seed[0]); - rand_cnt = (RESEED_RNG / 2) + (seed[1] % RESEED_RNG); + ck_read(dev_urandom_fd, &rand_seed, sizeof(rand_seed), "/dev/urandom"); + srandom(rand_seed[0]); + rand_cnt = (RESEED_RNG / 2) + (rand_seed[1] % RESEED_RNG); } @@ -660,6 +665,13 @@ static inline u32 UR(u32 limit) { } +static inline u32 get_rand_seed() { + + if (fixed_seed) return (u32)init_seed; + return rand_seed[0]; + +} + /* Find first power of two greater or equal to val (assuming val under 2^63). */ diff --git a/include/android-ashmem.h b/include/android-ashmem.h index 7d34b877..2d515cc5 100755 --- a/include/android-ashmem.h +++ b/include/android-ashmem.h @@ -63,7 +63,7 @@ static inline int shmctl(int __shmid, int __cmd, struct shmid_ds *__buf) { } static inline int shmget(key_t __key, size_t __size, int __shmflg) { - + (void) __shmflg; int fd, ret; char ourkey[11]; @@ -86,7 +86,7 @@ error: } static inline void *shmat(int __shmid, const void *__shmaddr, int __shmflg) { - + (void) __shmflg; int size; void *ptr; diff --git a/include/config.h b/include/config.h index edfaf9ad..5934d733 100644 --- a/include/config.h +++ b/include/config.h @@ -54,13 +54,18 @@ #define EXEC_TM_ROUND 20 +/* 64bit arch MACRO */ +#if (defined (__x86_64__) || defined (__arm64__) || defined (__aarch64__)) +#define WORD_SIZE_64 1 +#endif + /* Default memory limit for child process (MB): */ -#ifndef __x86_64__ +#ifndef WORD_SIZE_64 #define MEM_LIMIT 25 #else #define MEM_LIMIT 50 -#endif /* ^!__x86_64__ */ +#endif /* ^!WORD_SIZE_64 */ /* Default memory limit when running in QEMU mode (MB): */ |