aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2023-12-15 09:29:11 +0100
committerGitHub <noreply@github.com>2023-12-15 09:29:11 +0100
commit108fb0b29ad1586e668ba23e23a0eb1a13c45c49 (patch)
tree28a5f5091317e9cb7d9151e53f33c7b56cec552b /src
parentef706ad668b36e65d24f352f5bcee22957f5f1cc (diff)
parent8a7705aedbb759dd8ff331d47a99cc6bbc17902b (diff)
downloadafl++-108fb0b29ad1586e668ba23e23a0eb1a13c45c49.tar.gz
Merge pull request #1933 from AFLplusplus/devv4.09c
push to stable
Diffstat (limited to 'src')
-rw-r--r--src/afl-cc.c38
-rw-r--r--src/afl-fuzz-bitmap.c11
2 files changed, 35 insertions, 14 deletions
diff --git a/src/afl-cc.c b/src/afl-cc.c
index ceea61f2..22cce2cd 100644
--- a/src/afl-cc.c
+++ b/src/afl-cc.c
@@ -395,12 +395,16 @@ static void process_params(u32 argc, char **argv) {
}
+ // reset
+ have_instr_list = 0;
+ have_c = 0;
+
if (lto_mode && argc > 1) {
u32 idx;
for (idx = 1; idx < argc; idx++) {
- if (!strncasecmp(argv[idx], "-fpic", 5)) have_pic = 1;
+ if (!strncasecmp(argv[idx], "-fpic", 5)) { have_pic = 1; }
}
@@ -689,6 +693,18 @@ static void edit_params(u32 argc, char **argv, char **envp) {
cc_params = ck_alloc(MAX_PARAMS_NUM * sizeof(u8 *));
+ for (u32 c = 1; c < argc; ++c) {
+
+ if (!strcmp(argv[c], "-c")) have_c = 1;
+ if (!strncmp(argv[c], "-fsanitize-coverage-", 20) &&
+ strstr(argv[c], "list=")) {
+
+ have_instr_list = 1;
+
+ }
+
+ }
+
if (lto_mode) {
if (lto_flag[0] != '-')
@@ -1125,24 +1141,18 @@ static void edit_params(u32 argc, char **argv, char **envp) {
// cc_params[cc_par_cnt++] = "-Qunused-arguments";
- if (lto_mode && argc > 1) {
-
- u32 idx;
- for (idx = 1; idx < argc; idx++) {
-
- if (!strncasecmp(argv[idx], "-fpic", 5)) have_pic = 1;
-
- }
-
- }
-
}
/* Inspect the command line parameters. */
process_params(argc, argv);
- if (!have_pic) { cc_params[cc_par_cnt++] = "-fPIC"; }
+ if (!have_pic) {
+
+ cc_params[cc_par_cnt++] = "-fPIC";
+ have_pic = 1;
+
+ }
if (compiler_mode != GCC_PLUGIN && compiler_mode != GCC &&
!getenv("AFL_LLVM_NO_RPATH")) {
@@ -2303,7 +2313,7 @@ int main(int argc, char **argv, char **envp) {
"0x10000\n"
" AFL_LLVM_DOCUMENT_IDS: write all edge IDs and the corresponding "
"functions\n"
- " into this file\n"
+ " into this file (LTO mode)\n"
" AFL_LLVM_LTO_DONTWRITEID: don't write the highest ID used to a "
"global var\n"
" AFL_LLVM_LTO_STARTID: from which ID to start counting from for "
diff --git a/src/afl-fuzz-bitmap.c b/src/afl-fuzz-bitmap.c
index 568c5274..5f67347c 100644
--- a/src/afl-fuzz-bitmap.c
+++ b/src/afl-fuzz-bitmap.c
@@ -459,6 +459,17 @@ save_if_interesting(afl_state_t *afl, void *mem, u32 len, u8 fault) {
if (unlikely(fault == FSRV_RUN_TMOUT && afl->afl_env.afl_ignore_timeouts)) {
+ if (likely(afl->schedule >= FAST && afl->schedule <= RARE)) {
+
+ classify_counts(&afl->fsrv);
+ u64 cksum = hash64(afl->fsrv.trace_bits, afl->fsrv.map_size, HASH_CONST);
+
+ // Saturated increment
+ if (likely(afl->n_fuzz[cksum % N_FUZZ_SIZE] < 0xFFFFFFFF))
+ afl->n_fuzz[cksum % N_FUZZ_SIZE]++;
+
+ }
+
return 0;
}