diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-04-06 18:46:49 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-04-06 18:47:56 +0200 |
| commit | 4daf8570eba286299489fc3ebc7d788c458bb47a (patch) | |
| tree | 99b413a3fad8b7f7bf87c6a1fe957aa0a6112d75 /pkg/host/host.go | |
| parent | 48a846e42b1ef210d410b783656c59d5c2827e11 (diff) | |
pkg/host: explain why syscalls are disabled
Diffstat (limited to 'pkg/host/host.go')
| -rw-r--r-- | pkg/host/host.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/pkg/host/host.go b/pkg/host/host.go new file mode 100644 index 000000000..f3acd05d9 --- /dev/null +++ b/pkg/host/host.go @@ -0,0 +1,27 @@ +// Copyright 2018 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +package host + +import ( + "github.com/google/syzkaller/prog" +) + +// DetectSupportedSyscalls returns list on supported and unsupported syscalls on the host. +// For unsupported syscalls it also returns reason as to why it is unsupported. +func DetectSupportedSyscalls(target *prog.Target, sandbox string) (map[*prog.Syscall]bool, map[*prog.Syscall]string, error) { + supported := make(map[*prog.Syscall]bool) + unsupported := make(map[*prog.Syscall]string) + for _, c := range target.Syscalls { + ok, reason := isSupported(c, sandbox) + if ok { + supported[c] = true + } else { + if reason == "" { + reason = "unknown" + } + unsupported[c] = reason + } + } + return supported, unsupported, nil +} |
