Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/om/tls/test/fuzz/aflpp-exitrange.patch # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / om / tls / test / fuzz / aflpp-exitrange.patch` 96 lines ยท 3798 bytes Raw Blame History 1 diff --git a/include/forkserver.h b/include/forkserver.h 2 index `80713ea`..`1cdc8fc` 100644 3 --- a/include/forkserver.h 4 +++ b/include/forkserver.h 5 @@ -177,6 +177,7 @@ typedef struct afl_forkserver { 6 7 bool uses_crash_exitcode; /* Custom crash exitcode specified? */ 8 u8 crash_exitcode; /* The crash exitcode specified */ 9 + u8 crash_exitcode_hi; /* Upper end of an exitcode range */ 10 11 u32 *shmem_fuzz_len; /* length of the fuzzing test case */ 12 13 diff --git a/src/afl-forkserver.c b/src/afl-forkserver.c 14 index `ee20b9f`..`ade1d8a` 100644 15 --- a/src/afl-forkserver.c 16 +++ b/src/afl-forkserver.c 17 @@ -359,6 +359,7 @@ void afl_fsrv_init_dup(afl_forkserver_t *fsrv_to, afl_forkserver_t *from) { 18 fsrv_to->allow_cores = from->allow_cores; 19 fsrv_to->uses_crash_exitcode = from->uses_crash_exitcode; 20 fsrv_to->crash_exitcode = from->crash_exitcode; 21 + fsrv_to->crash_exitcode_hi = from->crash_exitcode_hi; 22 fsrv_to->child_kill_signal = from->child_kill_signal; 23 fsrv_to->fsrv_kill_signal = from->fsrv_kill_signal; 24 fsrv_to->debug = from->debug; 25 @@ -2397,8 +2398,9 @@ fsrv_run_result_t __attribute__((hot)) afl_fsrv_run_target( 26 ((fsrv->uses_asan & 2) && 27 WEXITSTATUS(fsrv->child_status) == LSAN_ERROR) || 28 /* the custom crash_exitcode was returned by the target */ 29 - (fsrv->uses_crash_exitcode && 30 - WEXITSTATUS(fsrv->child_status) == fsrv->crash_exitcode))) { 31 + (fsrv->uses_crash_exitcode && WIFEXITED(fsrv->child_status) && 32 + WEXITSTATUS(fsrv->child_status) >= fsrv->crash_exitcode && 33 + WEXITSTATUS(fsrv->child_status) <= fsrv->crash_exitcode_hi))) { 34 35 /* For a proper crash, set last_kill_signal to WTERMSIG, else set it to 0 */ 36 fsrv->last_kill_signal = 37 diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c 38 index `2e0af7a`..`6ab1255` 100644 39 --- a/src/afl-fuzz.c 40 +++ b/src/afl-fuzz.c 41 @@ -1990,7 +1990,22 @@ int main(int argc, char **argv_orig, char **envp) { 42 43 if (afl->afl_env.afl_crash_exitcode) { 44 45 - long exitcode = strtol(afl->afl_env.afl_crash_exitcode, NULL, 10); 46 + char *range_end = NULL; 47 + long exitcode = strtol(afl->afl_env.afl_crash_exitcode, &range_end, 10); 48 + long exitcode_hi = exitcode; 49 + /* omega-mv om/tls/test/fuzz patch: "LO-HI" makes every exit code in 50 + [LO, HI] a crash (Omega program-mode traps exit 100 + code 1..14) */ 51 + if (range_end && *range_end == '-') { 52 + 53 + exitcode_hi = strtol(range_end + 1, NULL, 10); 54 + if (exitcode_hi < exitcode || exitcode_hi > 255) { 55 + 56 + FATAL("Invalid crash exitcode range %s", afl->afl_env.afl_crash_exitcode); 57 + 58 + } 59 + 60 + } 61 + 62 if ((!exitcode && (errno == EINVAL || errno == ERANGE)) || 63 exitcode < -127 || exitcode > 128) { 64 65 @@ -2002,6 +2017,7 @@ int main(int argc, char **argv_orig, char **envp) { 66 afl->fsrv.uses_crash_exitcode = true; 67 // WEXITSTATUS is 8 bit unsigned 68 afl->fsrv.crash_exitcode = (u8)exitcode; 69 + afl->fsrv.crash_exitcode_hi = (u8)exitcode_hi; 70 71 } 72 73 diff --git a/src/afl-showmap.c b/src/afl-showmap.c 74 index `d35d9dd`..`c303258` 100644 75 --- a/src/afl-showmap.c 76 +++ b/src/afl-showmap.c 77 @@ -1721,6 +1721,7 @@ int main(int argc, char **argv_orig, char **envp) { 78 fsrv->uses_crash_exitcode = true; 79 // WEXITSTATUS is 8 bit unsigned 80 fsrv->crash_exitcode = (u8)exitcode; 81 + fsrv->crash_exitcode_hi = (u8)exitcode; 82 83 } 84 85 diff --git a/src/afl-tmin.c b/src/afl-tmin.c 86 index `1711e63`..`597cc4b` 100644 87 --- a/src/afl-tmin.c 88 +++ b/src/afl-tmin.c 89 @@ -1476,6 +1476,7 @@ int main(int argc, char **argv_orig, char **envp) { 90 fsrv->uses_crash_exitcode = true; 91 // WEXITSTATUS is 8 bit unsigned 92 fsrv->crash_exitcode = (u8)exitcode; 93 + fsrv->crash_exitcode_hi = (u8)exitcode; 94 95 } 96