diff options
| author | Kris Alder <kalder@google.com> | 2022-03-07 23:00:21 +0000 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2022-03-08 16:54:29 +0100 |
| commit | 9e8eaa75a18a5cf8102e862be692c0781759e51b (patch) | |
| tree | b253a2b502230a21593f5e923f99f282a9c78966 /tools | |
| parent | a5b3b10236688cbda247663ecf994584548f3ef0 (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 'tools')
| -rw-r--r-- | tools/syz-stress/stress.go | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/tools/syz-stress/stress.go b/tools/syz-stress/stress.go index 2122774b6..0b12fc65b 100644 --- a/tools/syz-stress/stress.go +++ b/tools/syz-stress/stress.go @@ -186,30 +186,23 @@ func buildCallList(target *prog.Target, enabled []string) map[*prog.Syscall]bool } return calls } - calls, disabled, err := host.DetectSupportedSyscalls(target, "none") - if err != nil { - log.Fatalf("failed to detect host supported syscalls: %v", err) - } + + enabledSyscalls := make(map[*prog.Syscall]bool) if len(enabled) != 0 { syscallsIDs, err := mgrconfig.ParseEnabledSyscalls(target, enabled, nil) if err != nil { log.Fatalf("failed to parse enabled syscalls: %v", err) } - enabledSyscalls := make(map[*prog.Syscall]bool) for _, id := range syscallsIDs { enabledSyscalls[target.Syscalls[id]] = true } - for c := range calls { - if !enabledSyscalls[c] { - delete(calls, c) - } - } - for c := range disabled { - if !enabledSyscalls[c] { - delete(disabled, c) - } - } } + + calls, disabled, err := host.DetectSupportedSyscalls(target, "none", enabledSyscalls) + if err != nil { + log.Fatalf("failed to detect host supported syscalls: %v", err) + } + for c, reason := range disabled { log.Logf(0, "unsupported syscall: %v: %v", c.Name, reason) } |
