aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/host
diff options
context:
space:
mode:
authorm00nbsd <john.big.sandwich@gmail.com>2020-05-19 21:13:37 +0200
committerAndrey Konovalov <andreyknvl@gmail.com>2020-05-19 23:07:55 +0200
commit67fa1f59b87fed7268b465f7e9540a590a250c65 (patch)
treed6d7f3c7975308cdef5aaf8cf4a51f7b9ae6de0c /pkg/host
parent8f2ad84be93443ce86dcaa7724cd6d3846b798ad (diff)
executor: add support for USB fuzzing on NetBSD
Diffstat (limited to 'pkg/host')
-rw-r--r--pkg/host/host_netbsd.go17
1 files changed, 16 insertions, 1 deletions
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 ""
}