arch.c (honggfuzz-2.4) | : | arch.c (honggfuzz-2.5) | ||
---|---|---|---|---|
skipping to change at line 35 | skipping to change at line 35 | |||
#include <ctype.h> | #include <ctype.h> | |||
#include <errno.h> | #include <errno.h> | |||
#include <fcntl.h> | #include <fcntl.h> | |||
#include <locale.h> | #include <locale.h> | |||
#include <poll.h> | #include <poll.h> | |||
#include <signal.h> | #include <signal.h> | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#include <string.h> | #include <string.h> | |||
#if !defined(__sun) | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | |||
#endif | ||||
#include <sys/resource.h> | #include <sys/resource.h> | |||
#include <sys/stat.h> | #include <sys/stat.h> | |||
#include <sys/time.h> | #include <sys/time.h> | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <sys/wait.h> | #include <sys/wait.h> | |||
#include <time.h> | #include <time.h> | |||
#include <unistd.h> | #include <unistd.h> | |||
#include "fuzz.h" | #include "fuzz.h" | |||
#include "libhfcommon/common.h" | #include "libhfcommon/common.h" | |||
skipping to change at line 96 | skipping to change at line 98 | |||
* Resumed by delivery of SIGCONT | * Resumed by delivery of SIGCONT | |||
*/ | */ | |||
if (WIFCONTINUED(status)) { | if (WIFCONTINUED(status)) { | |||
return; | return; | |||
} | } | |||
/* | /* | |||
* Boring, the process just exited | * Boring, the process just exited | |||
*/ | */ | |||
if (WIFEXITED(status)) { | if (WIFEXITED(status)) { | |||
LOG_D("Process (pid %d) exited normally with status %d", pid, WEXITSTATU S(status)); | LOG_D("Process (pid %d) exited normally with status %d", (int)pid, WEXIT STATUS(status)); | |||
return; | return; | |||
} | } | |||
/* | /* | |||
* Shouldn't really happen, but, well.. | * Shouldn't really happen, but, well.. | |||
*/ | */ | |||
if (!WIFSIGNALED(status)) { | if (!WIFSIGNALED(status)) { | |||
LOG_E("Process (pid %d) exited with the following status %d, please repo rt that as a bug", | LOG_E("Process (pid %d) exited with the following status %d, please repo rt that as a bug", | |||
pid, status); | (int)pid, status); | |||
return; | return; | |||
} | } | |||
int termsig = WTERMSIG(status); | int termsig = WTERMSIG(status); | |||
LOG_D("Process (pid %d) killed by signal %d '%s'", pid, termsig, strsignal(t ermsig)); | LOG_D("Process (pid %d) killed by signal %d '%s'", (int)pid, termsig, strsig nal(termsig)); | |||
if (!arch_sigs[termsig].important) { | if (!arch_sigs[termsig].important) { | |||
LOG_D("It's not that important signal, skipping"); | LOG_D("It's not that important signal, skipping"); | |||
return; | return; | |||
} | } | |||
funcs_t* funcs = util_Calloc(_HF_MAX_FUNCS * sizeof(funcs_t)); | funcs_t* funcs = util_Calloc(_HF_MAX_FUNCS * sizeof(funcs_t)); | |||
defer { | defer { | |||
free(funcs); | free(funcs); | |||
}; | }; | |||
uint64_t pc = 0; | uint64_t pc = 0; | |||
skipping to change at line 153 | skipping to change at line 155 | |||
} else if (saveUnique) { | } else if (saveUnique) { | |||
snprintf(run->crashFileName, sizeof(run->crashFileName), | snprintf(run->crashFileName, sizeof(run->crashFileName), | |||
"%s/%s.PC.%" PRIx64 ".STACK.%" PRIx64 ".ADDR.%" PRIx64 ".%s", run->g lobal->io.crashDir, | "%s/%s.PC.%" PRIx64 ".STACK.%" PRIx64 ".ADDR.%" PRIx64 ".%s", run->g lobal->io.crashDir, | |||
util_sigName(termsig), pc, run->backtrace, crashAddr, run->global->i o.fileExtn); | util_sigName(termsig), pc, run->backtrace, crashAddr, run->global->i o.fileExtn); | |||
} else { | } else { | |||
char localtmstr[HF_STR_LEN]; | char localtmstr[HF_STR_LEN]; | |||
util_getLocalTime("%F.%H:%M:%S", localtmstr, sizeof(localtmstr), time(NU LL)); | util_getLocalTime("%F.%H:%M:%S", localtmstr, sizeof(localtmstr), time(NU LL)); | |||
snprintf(run->crashFileName, sizeof(run->crashFileName), | snprintf(run->crashFileName, sizeof(run->crashFileName), | |||
"%s/%s.PC.%" PRIx64 ".STACK.%" PRIx64 ".ADDR.%" PRIx64 ".%s.%d.%s", | "%s/%s.PC.%" PRIx64 ".STACK.%" PRIx64 ".ADDR.%" PRIx64 ".%s.%d.%s", | |||
run->global->io.crashDir, util_sigName(termsig), pc, run->backtrace, crashAddr, | run->global->io.crashDir, util_sigName(termsig), pc, run->backtrace, crashAddr, | |||
localtmstr, pid, run->global->io.fileExtn); | localtmstr, (int)pid, run->global->io.fileExtn); | |||
} | } | |||
if (files_exists(run->crashFileName)) { | if (files_exists(run->crashFileName)) { | |||
LOG_I("Crash (dup): '%s' already exists, skipping", run->crashFileName); | LOG_I("Crash (dup): '%s' already exists, skipping", run->crashFileName); | |||
/* Clear filename so that verifier can understand we hit a duplicate */ | /* Clear filename so that verifier can understand we hit a duplicate */ | |||
memset(run->crashFileName, 0, sizeof(run->crashFileName)); | memset(run->crashFileName, 0, sizeof(run->crashFileName)); | |||
return; | return; | |||
} | } | |||
LOG_I("Ok, that's interesting, saving input '%s'", run->crashFileName); | LOG_I("Ok, that's interesting, saving input '%s'", run->crashFileName); | |||
skipping to change at line 213 | skipping to change at line 215 | |||
return false; | return false; | |||
} | } | |||
if (pid == -1 && errno == ECHILD) { | if (pid == -1 && errno == ECHILD) { | |||
LOG_D("No more processes to track"); | LOG_D("No more processes to track"); | |||
return true; | return true; | |||
} | } | |||
if (pid == -1) { | if (pid == -1) { | |||
PLOG_F("waitpid() failed"); | PLOG_F("waitpid() failed"); | |||
} | } | |||
LOG_D("pid=%d returned with status: %s", pid, subproc_StatusToStr(status )); | LOG_D("pid=%d returned with status: %s", (int)pid, subproc_StatusToStr(s tatus)); | |||
arch_analyzeSignal(run, pid, status); | arch_analyzeSignal(run, pid, status); | |||
if (pid == run->pid && (WIFEXITED(status) || WIFSIGNALED(status))) { | if (pid == run->pid && (WIFEXITED(status) || WIFSIGNALED(status))) { | |||
if (run->global->exe.persistent) { | if (run->global->exe.persistent) { | |||
if (!fuzz_isTerminating()) { | if (!fuzz_isTerminating()) { | |||
LOG_W("Persistent mode: pid=%d exited with status: %s", (int )run->pid, | LOG_W("Persistent mode: pid=%d exited with status: %s", (int )run->pid, | |||
subproc_StatusToStr(status)); | subproc_StatusToStr(status)); | |||
} | } | |||
} | } | |||
End of changes. 7 change blocks. | ||||
5 lines changed or deleted | 7 lines changed or added |