aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/vminfo/vminfo.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-05-03 10:16:58 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-05-15 12:55:36 +0000
commit0b3dad4606c0984ce2d81ba5dd698fa248ce91b8 (patch)
treed732c2d7c4096a3a3223529088725c1adb54e3e0 /pkg/vminfo/vminfo.go
parent94b087b1f1dce14942bc35bb35a8f58e57b1fc63 (diff)
pkg/vminfo: move feature checking to host
Feature checking procedure is split into 2 phases: 1. syz-fuzzer invokes "syz-executor setup feature" for each feature one-by-one, and checks if executor does not fail. Executor can also return a special "this feature does not need custom setup", this allows to not call setup of these features in each new VM. 2. pkg/vminfo runs a simple program with ipc.ExecOpts specific for a concrete feature, e.g. for wifi injection it will try to run a program with wifi feature enabled, if setup of the feature fails, executor should also exit with an error. For coverage features we also additionally check that we actually got coverage. Then pkg/vminfo combines results of these 2 checks into final result. syz-execprog now also uses vminfo package and mimics the same checking procedure. Update #1541
Diffstat (limited to 'pkg/vminfo/vminfo.go')
-rw-r--r--pkg/vminfo/vminfo.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/pkg/vminfo/vminfo.go b/pkg/vminfo/vminfo.go
index efc471b7d..8c5af606e 100644
--- a/pkg/vminfo/vminfo.go
+++ b/pkg/vminfo/vminfo.go
@@ -36,9 +36,13 @@ type Checker struct {
func New(cfg *mgrconfig.Config) *Checker {
var impl checker
- switch {
- case cfg.TargetOS == targets.Linux:
+ switch cfg.TargetOS {
+ case targets.Linux:
impl = new(linux)
+ case targets.NetBSD:
+ impl = new(netbsd)
+ case targets.OpenBSD:
+ impl = new(openbsd)
default:
impl = new(stub)
}
@@ -77,11 +81,11 @@ func (checker *Checker) StartCheck() ([]string, []rpctype.ExecutionRequest) {
return checker.checkFiles(), checker.checkContext.startCheck()
}
-func (checker *Checker) FinishCheck(files []flatrpc.FileInfo, progs []rpctype.ExecutionResult) (
- map[*prog.Syscall]bool, map[*prog.Syscall]string, error) {
+func (checker *Checker) FinishCheck(files []flatrpc.FileInfo, progs []rpctype.ExecutionResult,
+ featureInfos []flatrpc.FeatureInfo) (map[*prog.Syscall]bool, map[*prog.Syscall]string, Features, error) {
ctx := checker.checkContext
checker.checkContext = nil
- return ctx.finishCheck(files, progs)
+ return ctx.finishCheck(files, progs, featureInfos)
}
type machineInfoFunc func(files filesystem, w io.Writer) (string, error)