From 67fa1f59b87fed7268b465f7e9540a590a250c65 Mon Sep 17 00:00:00 2001 From: m00nbsd Date: Tue, 19 May 2020 21:13:37 +0200 Subject: executor: add support for USB fuzzing on NetBSD --- pkg/host/host_netbsd.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'pkg/host') diff --git a/pkg/host/host_netbsd.go b/pkg/host/host_netbsd.go index 8a8e08de9..4d876f90c 100644 --- a/pkg/host/host_netbsd.go +++ b/pkg/host/host_netbsd.go @@ -4,14 +4,29 @@ package host import ( + "github.com/google/syzkaller/pkg/osutil" "github.com/google/syzkaller/prog" ) func isSupported(c *prog.Syscall, target *prog.Target, sandbox string) (bool, string) { - return true, "" + switch c.CallName { + case "syz_usb_connect", "syz_usb_disconnect": + reason := checkUSBEmulation() + return reason == "", reason + default: + return true, "" + } } func init() { checkFeature[FeatureCoverage] = unconditionallyEnabled checkFeature[FeatureComparisons] = unconditionallyEnabled + checkFeature[FeatureUSBEmulation] = checkUSBEmulation +} + +func checkUSBEmulation() string { + if err := osutil.IsAccessible("/dev/vhci"); err != nil { + return err.Error() + } + return "" } -- cgit mrf-deployment