instance

package
v0.0.0-...-444551c Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 20 Imported by: 110

Documentation

Overview

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

Index

Constants

View Source
const (
	// It's reasonable to expect that tools/syz-execprog should not normally
	// return a non-zero exit code.
	SyzExitConditions = vm.ExitTimeout | vm.ExitNormal
)

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, vmType string, opts csource.Options,
	optionalFlags bool, slowdown int, progFile string) 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 {
	MakeBin      string
	CompilerBin  string
	LinkerBin    string
	CcacheBin    string
	UserspaceDir string
	CmdlineFile  string
	SysctlFile   string
	KernelConfig []byte
	BuildCPUs    int
}

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)
	CleanKernel(*BuildKernelConfig) 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 ExecParams

type ExecParams struct {
	// Only one of these will be used, depending on the function.
	CProg   *prog.Prog
	SyzProg []byte

	Opts     csource.Options
	Duration time.Duration
	// If ExitConditions is empty, RunSyzProg() will assume instance.SyzExitConditions.
	// RunCProg() always runs with binExitConditions.
	ExitConditions vm.ExitCondition
}

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(params ExecParams) (*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(params ExecParams) (*RunResult, error)

func (*ExecProgInstance) RunSyzProgFile

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

type ExecutorLogger

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

type OptionalConfig

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

type RunResult

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

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