From 4daf8570eba286299489fc3ebc7d788c458bb47a Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 6 Apr 2018 18:46:49 +0200 Subject: pkg/host: explain why syscalls are disabled --- pkg/host/host.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 pkg/host/host.go (limited to 'pkg/host/host.go') 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 +} -- cgit mrf-deployment