diff options
author | Dominik Maier <domenukk@gmail.com> | 2020-06-23 15:08:49 +0200 |
---|---|---|
committer | Dominik Maier <domenukk@gmail.com> | 2020-06-23 15:08:49 +0200 |
commit | aad433e11efa4a8350a264313c66db8ef6d17088 (patch) | |
tree | a8249027f61f17e259e4a4ef6f2339e0394b1e35 /src/afl-fuzz.c | |
parent | c1eb2bccaae8f5b31546e6af3b00583e46bd842b (diff) | |
parent | 59e1a18197b08b08ad9e75b23fb6a5c740a0b9dd (diff) | |
download | afl++-aad433e11efa4a8350a264313c66db8ef6d17088.tar.gz |
Merge branch 'dev' of github.com:vanhauser-thc/AFLplusplus into dev
Diffstat (limited to 'src/afl-fuzz.c')
-rw-r--r-- | src/afl-fuzz.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c index fdc96931..c8083f71 100644 --- a/src/afl-fuzz.c +++ b/src/afl-fuzz.c @@ -31,6 +31,21 @@ extern u64 time_spent_working; #endif +static void at_exit() { + + int i; + char *ptr = getenv("__AFL_TARGET_PID1"); + + if (ptr && *ptr && (i = atoi(ptr)) > 0) kill(i, SIGKILL); + + ptr = getenv("__AFL_TARGET_PID2"); + + if (ptr && *ptr && (i = atoi(ptr)) > 0) kill(i, SIGKILL); + + // anything else? shared memory? + +} + static u8 *get_libradamsa_path(u8 *own_loc) { u8 *tmp, *cp, *rsl, *own_copy; @@ -274,7 +289,7 @@ int main(int argc, char **argv_orig, char **envp) { doc_path = access(DOC_PATH, F_OK) != 0 ? (u8 *)"docs" : (u8 *)DOC_PATH; gettimeofday(&tv, &tz); - afl->init_seed = tv.tv_sec ^ tv.tv_usec ^ getpid(); + rand_set_seed(afl, tv.tv_sec ^ tv.tv_usec ^ getpid()); while ((opt = getopt(argc, argv, "+c:i:I:o:f:m:t:T:dnCB:S:M:x:QNUWe:p:s:V:E:L:hRP:")) > @@ -296,7 +311,7 @@ int main(int argc, char **argv_orig, char **envp) { case 's': { - afl->init_seed = strtoul(optarg, 0L, 10); + rand_set_seed(afl, strtoul(optarg, 0L, 10)); afl->fixed_seed = 1; break; @@ -808,8 +823,7 @@ int main(int argc, char **argv_orig, char **envp) { WARNF( "Using -M main node with the AFL_CUSTOM_MUTATOR_ONLY mutator options " - "will " - "result in no deterministic mutations being done!"); + "will result in no deterministic mutations being done!"); } @@ -819,9 +833,6 @@ int main(int argc, char **argv_orig, char **envp) { } - srandom((u32)afl->init_seed); - srand((u32)afl->init_seed); // in case it is a different implementation - if (afl->use_radamsa) { if (afl->limit_time_sig > 0) { @@ -1234,6 +1245,8 @@ int main(int argc, char **argv_orig, char **envp) { } + atexit(at_exit); + perform_dry_run(afl); cull_queue(afl); |