mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-14 11:08:06 +00:00
build on arm64 fix. tested on Android. (#313)
This commit is contained in:
@ -61,6 +61,7 @@
|
||||
#include <termios.h>
|
||||
#include <dlfcn.h>
|
||||
#include <sched.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <sys/wait.h>
|
||||
#include <sys/time.h>
|
||||
|
@ -29,6 +29,7 @@
|
||||
#define __AFL_FORKSERVER_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
typedef struct afl_forkserver {
|
||||
|
||||
@ -97,9 +98,9 @@ void afl_fsrv_killall();
|
||||
#endif
|
||||
|
||||
#ifdef RLIMIT_AS
|
||||
#define MSG_ULIMIT_USAGE " ( ulimit -Sv $[%llu << 10];"
|
||||
#define MSG_ULIMIT_USAGE " ( ulimit -Sv $[%" PRIu64 " << 10];"
|
||||
#else
|
||||
#define MSG_ULIMIT_USAGE " ( ulimit -Sd $[%llu << 10];"
|
||||
#define MSG_ULIMIT_USAGE " ( ulimit -Sd $[%" PRIu64 " << 10];"
|
||||
#endif /* ^RLIMIT_AS */
|
||||
|
||||
#endif
|
||||
|
@ -909,7 +909,7 @@ int main(int argc, char **argv, char **envp) {
|
||||
|
||||
}
|
||||
|
||||
if (sscanf(optarg, "%llu%c", &mem_limit, &suffix) < 1 ||
|
||||
if (sscanf(optarg, "%" PRIu64 "%c", &mem_limit, &suffix) < 1 ||
|
||||
optarg[0] == '-')
|
||||
FATAL("Bad syntax used for -m");
|
||||
|
||||
@ -1013,7 +1013,7 @@ int main(int argc, char **argv, char **envp) {
|
||||
|
||||
read_initial_file();
|
||||
|
||||
ACTF("Performing dry run (mem limit = %llu MB, timeout = %u ms%s)...",
|
||||
ACTF("Performing dry run (mem limit = %" PRIu64 " MB, timeout = %u ms%s)...",
|
||||
mem_limit, exec_tmout, edges_only ? ", edges only" : "");
|
||||
|
||||
run_target(use_argv, in_data, in_len, 1);
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <strings.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "debug.h"
|
||||
#include "alloc-inl.h"
|
||||
@ -454,13 +455,13 @@ u8 *stringify_int(u8 *buf, size_t len, u64 val) {
|
||||
} while (0)
|
||||
|
||||
/* 0-9999 */
|
||||
CHK_FORMAT(1, 10000, "%llu", u64);
|
||||
CHK_FORMAT(1, 10000, "%" PRIu64, u64);
|
||||
|
||||
/* 10.0k - 99.9k */
|
||||
CHK_FORMAT(1000, 99.95, "%0.01fk", double);
|
||||
|
||||
/* 100k - 999k */
|
||||
CHK_FORMAT(1000, 1000, "%lluk", u64);
|
||||
CHK_FORMAT(1000, 1000, "%" PRIu64 "k", u64);
|
||||
|
||||
/* 1.00M - 9.99M */
|
||||
CHK_FORMAT(1000 * 1000, 9.995, "%0.02fM", double);
|
||||
@ -469,7 +470,7 @@ u8 *stringify_int(u8 *buf, size_t len, u64 val) {
|
||||
CHK_FORMAT(1000 * 1000, 99.95, "%0.01fM", double);
|
||||
|
||||
/* 100M - 999M */
|
||||
CHK_FORMAT(1000 * 1000, 1000, "%lluM", u64);
|
||||
CHK_FORMAT(1000 * 1000, 1000, "%" PRIu64 "M", u64);
|
||||
|
||||
/* 1.00G - 9.99G */
|
||||
CHK_FORMAT(1000LL * 1000 * 1000, 9.995, "%0.02fG", double);
|
||||
@ -521,13 +522,13 @@ u8 *stringify_float(u8 *buf, size_t len, double val) {
|
||||
u8 *stringify_mem_size(u8 *buf, size_t len, u64 val) {
|
||||
|
||||
/* 0-9999 */
|
||||
CHK_FORMAT(1, 10000, "%llu B", u64);
|
||||
CHK_FORMAT(1, 10000, "%" PRIu64 " B", u64);
|
||||
|
||||
/* 10.0k - 99.9k */
|
||||
CHK_FORMAT(1024, 99.95, "%0.01f kB", double);
|
||||
|
||||
/* 100k - 999k */
|
||||
CHK_FORMAT(1024, 1000, "%llu kB", u64);
|
||||
CHK_FORMAT(1024, 1000, "%" PRIu64 " kB", u64);
|
||||
|
||||
/* 1.00M - 9.99M */
|
||||
CHK_FORMAT(1024 * 1024, 9.995, "%0.02f MB", double);
|
||||
@ -536,7 +537,7 @@ u8 *stringify_mem_size(u8 *buf, size_t len, u64 val) {
|
||||
CHK_FORMAT(1024 * 1024, 99.95, "%0.01f MB", double);
|
||||
|
||||
/* 100M - 999M */
|
||||
CHK_FORMAT(1024 * 1024, 1000, "%llu MB", u64);
|
||||
CHK_FORMAT(1024 * 1024, 1000, "%" PRIu64 " MB", u64);
|
||||
|
||||
/* 1.00G - 9.99G */
|
||||
CHK_FORMAT(1024LL * 1024 * 1024, 9.995, "%0.02f GB", double);
|
||||
@ -614,13 +615,13 @@ u8 *u_stringify_int(u8 *buf, u64 val) {
|
||||
} while (0)
|
||||
|
||||
/* 0-9999 */
|
||||
CHK_FORMAT(1, 10000, "%llu", u64);
|
||||
CHK_FORMAT(1, 10000, "%" PRIu64, u64);
|
||||
|
||||
/* 10.0k - 99.9k */
|
||||
CHK_FORMAT(1000, 99.95, "%0.01fk", double);
|
||||
|
||||
/* 100k - 999k */
|
||||
CHK_FORMAT(1000, 1000, "%lluk", u64);
|
||||
CHK_FORMAT(1000, 1000, "%" PRIu64 "k", u64);
|
||||
|
||||
/* 1.00M - 9.99M */
|
||||
CHK_FORMAT(1000 * 1000, 9.995, "%0.02fM", double);
|
||||
@ -629,7 +630,7 @@ u8 *u_stringify_int(u8 *buf, u64 val) {
|
||||
CHK_FORMAT(1000 * 1000, 99.95, "%0.01fM", double);
|
||||
|
||||
/* 100M - 999M */
|
||||
CHK_FORMAT(1000 * 1000, 1000, "%lluM", u64);
|
||||
CHK_FORMAT(1000 * 1000, 1000, "%" PRIu64 "M", u64);
|
||||
|
||||
/* 1.00G - 9.99G */
|
||||
CHK_FORMAT(1000LL * 1000 * 1000, 9.995, "%0.02fG", double);
|
||||
@ -680,13 +681,13 @@ u8 *u_stringify_float(u8 *buf, double val) {
|
||||
u8 *u_stringify_mem_size(u8 *buf, u64 val) {
|
||||
|
||||
/* 0-9999 */
|
||||
CHK_FORMAT(1, 10000, "%llu B", u64);
|
||||
CHK_FORMAT(1, 10000, "%" PRIu64 " B", u64);
|
||||
|
||||
/* 10.0k - 99.9k */
|
||||
CHK_FORMAT(1024, 99.95, "%0.01f kB", double);
|
||||
|
||||
/* 100k - 999k */
|
||||
CHK_FORMAT(1024, 1000, "%llu kB", u64);
|
||||
CHK_FORMAT(1024, 1000, "%" PRIu64 " kB", u64);
|
||||
|
||||
/* 1.00M - 9.99M */
|
||||
CHK_FORMAT(1024 * 1024, 9.995, "%0.02f MB", double);
|
||||
@ -695,7 +696,7 @@ u8 *u_stringify_mem_size(u8 *buf, u64 val) {
|
||||
CHK_FORMAT(1024 * 1024, 99.95, "%0.01f MB", double);
|
||||
|
||||
/* 100M - 999M */
|
||||
CHK_FORMAT(1024 * 1024, 1000, "%llu MB", u64);
|
||||
CHK_FORMAT(1024 * 1024, 1000, "%" PRIu64 " MB", u64);
|
||||
|
||||
/* 1.00G - 9.99G */
|
||||
CHK_FORMAT(1024LL * 1024 * 1024, 9.995, "%0.02f GB", double);
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/resource.h>
|
||||
|
@ -441,7 +441,7 @@ u8 *describe_op(afl_state_t *afl, u8 hnb) {
|
||||
|
||||
sprintf(ret, "src:%06u", afl->current_entry);
|
||||
|
||||
sprintf(ret + strlen(ret), ",time:%llu", get_cur_time() - afl->start_time);
|
||||
sprintf(ret + strlen(ret), ",time:%" PRIu64, get_cur_time() - afl->start_time);
|
||||
|
||||
if (afl->splicing_with >= 0)
|
||||
sprintf(ret + strlen(ret), "+%06d", afl->splicing_with);
|
||||
@ -659,12 +659,12 @@ u8 save_if_interesting(afl_state_t *afl, void *mem, u32 len, u8 fault) {
|
||||
|
||||
#ifndef SIMPLE_FILES
|
||||
|
||||
snprintf(fn, PATH_MAX, "%s/hangs/id:%06llu,%s", afl->out_dir,
|
||||
snprintf(fn, PATH_MAX, "%s/hangs/id:%06" PRIu64 ",%s", afl->out_dir,
|
||||
afl->unique_hangs, describe_op(afl, 0));
|
||||
|
||||
#else
|
||||
|
||||
snprintf(fn, PATH_MAX, "%s/hangs/id_%06llu", afl->out_dir,
|
||||
snprintf(fn, PATH_MAX, "%s/hangs/id_%06" PRIu64, afl->out_dir,
|
||||
afl->unique_hangs);
|
||||
|
||||
#endif /* ^!SIMPLE_FILES */
|
||||
@ -703,12 +703,12 @@ u8 save_if_interesting(afl_state_t *afl, void *mem, u32 len, u8 fault) {
|
||||
|
||||
#ifndef SIMPLE_FILES
|
||||
|
||||
snprintf(fn, PATH_MAX, "%s/crashes/id:%06llu,sig:%02u,%s", afl->out_dir,
|
||||
snprintf(fn, PATH_MAX, "%s/crashes/id:%06" PRIu64 ",sig:%02u,%s", afl->out_dir,
|
||||
afl->unique_crashes, afl->kill_signal, describe_op(afl, 0));
|
||||
|
||||
#else
|
||||
|
||||
snprintf(fn, PATH_MAX, "%s/crashes/id_%06llu_%02u", afl->out_dir,
|
||||
snprintf(fn, PATH_MAX, "%s/crashes/id_%06" PRIu64 "_%02u", afl->out_dir,
|
||||
afl->unique_crashes, afl->kill_signal);
|
||||
|
||||
#endif /* ^!SIMPLE_FILES */
|
||||
|
@ -494,7 +494,7 @@ void perform_dry_run(afl_state_t *afl) {
|
||||
if (afl->stop_soon) return;
|
||||
|
||||
if (res == afl->crash_mode || res == FAULT_NOBITS)
|
||||
SAYF(cGRA " len = %u, map size = %u, exec speed = %llu us\n" cRST,
|
||||
SAYF(cGRA " len = %u, map size = %u, exec speed = %" PRIu64 " us\n" cRST,
|
||||
q->len, q->bitmap_size, q->exec_us);
|
||||
|
||||
switch (res) {
|
||||
@ -1051,8 +1051,8 @@ static void handle_existing_out_dir(afl_state_t *afl) {
|
||||
u64 start_time2, last_update;
|
||||
|
||||
if (fscanf(f,
|
||||
"start_time : %llu\n"
|
||||
"last_update : %llu\n",
|
||||
"start_time : %" PRIu64 "\n"
|
||||
"last_update : %" PRIu64 "\n",
|
||||
&start_time2, &last_update) != 2)
|
||||
FATAL("Malformed data in '%s'", fn);
|
||||
|
||||
@ -1602,7 +1602,7 @@ void check_cpu_governor(afl_state_t *afl) {
|
||||
|
||||
if (f) {
|
||||
|
||||
if (fscanf(f, "%llu", &min) != 1) min = 0;
|
||||
if (fscanf(f, "%" PRIu64, &min) != 1) min = 0;
|
||||
fclose(f);
|
||||
|
||||
}
|
||||
@ -1611,7 +1611,7 @@ void check_cpu_governor(afl_state_t *afl) {
|
||||
|
||||
if (f) {
|
||||
|
||||
if (fscanf(f, "%llu", &max) != 1) max = 0;
|
||||
if (fscanf(f, "%" PRIu64, &max) != 1) max = 0;
|
||||
fclose(f);
|
||||
|
||||
}
|
||||
@ -1620,7 +1620,7 @@ void check_cpu_governor(afl_state_t *afl) {
|
||||
|
||||
SAYF("\n" cLRD "[-] " cRST
|
||||
"Whoops, your system uses on-demand CPU frequency scaling, adjusted\n"
|
||||
" between %llu and %llu MHz. Unfortunately, the scaling algorithm in "
|
||||
" between %" PRIu64 " and %" PRIu64 " MHz. Unfortunately, the scaling algorithm in "
|
||||
"the\n"
|
||||
" kernel is imperfect and can miss the short-lived processes spawned "
|
||||
"by\n"
|
||||
|
@ -405,7 +405,7 @@ u8 fuzz_one_original(afl_state_t *afl) {
|
||||
|
||||
if (unlikely(afl->not_on_tty)) {
|
||||
|
||||
ACTF("Fuzzing test case #%u (%u total, %llu uniq crashes found)...",
|
||||
ACTF("Fuzzing test case #%u (%u total, %" PRIu64 " uniq crashes found)...",
|
||||
afl->current_entry, afl->queued_paths, afl->unique_crashes);
|
||||
fflush(stdout);
|
||||
|
||||
@ -2432,7 +2432,7 @@ u8 mopt_common_fuzzing(afl_state_t *afl, MOpt_globals_t MOpt_globals) {
|
||||
|
||||
if (afl->not_on_tty) {
|
||||
|
||||
ACTF("Fuzzing test case #%u (%u total, %llu uniq crashes found)...",
|
||||
ACTF("Fuzzing test case #%u (%u total, %" PRIu64 " uniq crashes found)...",
|
||||
afl->current_entry, afl->queued_paths, afl->unique_crashes);
|
||||
fflush(stdout);
|
||||
|
||||
|
@ -89,7 +89,7 @@ u8 run_target(afl_state_t *afl, afl_forkserver_t *fsrv, u32 timeout) {
|
||||
"Unable to communicate with fork server. Some possible reasons:\n\n"
|
||||
" - You've run out of memory. Use -m to increase the the memory "
|
||||
"limit\n"
|
||||
" to something higher than %lld.\n"
|
||||
" to something higher than %" PRIu64 ".\n"
|
||||
" - The binary or one of the libraries it uses manages to "
|
||||
"create\n"
|
||||
" threads before the forkserver initializes.\n"
|
||||
|
@ -70,13 +70,13 @@ void write_stats_file(afl_state_t *afl, double bitmap_cvg, double stability,
|
||||
|
||||
fprintf(
|
||||
f,
|
||||
"start_time : %llu\n"
|
||||
"last_update : %llu\n"
|
||||
"run_time : %llu\n"
|
||||
"start_time : %" PRIu64 "\n"
|
||||
"last_update : %lld\n"
|
||||
"run_time : %lld\n"
|
||||
"fuzzer_pid : %d\n"
|
||||
"cycles_done : %llu\n"
|
||||
"cycles_wo_finds : %llu\n"
|
||||
"execs_done : %llu\n"
|
||||
"cycles_done : %" PRIu64 "\n"
|
||||
"cycles_wo_finds : %" PRIu64 "\n"
|
||||
"execs_done : %" PRIu64 "\n"
|
||||
"execs_per_sec : %0.02f\n"
|
||||
// "real_execs_per_sec: %0.02f\n" // damn the name is too long
|
||||
"paths_total : %u\n"
|
||||
@ -90,12 +90,12 @@ void write_stats_file(afl_state_t *afl, double bitmap_cvg, double stability,
|
||||
"variable_paths : %u\n"
|
||||
"stability : %0.02f%%\n"
|
||||
"bitmap_cvg : %0.02f%%\n"
|
||||
"unique_crashes : %llu\n"
|
||||
"unique_hangs : %llu\n"
|
||||
"last_path : %llu\n"
|
||||
"last_crash : %llu\n"
|
||||
"last_hang : %llu\n"
|
||||
"execs_since_crash : %llu\n"
|
||||
"unique_crashes : %" PRIu64 "\n"
|
||||
"unique_hangs : %" PRIu64 "\n"
|
||||
"last_path : %" PRIu64 "\n"
|
||||
"last_crash : %" PRIu64 "\n"
|
||||
"last_hang : %" PRIu64 "\n"
|
||||
"execs_since_crash : %" PRIu64 "\n"
|
||||
"exec_timeout : %u\n"
|
||||
"slowest_exec_ms : %u\n"
|
||||
"peak_rss_mb : %lu\n"
|
||||
@ -171,7 +171,7 @@ void maybe_update_plot_file(afl_state_t *afl, double bitmap_cvg, double eps) {
|
||||
execs_per_sec */
|
||||
|
||||
fprintf(afl->fsrv.plot_file,
|
||||
"%llu, %llu, %u, %u, %u, %u, %0.02f%%, %llu, %llu, %u, %0.02f\n",
|
||||
"%" PRIu64 ", %" PRIu64 ", %u, %u, %u, %u, %0.02f%%, %" PRIu64 ", %" PRIu64 ", %u, %0.02f\n",
|
||||
get_cur_time() / 1000, afl->queue_cycle - 1, afl->current_entry,
|
||||
afl->queued_paths, afl->pending_not_fuzzed, afl->pending_favored,
|
||||
bitmap_cvg, afl->unique_crashes, afl->unique_hangs, afl->max_depth,
|
||||
|
@ -427,7 +427,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
||||
|
||||
}
|
||||
|
||||
if (sscanf(optarg, "%llu%c", &afl->fsrv.mem_limit, &suffix) < 1 ||
|
||||
if (sscanf(optarg, "%" PRIu64 "%c", &afl->fsrv.mem_limit, &suffix) < 1 ||
|
||||
optarg[0] == '-')
|
||||
FATAL("Bad syntax used for -m");
|
||||
|
||||
@ -537,7 +537,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
||||
case 'V': {
|
||||
|
||||
afl->most_time_key = 1;
|
||||
if (sscanf(optarg, "%llu", &afl->most_time) < 1 || optarg[0] == '-')
|
||||
if (sscanf(optarg, "%" PRIu64, &afl->most_time) < 1 || optarg[0] == '-')
|
||||
FATAL("Bad syntax used for -V");
|
||||
|
||||
} break;
|
||||
@ -545,7 +545,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
||||
case 'E': {
|
||||
|
||||
afl->most_execs_key = 1;
|
||||
if (sscanf(optarg, "%llu", &afl->most_execs) < 1 || optarg[0] == '-')
|
||||
if (sscanf(optarg, "%" PRIu64, &afl->most_execs) < 1 || optarg[0] == '-')
|
||||
FATAL("Bad syntax used for -E");
|
||||
|
||||
} break;
|
||||
@ -556,7 +556,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
||||
afl->limit_time_sig = 1;
|
||||
afl->havoc_max_mult = HAVOC_MAX_MULT_MOPT;
|
||||
|
||||
if (sscanf(optarg, "%llu", &afl->limit_time_puppet) < 1 ||
|
||||
if (sscanf(optarg, "%" PRIu64, &afl->limit_time_puppet) < 1 ||
|
||||
optarg[0] == '-')
|
||||
FATAL("Bad syntax used for -L");
|
||||
|
||||
@ -566,7 +566,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
||||
FATAL("limit_time overflow");
|
||||
afl->limit_time_puppet = limit_time_puppet2;
|
||||
|
||||
SAYF("limit_time_puppet %llu\n", afl->limit_time_puppet);
|
||||
SAYF("limit_time_puppet %" PRIu64 "\n", afl->limit_time_puppet);
|
||||
afl->swarm_now = 0;
|
||||
|
||||
if (afl->limit_time_puppet == 0) afl->key_puppet = 1;
|
||||
@ -1079,7 +1079,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
||||
|
||||
if (unlikely(afl->not_on_tty)) {
|
||||
|
||||
ACTF("Entering queue cycle %llu.", afl->queue_cycle);
|
||||
ACTF("Entering queue cycle %" PRIu64 ".", afl->queue_cycle);
|
||||
fflush(stdout);
|
||||
|
||||
}
|
||||
|
@ -720,7 +720,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
||||
|
||||
}
|
||||
|
||||
if (sscanf(optarg, "%llu%c", &fsrv->mem_limit, &suffix) < 1 ||
|
||||
if (sscanf(optarg, "%" PRIu64 "%c", &fsrv->mem_limit, &suffix) < 1 ||
|
||||
optarg[0] == '-')
|
||||
FATAL("Bad syntax used for -m");
|
||||
|
||||
|
@ -989,7 +989,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
||||
|
||||
}
|
||||
|
||||
if (sscanf(optarg, "%llu%c", &fsrv->mem_limit, &suffix) < 1 ||
|
||||
if (sscanf(optarg, "%" PRIu64 "%c", &fsrv->mem_limit, &suffix) < 1 ||
|
||||
optarg[0] == '-')
|
||||
FATAL("Bad syntax used for -m");
|
||||
|
||||
@ -1134,7 +1134,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
||||
afl_fsrv_start(fsrv, use_argv, &stop_soon,
|
||||
get_afl_env("AFL_DEBUG_CHILD_OUTPUT") ? 1 : 0);
|
||||
|
||||
ACTF("Performing dry run (mem limit = %llu MB, timeout = %u ms%s)...",
|
||||
ACTF("Performing dry run (mem limit = %" PRIu64 " MB, timeout = %u ms%s)...",
|
||||
fsrv->mem_limit, fsrv->exec_tmout, edges_only ? ", edges only" : "");
|
||||
|
||||
run_target(fsrv, use_argv, in_data, in_len, 1);
|
||||
|
Reference in New Issue
Block a user