From 9e8eaa75a18a5cf8102e862be692c0781759e51b Mon Sep 17 00:00:00 2001 From: Kris Alder Date: Mon, 7 Mar 2022 23:00:21 +0000 Subject: 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. --- pkg/host/syscalls.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pkg/host/syscalls.go') 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 -- cgit mrf-deployment