trace.c (honggfuzz-2.4) | : | trace.c (honggfuzz-2.5) | ||
---|---|---|---|---|
skipping to change at line 37 | skipping to change at line 37 | |||
#include <dirent.h> | #include <dirent.h> | |||
#include <elf.h> | #include <elf.h> | |||
#include <endian.h> | #include <endian.h> | |||
#include <errno.h> | #include <errno.h> | |||
#include <fcntl.h> | #include <fcntl.h> | |||
#include <inttypes.h> | #include <inttypes.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(__GLIBC__) | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | |||
#endif | ||||
#include <sys/personality.h> | #include <sys/personality.h> | |||
#include <sys/ptrace.h> | #include <sys/ptrace.h> | |||
#include <sys/resource.h> | #include <sys/resource.h> | |||
#include <sys/stat.h> | #include <sys/stat.h> | |||
#include <sys/syscall.h> | #include <sys/syscall.h> | |||
#include <sys/time.h> | #include <sys/time.h> | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <sys/uio.h> | #include <sys/uio.h> | |||
#include <sys/user.h> | #include <sys/user.h> | |||
#include <sys/wait.h> | #include <sys/wait.h> | |||
skipping to change at line 232 | skipping to change at line 234 | |||
/* | /* | |||
* Some Android ABIs don't implement PTRACE_GETREGS (e.g. aarch64) | * Some Android ABIs don't implement PTRACE_GETREGS (e.g. aarch64) | |||
*/ | */ | |||
#if defined(PTRACE_GETREGS) | #if defined(PTRACE_GETREGS) | |||
#define PTRACE_GETREGS_AVAILABLE 1 | #define PTRACE_GETREGS_AVAILABLE 1 | |||
#else | #else | |||
#define PTRACE_GETREGS_AVAILABLE 0 | #define PTRACE_GETREGS_AVAILABLE 0 | |||
#endif /* defined(PTRACE_GETREGS) */ | #endif /* defined(PTRACE_GETREGS) */ | |||
#endif /* defined(__ANDROID__) */ | #endif /* defined(__ANDROID__) */ | |||
#if defined(__clang__) | ||||
_Pragma("clang diagnostic push"); | ||||
_Pragma("clang diagnostic ignored \"-Woverride-init\""); | ||||
#endif | ||||
static struct { | static struct { | |||
const char* descr; | const char* descr; | |||
bool important; | bool important; | |||
} arch_sigs[_NSIG + 1] = { | } arch_sigs[_NSIG + 1] = { | |||
[0 ...(_NSIG)].important = false, | [0 ...(_NSIG)].important = false, | |||
[0 ...(_NSIG)].descr = "UNKNOWN", | [0 ...(_NSIG)].descr = "UNKNOWN", | |||
[SIGTRAP].important = false, | [SIGTRAP].important = false, | |||
[SIGTRAP].descr = "SIGTRAP", | [SIGTRAP].descr = "SIGTRAP", | |||
skipping to change at line 266 | skipping to change at line 273 | |||
/* Is affected from tmoutVTALRM flag */ | /* Is affected from tmoutVTALRM flag */ | |||
[SIGVTALRM].important = false, | [SIGVTALRM].important = false, | |||
[SIGVTALRM].descr = "SIGVTALRM-TMOUT", | [SIGVTALRM].descr = "SIGVTALRM-TMOUT", | |||
/* seccomp-bpf kill */ | /* seccomp-bpf kill */ | |||
[SIGSYS].important = true, | [SIGSYS].important = true, | |||
[SIGSYS].descr = "SIGSYS", | [SIGSYS].descr = "SIGSYS", | |||
}; | }; | |||
#if defined(__clang__) | ||||
_Pragma("clang diagnostic pop"); | ||||
#endif | ||||
#ifndef SI_FROMUSER | #ifndef SI_FROMUSER | |||
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0) | #define SI_FROMUSER(siptr) ((siptr)->si_code <= 0) | |||
#endif /* SI_FROMUSER */ | #endif /* SI_FROMUSER */ | |||
static size_t arch_getProcMem(pid_t pid, uint8_t* buf, size_t len, uint64_t pc) { | static size_t arch_getProcMem(pid_t pid, uint8_t* buf, size_t len, uint64_t pc) { | |||
/* | /* | |||
* Let's try process_vm_readv first | * Let's try process_vm_readv first | |||
*/ | */ | |||
const struct iovec local_iov = { | const struct iovec local_iov = { | |||
.iov_base = buf, | .iov_base = buf, | |||
skipping to change at line 534 | skipping to change at line 545 | |||
#endif /* !defined(__ANDROID__) */ | #endif /* !defined(__ANDROID__) */ | |||
/* | /* | |||
* Calculate backtrace callstack hash signature | * Calculate backtrace callstack hash signature | |||
*/ | */ | |||
run->backtrace = sanitizers_hashCallstack(run, funcs, funcCnt, false); | run->backtrace = sanitizers_hashCallstack(run, funcs, funcCnt, false); | |||
} | } | |||
static void arch_traceSaveData(run_t* run, pid_t pid) { | static void arch_traceSaveData(run_t* run, pid_t pid) { | |||
char instr[_HF_INSTR_SZ] = "\x00"; | char instr[_HF_INSTR_SZ] = "\x00"; | |||
siginfo_t si = {}; | siginfo_t si; | |||
memset(&si, '\0', sizeof(si)); | ||||
if (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) == -1) { | if (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) == -1) { | |||
PLOG_W("Couldn't get siginfo for pid %d", pid); | PLOG_W("Couldn't get siginfo for pid %d", pid); | |||
} | } | |||
uint64_t crashAddr = (uint64_t)(uintptr_t)si.si_addr; | uint64_t crashAddr = (uint64_t)(uintptr_t)si.si_addr; | |||
/* User-induced signals don't set si.si_addr */ | /* User-induced signals don't set si.si_addr */ | |||
if (SI_FROMUSER(&si)) { | if (SI_FROMUSER(&si)) { | |||
crashAddr = 0UL; | crashAddr = 0UL; | |||
} | } | |||
End of changes. 5 change blocks. | ||||
1 lines changed or deleted | 13 lines changed or added |