honggfuzz  2.2
About: honggfuzz is a security oriented, feedback-driven, evolutionary, easy-to-use fuzzer with powerful analysis options.
  Fossies Dox: honggfuzz-2.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

trace.c File Reference
#include "netbsd/trace.h"
#include <sys/param.h>
#include <sys/types.h>
#include <sys/ptrace.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/time.h>
#include <sys/uio.h>
#include <sys/wait.h>
#include <ctype.h>
#include <dirent.h>
#include <elf.h>
#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include "libhfcommon/common.h"
#include "libhfcommon/files.h"
#include "libhfcommon/log.h"
#include "libhfcommon/util.h"
#include "netbsd/unwind.h"
#include "report.h"
#include "sanitizers.h"
#include "subproc.h"
#include <capstone/capstone.h>
Include dependency graph for trace.c:

Go to the source code of this file.

Macros

#define REGSIZEINCHAR   (2 * sizeof(register_t) + 3)
 
#define _HF_INSTR_SZ   64
 
#define SI_FROMUSER(siptr)   ((siptr)->si_code == SI_USER)
 

Functions

static size_t arch_getProcMem (pid_t pid, uint8_t *buf, size_t len, register_t pc)
 
static size_t arch_getPC (pid_t pid, lwpid_t lwp, register_t *pc, register_t *status_reg)
 
static void arch_getInstrStr (pid_t pid, lwpid_t lwp, register_t *pc, char *instr)
 
static void arch_traceAnalyzeData (run_t *run, pid_t pid)
 
static void arch_traceSaveData (run_t *run, pid_t pid)
 
static void arch_traceEvent (run_t *run, pid_t pid)
 
void arch_traceAnalyze (run_t *run, int status, pid_t pid)
 
bool arch_traceWaitForPidStop (pid_t pid)
 
bool arch_traceAttach (run_t *run)
 
void arch_traceDetach (pid_t pid)
 
void arch_traceSignalsInit (honggfuzz_t *hfuzz)
 

Variables

struct {
   const char *   descr
 
   bool   important
 
arch_sigs [_NSIG+1]
 

Macro Definition Documentation

◆ _HF_INSTR_SZ

#define _HF_INSTR_SZ   64

Definition at line 72 of file trace.c.

◆ REGSIZEINCHAR

#define REGSIZEINCHAR   (2 * sizeof(register_t) + 3)

Definition at line 70 of file trace.c.

◆ SI_FROMUSER

#define SI_FROMUSER (   siptr)    ((siptr)->si_code == SI_USER)

Definition at line 119 of file trace.c.

Function Documentation

◆ arch_getInstrStr()

static void arch_getInstrStr ( pid_t  pid,
lwpid_t  lwp,
register_t *  pc,
char *  instr 
)
static

Definition at line 167 of file trace.c.

References _HF_INSTR_SZ, arch_getPC(), arch_getProcMem(), and LOG_W.

Referenced by arch_traceSaveData().

◆ arch_getPC()

static size_t arch_getPC ( pid_t  pid,
lwpid_t  lwp,
register_t *  pc,
register_t *  status_reg 
)
static

Definition at line 147 of file trace.c.

References PLOG_D.

Referenced by arch_getInstrStr(), and arch_traceAnalyzeData().

◆ arch_getProcMem()

static size_t arch_getProcMem ( pid_t  pid,
uint8_t *  buf,
size_t  len,
register_t  pc 
)
static

Definition at line 121 of file trace.c.

References len, and PLOG_W.

Referenced by arch_getInstrStr().

◆ arch_traceAnalyze()

void arch_traceAnalyze ( run_t run,
int  status,
pid_t  pid 
)

◆ arch_traceAnalyzeData()

static void arch_traceAnalyzeData ( run_t run,
pid_t  pid 
)
static

◆ arch_traceAttach()

bool arch_traceAttach ( run_t run)

Definition at line 606 of file trace.c.

References arch_traceWaitForPidStop(), LOG_D, run_t::pid, and PLOG_W.

◆ arch_traceDetach()

void arch_traceDetach ( pid_t  pid)

◆ arch_traceEvent()

static void arch_traceEvent ( run_t run,
pid_t  pid 
)
static

Definition at line 456 of file trace.c.

References LOG_D, LOG_E, and PLOG_E.

Referenced by arch_traceAnalyze().

◆ arch_traceSaveData()

◆ arch_traceSignalsInit()

void arch_traceSignalsInit ( honggfuzz_t hfuzz)

◆ arch_traceWaitForPidStop()

bool arch_traceWaitForPidStop ( pid_t  pid)

Definition at line 583 of file trace.c.

References LOG_D, LOG_W, and PLOG_W.

Variable Documentation

◆ arch_sigs

struct { ... } arch_sigs[_NSIG + 1]
Initial value:
= {
[0 ...(_NSIG)].important = false,
[0 ...(_NSIG)].descr = "UNKNOWN",
[SIGTRAP].important = false,
[SIGTRAP].descr = "SIGTRAP",
[SIGILL].important = true,
[SIGILL].descr = "SIGILL",
[SIGFPE].important = true,
[SIGFPE].descr = "SIGFPE",
[SIGSEGV].important = true,
[SIGSEGV].descr = "SIGSEGV",
[SIGBUS].important = true,
[SIGBUS].descr = "SIGBUS",
[SIGABRT].important = true,
[SIGABRT].descr = "SIGABRT",
[SIGVTALRM].important = false,
[SIGVTALRM].descr = "SIGVTALRM-TMOUT",
[SIGSYS].important = true,
[SIGSYS].descr = "SIGSYS",
}

Referenced by arch_traceAnalyze(), and arch_traceSignalsInit().

◆ descr

const char* descr

Definition at line 84 of file trace.c.

◆ important

bool important

Definition at line 85 of file trace.c.

important
bool important
Definition: trace.c:234