blob: 3068cec2b8f8cf9881062acd01a05e3f6da804ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
// 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/pkg/log"
"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, enabled map[*prog.Syscall]bool) (
map[*prog.Syscall]bool, map[*prog.Syscall]string, error) {
log.Logf(1, "detecting supported syscalls")
supported := make(map[*prog.Syscall]bool)
unsupported := make(map[*prog.Syscall]string)
// These do not have own host and parasitize on some other OS.
if noHostChecks(target) {
for _, c := range target.Syscalls {
if c.Attrs.Disabled || !enabled[c] {
continue
}
supported[c] = true
}
} else {
for _, c := range target.Syscalls {
if c.Attrs.Disabled || !enabled[c] {
continue
}
ok, reason := isSupported(c, target, sandbox)
if ok {
supported[c] = true
} else {
if reason == "" {
reason = "unknown"
}
unsupported[c] = reason
}
}
}
return supported, unsupported, nil
}
var testFallback = false
|