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 /pkg/host/syscalls_linux_test.go | |
| 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 'pkg/host/syscalls_linux_test.go')
| -rw-r--r-- | pkg/host/syscalls_linux_test.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/pkg/host/syscalls_linux_test.go b/pkg/host/syscalls_linux_test.go index 5fc87377c..97f11c25f 100644 --- a/pkg/host/syscalls_linux_test.go +++ b/pkg/host/syscalls_linux_test.go @@ -22,10 +22,6 @@ func TestSupportedSyscalls(t *testing.T) { if err != nil { t.Fatal(err) } - supp, _, err := DetectSupportedSyscalls(target, "none") - if err != nil { - t.Skipf("skipping: %v", err) - } // These are safe to execute with invalid arguments. safe := []string{ "memfd_create", @@ -37,18 +33,26 @@ func TestSupportedSyscalls(t *testing.T) { "write", "stat", } + enabled := make(map[*prog.Syscall]bool) for _, name := range safe { c := target.SyscallMap[name] if c == nil { t.Fatalf("can't find syscall '%v'", name) } + enabled[c] = true + } + supp, _, err := DetectSupportedSyscalls(target, "none", enabled) + if err != nil { + t.Skipf("skipping: %v", err) + } + for c := range enabled { a := ^uintptr(0) - 4097 // hopefully invalid _, _, err := syscall.Syscall6(uintptr(c.NR), a, a, a, a, a, a) if err == 0 { - t.Fatalf("%v did not fail", name) + t.Fatalf("%v did not fail", c.Name) } if ok := err != syscall.ENOSYS; ok != supp[c] { - t.Fatalf("syscall %v: perse=%v kallsyms=%v", name, ok, supp[c]) + t.Fatalf("syscall %v: perse=%v kallsyms=%v", c.Name, ok, supp[c]) } } } |
