aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/host/syscalls.go
diff options
context:
space:
mode:
authorKris Alder <kalder@google.com>2022-03-07 23:00:21 +0000
committerAleksandr Nogikh <wp32pw@gmail.com>2022-03-08 16:54:29 +0100
commit9e8eaa75a18a5cf8102e862be692c0781759e51b (patch)
treeb253a2b502230a21593f5e923f99f282a9c78966 /pkg/host/syscalls.go
parenta5b3b10236688cbda247663ecf994584548f3ef0 (diff)
pkg/host: only try enabled syscalls when starting syz-fuzzer
When syz-fuzzer starts, it tries all syscalls to filter out any that are not supported. This process should include only the syscalls that are enabled using the 'enable_syscalls' and 'disable_syscalls' fields in syz-manager's config. This is useful for fuzzing Cuttlefish devices, for example, where the 'vhost_vsock' syscall needs to be excluded from fuzzing and from this test.
Diffstat (limited to 'pkg/host/syscalls.go')
-rw-r--r--pkg/host/syscalls.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/host/syscalls.go b/pkg/host/syscalls.go
index c6424bfe4..fd8acc4d1 100644
--- a/pkg/host/syscalls.go
+++ b/pkg/host/syscalls.go
@@ -10,7 +10,7 @@ import (
// 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) (
+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)
@@ -32,6 +32,9 @@ func DetectSupportedSyscalls(target *prog.Target, sandbox string) (
case c.Attrs.Disabled:
ok = false
reason = disabledAttribute
+ case !enabled[c]:
+ ok = false
+ reason = "not in set of enabled calls"
case c.CallName == "syz_execute_func":
// syz_execute_func caused multiple problems:
// 1. First it lead to corpus explosion. The program used existing values in registers