Back to

Package crashwalk

Latest Go to latest

The highest tagged major version is .

Published: Sep 6, 2018 | License: BSD-3-Clause | Module:


Package crashwalk is a support package for triaging crashfiles on unix systems. It concurrently walks a given root directory and instruments all matching files via an external debugger, passing the results to the caller over a channel.



const MEMORY_LIMIT_MAX = 4096

Maximum value for the MemoryLimit config option (in MB)

const TIMEOUT_MAX = 300

Maximum value for the Timeout config option (in secs)

func Summarize

func Summarize(c crash.Crash) string

Summarize presents a nicely formatted, human readable summary of the crash. Quite a lot of analysis can be performed by combining this output with `awk`,`grep`, `sort`, `uniq -c` etc etc.

type Crashwalk

type Crashwalk struct {
	// contains filtered or unexported fields

Crashwalk is used to Run() walk instances, using the supplied config. Walks are not designed to be externally threadsafe, but can be configured to use multiple goroutines internally. Simultaneous calls to Run() from multiple goroutines will be serialised via an internal mutex.

func NewCrashwalk

func NewCrashwalk(config CrashwalkConfig) (*Crashwalk, error)

NewCrashwalk creates a Crashwalk. Consult the information and warnings for that struct.

func (*Crashwalk) CachedDirJob

func (cw *Crashwalk) CachedDirJob(dn string) Job

CachedDirJob is used during -afl mode to cache the results of parsing AFL's README.txt file, which contains the command, template filename and memory limit that were used for all crashes in that directory.

func (*Crashwalk) Run

func (cw *Crashwalk) Run() <-chan crash.Crash

Run will take one run through the crashes, (optionally) skipping any we have seen, and push all the results down to the end-user on the crash channel. It closes its own resources once the run is finished. Multiple calls to Run() will be serialised via an internal mutex, however this is not recommended. The Workers setting in CrashwalkConfig allows the Run to use multiple goroutines, (and multiple cores, if GOMAXPROCS is set correctly)

type CrashwalkConfig

type CrashwalkConfig struct {
	FilterFunc  func(path string) error // Can be supplied by the user to filter non-crashes in a directory tree
	SeenDB      string                  // path to BoltDB (stores already processed crash info)
	Command     []string                // command to test crashfiles against
	Strict      bool                    // abort if any instrumentation calls error
	Debugger    Debugger                // A debugger that implements our interface
	Root        string                  // Root for the filepath.Walk
	Workers     int                     // number of workers to use
	IncludeSeen bool                    // include seen crashes from the DB to the output channel
	Afl         bool                    // Use the command from README.txt in AFL crash dirs
	Tidy        bool                    // Move crashfiles that error in Run() to a tidy directory
	MemoryLimit int                     // Memory limit (in MB ) to apply to targets ( via ulimit -v )
	Timeout     int                     // Timeout (in secs ) to apply to targets
	File        string                  // Template filename to use. Workers use the base dir and extension with a random name

CrashwalkConfig is used to set the assorted configuration options for NewCrashwalk()

type Debugger

type Debugger interface {
	Run(command []string, filename string, memlimit, timeout int) (crash.Info, error)

Debugger is a simple interface that allows different debugger backends to be used by this package ( GDB, LLDB etc )

type Job

type Job struct {
	InFile      string
	InFileInfo  os.FileInfo
	OutFile     string
	MemoryLimit int
	Timeout     int
	Command     []string

Job is the basic unit of work that will be passed to the configured Debugger

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier