fix fork server kill signals for qemu, unicorn and nyx mode
MODIFY
include/common.h
include/common.h
@@ -79,7 +79,8 @@ int parse_afl_kill_signal(u8 *numeric_signal_as_str, int default_signal);
is NULL, the appropiate values are read from the environment. */
void configure_afl_kill_signals(afl_forkserver_t *fsrv,
char *afl_kill_signal_env,
- char *afl_fsrv_kill_signal_env);
+ char *afl_fsrv_kill_signal_env,
+ int default_server_kill_signal);
/* Read a bitmap from file fname to memory
This is for the -B option again. */

MODIFY
src/afl-analyze.c
src/afl-analyze.c
@@ -1115,7 +1115,8 @@ int main(int argc, char **argv_orig, char **envp) {
}
- configure_afl_kill_signals(&fsrv, NULL, NULL);
+ configure_afl_kill_signals(
+ &fsrv, NULL, NULL, (fsrv.qemu_mode || unicorn_mode) ? SIGKILL : SIGTERM);
read_initial_file();
(void)check_binary_signatures(fsrv.target_path);

MODIFY
src/afl-common.c
src/afl-common.c
@@ -484,7 +484,8 @@ int parse_afl_kill_signal(u8 *numeric_signal_as_str, int default_signal) {
void configure_afl_kill_signals(afl_forkserver_t *fsrv,
char *afl_kill_signal_env,
- char *afl_fsrv_kill_signal_env) {
+ char *afl_fsrv_kill_signal_env,
+ int default_server_kill_signal) {
afl_kill_signal_env =
afl_kill_signal_env ? afl_kill_signal_env : getenv("AFL_KILL_SIGNAL");
@@ -505,8 +506,8 @@ void configure_afl_kill_signals(afl_forkserver_t *fsrv,
}
- fsrv->fsrv_kill_signal =
- parse_afl_kill_signal(afl_fsrv_kill_signal_env, SIGTERM);
+ fsrv->fsrv_kill_signal = parse_afl_kill_signal(afl_fsrv_kill_signal_env,
+ default_server_kill_signal);
}

MODIFY
src/afl-fuzz.c
src/afl-fuzz.c
@@ -1362,8 +1362,12 @@ int main(int argc, char **argv_orig, char **envp) {
#endif
- configure_afl_kill_signals(&afl->fsrv, afl->afl_env.afl_child_kill_signal,
- afl->afl_env.afl_fsrv_kill_signal);
+ configure_afl_kill_signals(
+ &afl->fsrv, afl->afl_env.afl_child_kill_signal,
+ afl->afl_env.afl_fsrv_kill_signal,
+ (afl->fsrv.qemu_mode || afl->unicorn_mode || afl->fsrv.nyx_mode)
+ ? SIGKILL
+ : SIGTERM);
setup_signal_handlers();
check_asan_opts(afl);

MODIFY
src/afl-showmap.c
src/afl-showmap.c
@@ -1264,7 +1264,9 @@ int main(int argc, char **argv_orig, char **envp) {
: 0);
be_quiet = save_be_quiet;
- configure_afl_kill_signals(fsrv, NULL, NULL);
+ configure_afl_kill_signals(
+ fsrv, NULL, NULL,
+ (fsrv->qemu_mode || unicorn_mode) ? SIGKILL : SIGTERM);
if (new_map_size) {

MODIFY
src/afl-tmin.c
src/afl-tmin.c
@@ -1198,7 +1198,8 @@ int main(int argc, char **argv_orig, char **envp) {
}
- configure_afl_kill_signals(fsrv, NULL, NULL);
+ configure_afl_kill_signals(
+ fsrv, NULL, NULL, (fsrv->qemu_mode || unicorn_mode) ? SIGKILL : SIGTERM);
if (getenv("AFL_CRASH_EXITCODE")) {

fix fork server kill signals for qemu, unicorn and nyx mode