fix pizza mode

This commit is contained in:
vanhauser-thc
2022-04-03 19:14:59 +02:00
parent d9fa6af1b1
commit 15b43e6ce1
6 changed files with 25 additions and 6 deletions

View File

@ -23,6 +23,7 @@ sending a mail to <afl-users+subscribe@googlegroups.com>.
- add AFL_EARY_FORKSERVER to install the forkserver as earliest as
possible in the target (for afl-gcc-fast/afl-clang-fast/
afl-clang-lto)
- document and auto-activate pizza mode on condition
- afl-cc:
- converted all passed to use the new llvm pass manager for llvm 11+
- AFL++ PCGUARD mode is not available for 10.0.1 anymore (11+ only)

View File

@ -549,6 +549,9 @@ checks or alter some of the more exotic semantics of the tool:
constructors in your target you can set `AFL_EARLY_FORKSERVER`.
Note that this is not a compile time option but a runtime option :-)
- set `AFL_PIZZA_MODE` to 1 to enable the April 1st stats menu, set to 0
to disable although it is 1st of April.
## 5) Settings for afl-qemu-trace
The QEMU wrapper used to instrument binary-only code supports several settings:

View File

@ -483,7 +483,8 @@ typedef struct afl_state {
debug, /* Debug mode */
custom_only, /* Custom mutator only mode */
is_main_node, /* if this is the main node */
is_secondary_node; /* if this is a secondary instance */
is_secondary_node, /* if this is a secondary instance */
pizza_is_served; /* pizza mode */
u32 stats_update_freq; /* Stats update frequency (execs) */

View File

@ -502,6 +502,15 @@ void read_afl_environment(afl_state_t *afl, char **envp) {
afl->afl_env.afl_pizza_mode =
atoi((u8 *)get_afl_env(afl_environment_variables[i]));
if (afl->afl_env.afl_pizza_mode == 0) {
afl->afl_env.afl_pizza_mode = 1;
} else {
afl->pizza_is_served = 1;
}
}

View File

@ -437,7 +437,7 @@ static void check_term_size(afl_state_t *afl) {
void show_stats(afl_state_t *afl) {
if (afl->afl_env.afl_pizza_mode) {
if (afl->pizza_is_served) {
show_stats_pizza(afl);

View File

@ -259,6 +259,7 @@ static void usage(u8 *argv0, int more_help) {
"AFL_IGNORE_PROBLEMS: do not abort fuzzing if an incorrect setup is detected during a run\n"
"AFL_IMPORT_FIRST: sync and import test cases from other fuzzer instances first\n"
"AFL_INPUT_LEN_MIN/AFL_INPUT_LEN_MAX: like -g/-G set min/max fuzz length produced\n"
"AFL_PIZZA_MODE: 1 - enforce pizza mode, 0 - disable for April 1st\n"
"AFL_KILL_SIGNAL: Signal ID delivered to child processes on timeout, etc. (default: SIGKILL)\n"
"AFL_MAP_SIZE: the shared memory size for that target. must be >= the size\n"
" the target was compiled for\n"
@ -2274,13 +2275,17 @@ int main(int argc, char **argv_orig, char **envp) {
// queue is fully cycled.
time_t cursec = time(NULL);
struct tm *curdate = localtime(&cursec);
if (curdate->tm_mon == 3 && curdate->tm_mday == 1) {
if (likely(!afl->afl_env.afl_pizza_mode)) {
afl->afl_env.afl_pizza_mode = 1;
if (unlikely(curdate->tm_mon == 3 && curdate->tm_mday == 1)) {
} else {
afl->pizza_is_served = 1;
afl->afl_env.afl_pizza_mode = 0;
} else {
afl->pizza_is_served = 0;
}
}