aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2016-01-25 19:08:17 +0100
committerDmitry Vyukov <dvyukov@google.com>2016-01-26 16:48:37 +0100
commitefe43dc07148eb245f13e9cd30b42de21d514966 (patch)
tree2b638898be3fb6133122f8cce85b52106d99f1fb /host
parent22fda1e655ea348edcbd2d748a1eb65d853b96ee (diff)
sys: open a bunch of new devices
Diffstat (limited to 'host')
-rw-r--r--host/host.go18
1 files changed, 15 insertions, 3 deletions
diff --git a/host/host.go b/host/host.go
index 1225a876e..942632f4c 100644
--- a/host/host.go
+++ b/host/host.go
@@ -7,6 +7,7 @@ import (
"bytes"
"io/ioutil"
"os"
+ "strconv"
"strings"
"syscall"
@@ -68,9 +69,20 @@ func isSupportedSyzkall(kallsyms []byte, c *sys.Call) bool {
if syscall.Getuid() != 0 {
return false
}
- dev := strings.Replace(fname.Val, "#", "0", 1)
- _, err := os.Stat(dev)
- return err == nil
+ var check func(dev string) bool
+ check = func(dev string) bool {
+ if !strings.Contains(dev, "#") {
+ _, err := os.Stat(dev)
+ return err == nil
+ }
+ for i := 0; i < 10; i++ {
+ if check(strings.Replace(dev, "#", strconv.Itoa(i), 1)) {
+ return true
+ }
+ }
+ return false
+ }
+ return check(fname.Val)
case "syz_open_pts":
return true
case "syz_fuse_mount":