From 1852eb1814586da4d527df5b75a2850eff3f7144 Mon Sep 17 00:00:00 2001 From: Anton Lindqvist Date: Thu, 2 May 2019 04:30:36 +0200 Subject: sys/openbsd: add vmm descriptions (#1152) Most probably limited to input validation for now. In the future, it could be extended to provide a bootable kernel during vm create (/bsd) and turn vmid into a proper resource. The OpenBSD VMs on GCE does support vmm(4). --- pkg/host/host_openbsd.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'pkg') diff --git a/pkg/host/host_openbsd.go b/pkg/host/host_openbsd.go index 4e4a509c7..bbf373de9 100644 --- a/pkg/host/host_openbsd.go +++ b/pkg/host/host_openbsd.go @@ -4,10 +4,27 @@ package host import ( + "fmt" + "strings" + "syscall" + "github.com/google/syzkaller/prog" ) func isSupported(c *prog.Syscall, target *prog.Target, sandbox string) (bool, string) { + if strings.HasPrefix(c.CallName, "ioctl$VMM_") { + return isSupportedVMM() + } + return true, "" +} + +func isSupportedVMM() (bool, string) { + device := "/dev/vmm" + fd, err := syscall.Open(device, syscall.O_RDONLY, 0) + if fd == -1 { + return false, fmt.Sprintf("open(%v) failed: %v", device, err) + } + syscall.Close(fd) return true, "" } -- cgit mrf-deployment