diff options
Diffstat (limited to 'pkg/csource')
| -rw-r--r-- | pkg/csource/common.go | 1 | ||||
| -rw-r--r-- | pkg/csource/generated.go | 11 | ||||
| -rw-r--r-- | pkg/csource/options.go | 6 |
3 files changed, 17 insertions, 1 deletions
diff --git a/pkg/csource/common.go b/pkg/csource/common.go index f4da50b85..e537ed724 100644 --- a/pkg/csource/common.go +++ b/pkg/csource/common.go @@ -94,6 +94,7 @@ func defineList(p, mmapProg *prog.Prog, opts Options) (defines []string) { "SYZ_RESET_NET_NAMESPACE": opts.EnableNetReset, "SYZ_ENABLE_BINFMT_MISC": opts.EnableBinfmtMisc, "SYZ_ENABLE_CLOSE_FDS": opts.EnableCloseFds, + "SYZ_ENABLE_KCSAN": opts.EnableKCSAN, "SYZ_USE_TMP_DIR": opts.UseTmpDir, "SYZ_HANDLE_SEGV": opts.HandleSegv, "SYZ_REPRO": opts.Repro, diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go index a8bebb9a9..c216e0973 100644 --- a/pkg/csource/generated.go +++ b/pkg/csource/generated.go @@ -5193,6 +5193,14 @@ static void setup_binfmt_misc() } #endif +#if SYZ_EXECUTOR || SYZ_ENABLE_KCSAN +static void setup_kcsan() +{ + if (!write_file("/proc/kcsaninfo", "on")) + fail("failed to enable KCSAN"); +} +#endif + #elif GOOS_test #include <stdlib.h> @@ -5671,6 +5679,9 @@ int main(void) #if SYZ_FAULT_INJECTION setup_fault(); #endif +#if SYZ_ENABLE_KCSAN + setup_kcsan(); +#endif #if SYZ_HANDLE_SEGV install_segv_handler(); diff --git a/pkg/csource/options.go b/pkg/csource/options.go index 2eda3acc6..7ad8c1d9c 100644 --- a/pkg/csource/options.go +++ b/pkg/csource/options.go @@ -37,6 +37,7 @@ type Options struct { EnableCgroups bool `json:"cgroups,omitempty"` EnableBinfmtMisc bool `json:"binfmt_misc,omitempty"` EnableCloseFds bool `json:"close_fds"` + EnableKCSAN bool `json:"kcsan,omitempty"` UseTmpDir bool `json:"tmpdir,omitempty"` HandleSegv bool `json:"segv,omitempty"` @@ -121,7 +122,10 @@ func (opts Options) checkLinuxOnly(OS string) error { return fmt.Errorf("option EnableBinfmtMisc is not supported on %v", OS) } if opts.EnableCloseFds { - return fmt.Errorf("EnableCloseFds is not supported on %v", OS) + return fmt.Errorf("option EnableCloseFds is not supported on %v", OS) + } + if opts.EnableKCSAN { + return fmt.Errorf("option EnableKCSAN is not supported on %v", OS) } if opts.Sandbox == sandboxNamespace || (opts.Sandbox == sandboxSetuid && !(OS == openbsd || OS == freebsd || OS == netbsd)) || |
