instance

package
v0.0.0-...-0d592ce Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 21 Imported by: 94

Documentation

Overview

Package instance provides helper functions for creation of temporal instances used for testing of images, patches and bisection.

Index

Constants

This section is empty.

Variables

View Source
var MakeBin = func() string {
	if runtime.GOOS == targets.FreeBSD || runtime.GOOS == targets.OpenBSD {
		return "gmake"
	}
	return "make"
}()

Functions

func ExecprogCmd

func ExecprogCmd(execprog, executor, OS, arch, sandbox string, sandboxArg int, repeat, threaded, collide bool,
	procs, faultCall, faultNth int, optionalFlags bool, slowdown int, progFile string) string

func FuzzerCmd

func FuzzerCmd(args *FuzzerCmdArgs) string

func OldFuzzerCmd

func OldFuzzerCmd(fuzzer, executor, name, OS, arch, fwdAddr, sandbox string, sandboxArg, procs int,
	cover, test, optionalFlags bool, slowdown int) string

func OverrideVMCount

func OverrideVMCount(cfg *mgrconfig.Config, n int) error

func RunnerCmd

func RunnerCmd(prog, fwdAddr, os, arch string, poolIdx, vmIdx int, threaded, newEnv bool) string

func SetConfigImage

func SetConfigImage(cfg *mgrconfig.Config, imageDir string, reliable bool) error

Types

type BuildKernelConfig

type BuildKernelConfig struct {
	CompilerBin  string
	LinkerBin    string
	CcacheBin    string
	UserspaceDir string
	CmdlineFile  string
	SysctlFile   string
	KernelConfig []byte
}

type CrashError

type CrashError struct {
	Report *report.Report
}

func (*CrashError) Error

func (err *CrashError) Error() string

type Env

type Env interface {
	BuildSyzkaller(string, string) (string, error)
	BuildKernel(*BuildKernelConfig) (string, build.ImageDetails, error)
	Test(numVMs int, reproSyz, reproOpts, reproC []byte) ([]EnvTestResult, error)
}

func NewEnv

func NewEnv(cfg *mgrconfig.Config, buildSem, testSem *Semaphore) (Env, error)

type EnvTestResult

type EnvTestResult struct {
	Error     error
	RawOutput []byte
}

type ExecProgInstance

type ExecProgInstance struct {
	VMInstance *vm.Instance
	OptionalConfig
	// contains filtered or unexported fields
}

func CreateExecProgInstance

func CreateExecProgInstance(vmPool *vm.Pool, vmIndex int, mgrCfg *mgrconfig.Config,
	reporter *report.Reporter, opt *OptionalConfig) (*ExecProgInstance, error)

func SetupExecProg

func SetupExecProg(vmInst *vm.Instance, mgrCfg *mgrconfig.Config, reporter *report.Reporter,
	opt *OptionalConfig) (*ExecProgInstance, error)

func (*ExecProgInstance) Close

func (inst *ExecProgInstance) Close()

func (*ExecProgInstance) RunCProg

func (inst *ExecProgInstance) RunCProg(p *prog.Prog, duration time.Duration,
	opts csource.Options) (*RunResult, error)

func (*ExecProgInstance) RunCProgRaw

func (inst *ExecProgInstance) RunCProgRaw(src []byte, target *prog.Target,
	duration time.Duration) (*RunResult, error)

func (*ExecProgInstance) RunSyzProg

func (inst *ExecProgInstance) RunSyzProg(syzProg []byte, duration time.Duration,
	opts csource.Options) (*RunResult, error)

func (*ExecProgInstance) RunSyzProgFile

func (inst *ExecProgInstance) RunSyzProgFile(progFile string, duration time.Duration,
	opts csource.Options) (*RunResult, error)

type ExecutorLogger

type ExecutorLogger func(int, string, ...interface{})

type FuzzerCmdArgs

type FuzzerCmdArgs struct {
	Fuzzer    string
	Executor  string
	Name      string
	OS        string
	Arch      string
	FwdAddr   string
	Sandbox   string
	Procs     int
	Verbosity int
	Cover     bool
	Debug     bool
	Test      bool
	Runtest   bool
	Optional  *OptionalFuzzerArgs
}

type OptionalConfig

type OptionalConfig struct {
	ExitCondition      vm.ExitCondition
	Logf               ExecutorLogger
	OldFlagsCompatMode bool
	BeforeContextLen   int
	StraceBin          string
}

type OptionalFuzzerArgs

type OptionalFuzzerArgs struct {
	Slowdown       int
	RawCover       bool
	SandboxArg     int
	PprofPort      int
	ResetAccState  bool
	NetCompression bool
}

type RunResult

type RunResult struct {
	Output []byte
	Report *report.Report
}

type Semaphore

type Semaphore struct {
	// contains filtered or unexported fields
}

func NewSemaphore

func NewSemaphore(count int) *Semaphore

func (*Semaphore) Available

func (s *Semaphore) Available() int

func (*Semaphore) Signal

func (s *Semaphore) Signal()

func (*Semaphore) Wait

func (s *Semaphore) Wait()

func (*Semaphore) WaitC

func (s *Semaphore) WaitC() <-chan struct{}

type TestError

type TestError struct {
	Boot   bool // says if the error happened during booting or during instance testing
	Infra  bool // whether the problem is related to some infrastructure problems
	Title  string
	Output []byte
	Report *report.Report
}

func (*TestError) Error

func (err *TestError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL