diff options
author | van Hauser <vh@thc.org> | 2021-11-16 10:51:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-16 10:51:19 +0100 |
commit | 464f1a78dff320609d4580a7b2493dc5b527df67 (patch) | |
tree | 828fae4c389535372e8bd61ddc8a4c02b751ddac /src/afl-tmin.c | |
parent | 02b621e83c5242493dd6353a158414083885623a (diff) | |
parent | 3f864fa129c821ff35771ad0fe74c9e1ec88ee08 (diff) | |
download | afl++-464f1a78dff320609d4580a7b2493dc5b527df67.tar.gz |
Merge pull request #1156 from retrage/retrage/coresight-mode-pr
Add CoreSight mode support
Diffstat (limited to 'src/afl-tmin.c')
-rw-r--r-- | src/afl-tmin.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/afl-tmin.c b/src/afl-tmin.c index 3f6f14f9..22383a4e 100644 --- a/src/afl-tmin.c +++ b/src/afl-tmin.c @@ -808,6 +808,8 @@ static void set_up_environment(afl_forkserver_t *fsrv, char **argv) { } else { + /* CoreSight mode uses the default behavior. */ + setenv("LD_PRELOAD", getenv("AFL_PRELOAD"), 1); setenv("DYLD_INSERT_LIBRARIES", getenv("AFL_PRELOAD"), 1); @@ -864,6 +866,7 @@ static void usage(u8 *argv0) { " -f file - input file read by the tested program (stdin)\n" " -t msec - timeout for each run (%u ms)\n" " -m megs - memory limit for child process (%u MB)\n" + " -A - use binary-only instrumentation (ARM CoreSight mode)\n" " -O - use binary-only instrumentation (FRIDA mode)\n" " -Q - use binary-only instrumentation (QEMU mode)\n" " -U - use unicorn-based instrumentation (Unicorn mode)\n" @@ -921,7 +924,7 @@ int main(int argc, char **argv_orig, char **envp) { SAYF(cCYA "afl-tmin" VERSION cRST " by Michal Zalewski\n"); - while ((opt = getopt(argc, argv, "+i:o:f:m:t:B:xeOQUWHh")) > 0) { + while ((opt = getopt(argc, argv, "+i:o:f:m:t:B:xeAOQUWHh")) > 0) { switch (opt) { @@ -1033,6 +1036,17 @@ int main(int argc, char **argv_orig, char **envp) { break; + case 'A': /* CoreSight mode */ + +#if !defined(__aarch64__) || !defined(__linux__) + FATAL("-A option is not supported on this platform"); +#endif + + if (fsrv->cs_mode) { FATAL("Multiple -A options not supported"); } + + fsrv->cs_mode = 1; + break; + case 'O': /* FRIDA mode */ if (fsrv->frida_mode) { FATAL("Multiple -O options not supported"); } @@ -1152,6 +1166,11 @@ int main(int argc, char **argv_orig, char **envp) { } + } else if (fsrv->cs_mode) { + + use_argv = + get_cs_argv(argv[0], &fsrv->target_path, argc - optind, argv + optind); + } else { use_argv = argv + optind; |