Documentation ¶
Index ¶
Constants ¶
const ( ExecInstrEOF = ^uintptr(iota) ExecInstrCopyin ExecInstrCopyout )
const ( ExecArgConst = uintptr(iota) ExecArgResult ExecArgData ExecArgCsum )
const ( ExecArgCsumChunkData = uintptr(iota) ExecArgCsumChunkConst )
const (
ExecArgCsumInet = uintptr(iota)
)
const (
ExecBufferSize = 2 << 20
)
Variables ¶
This section is empty.
Functions ¶
func CalculatePriorities ¶
Types ¶
type Arg ¶
type Arg struct { Type sys.Type Kind ArgKind Val uintptr // value of ArgConst AddrPage uintptr // page index for ArgPointer address, page count for ArgPageSize AddrOffset int // page offset for ArgPointer address AddrPagesNum uintptr // number of available pages for ArgPointer Data []byte // data of ArgData Inner []*Arg // subargs of ArgGroup Res *Arg // target of ArgResult, pointee for ArgPointer Uses map[*Arg]bool // this arg is used by those ArgResult args OpDiv uintptr // divide result for ArgResult (executed before OpAdd) OpAdd uintptr // add to result for ArgResult // ArgUnion/UnionType Option *Arg OptionType sys.Type }
type ArgKind ¶
type ArgKind int
const ( ArgConst ArgKind = iota ArgResult ArgPointer // even if these are always constant (for reproducibility), we use a separate type because they are represented in an abstract (base+page+offset) form ArgPageSize // same as ArgPointer but base is not added, so it represents "lengths" in pages ArgData ArgGroup // logical group of args (struct or array) ArgUnion ArgReturn // fake value denoting syscall return value )
type ByPhysicalAddr ¶
type ByPhysicalAddr struct { Args Context *execContext }
func (ByPhysicalAddr) Less ¶
func (s ByPhysicalAddr) Less(i, j int) bool
type ChoiceTable ¶
type ChoiceTable struct {
// contains filtered or unexported fields
}
ChooseTable allows to do a weighted choice of a syscall for a given syscall based on call-to-call priorities and a set of enabled syscalls.
func BuildChoiceTable ¶
func BuildChoiceTable(prios [][]float32, enabled map[*sys.Call]bool) *ChoiceTable
type CsumChunk ¶
type CsumChunk struct { Kind CsumChunkKind Arg *Arg // for CsumChunkArg Value uintptr // for CsumChunkConst Size uintptr // for CsumChunkConst }
type CsumChunkKind ¶
type CsumChunkKind int
const ( CsumChunkArg CsumChunkKind = iota CsumChunkConst )
type LogEntry ¶
type LogEntry struct { P *Prog Proc int // index of parallel proc Start int // start offset in log End int // end offset in log Fault bool // program was executed with fault injection in FaultCall/FaultNth FaultCall int FaultNth int }
LogEntry describes one program in execution log.
type Prog ¶
type Prog struct {
Calls []*Call
}
func Deserialize ¶
func Generate ¶
func Generate(rs rand.Source, ncalls int, ct *ChoiceTable) *Prog
Generate generates a random program of length ~ncalls. calls is a set of allowed syscalls, if nil all syscalls are used.
func GenerateAllSyzProg ¶
GenerateAllSyzProg generates a program that contains all pseudo syz_ calls for testing.
func Minimize ¶
Minimize minimizes program p into an equivalent program using the equivalence predicate pred. It iteratively generates simpler programs and asks pred whether it is equal to the orginal program or not. If it is equivalent then the simplification attempt is committed and the process continues.
func (*Prog) SerializeForExec ¶
SerializeForExec serializes program p for execution by process pid into the provided buffer. If the provided buffer is too small for the program an error is returned.