aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2017-02-17 16:07:48 +0100
committerAndrey Konovalov <andreyknvl@google.com>2017-02-17 21:44:23 +0100
commitb042176ac78c191253124063054b63153abcbe96 (patch)
treea21ab140c086eaecd61d49207b4fe463fde71703
parent1466d0cb9f3cfcd088ad7e7e0c8b79b521d129ab (diff)
host: open /dev/net/tun to check if syz_emit_ethernet is enabled
-rw-r--r--host/host.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/host/host.go b/host/host.go
index 74696e46d..1cea844ff 100644
--- a/host/host.go
+++ b/host/host.go
@@ -99,7 +99,10 @@ func isSupportedSyzkall(c *sys.Call) bool {
_, err := os.Stat("/dev/fuse")
return err == nil && syscall.Getuid() == 0
case "syz_emit_ethernet":
- _, err := os.Stat("/dev/net/tun")
+ fd, err := syscall.Open("/dev/net/tun", syscall.O_RDWR, 0)
+ if err == nil {
+ syscall.Close(fd)
+ }
return err == nil && syscall.Getuid() == 0
case "syz_kvm_setup_cpu":
switch c.Name {