diff options
author | buherator <buherator@silentsignal.hu> | 2021-01-07 22:35:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-07 22:35:34 +0100 |
commit | 9cdf5c415015e4e80b577c021b8b9fcf8a3d58fb (patch) | |
tree | dc0880273395088beffa376627606074c950ed07 /src/afl-fuzz.c | |
parent | 52c221fc484317d2cd3926ae31ac891bad8cc93a (diff) | |
download | afl++-9cdf5c415015e4e80b577c021b8b9fcf8a3d58fb.tar.gz |
User defined kill signal value (#678)
* Adding AFL_KILL_SIGNAL environment variable Controlling the kill signal used to end forked processes. * Checking validity of AFL_KILL_SIGNAL env variable This commit also sets a valid value in the environment to avoid duplicating code in at_exit(). Changing data type of fsrv->kill_signal to u8 to match last_kill_signal. * Adding afl_kill_signal to AFL (environment) state This commit simply introduces a struct member for future use. The env variable is not used from the afl struct but from fsrv, where its validity is checked, resulting in a FATAL in case of errors.
Diffstat (limited to 'src/afl-fuzz.c')
-rw-r--r-- | src/afl-fuzz.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c index 063134fb..00625f2e 100644 --- a/src/afl-fuzz.c +++ b/src/afl-fuzz.c @@ -76,8 +76,17 @@ static void at_exit() { } - if (pid1 > 0) { kill(pid1, SIGKILL); } - if (pid2 > 0) { kill(pid2, SIGKILL); } + u8 kill_signal = SIGKILL; + + /* AFL_KILL_SIGNAL should already be initialized by afl_fsrv_init() */ + if (getenv("AFL_KILL_SIGNAL")) { + + kill_signal = atoi(getenv("AFL_KILL_SIGNAL")); + + } + + if (pid1 > 0) { kill(pid1, kill_signal); } + if (pid2 > 0) { kill(pid2, kill_signal); } } |